using System;
using System.Globalization;
namespace System.ComponentModel
{
/// Provides a type converter to convert objects to and from various other representations.
// Token: 0x0200005B RID: 91
public class BooleanConverter : TypeConverter
{
/// Gets a value indicating whether this converter can convert an object in the given source type to a Boolean object using the specified context.
/// true if this object can perform the conversion; otherwise, false.
/// An that provides a format context.
/// A that represents the type you wish to convert from.
// Token: 0x06000388 RID: 904 RVA: 0x0000ACBC File Offset: 0x00008EBC
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
/// Converts the given value object to a Boolean object.
/// An that represents the converted .
/// An that provides a format context.
/// A that specifies the culture to which to convert.
/// The to convert.
///
/// is not a valid value for the target type.
/// The conversion cannot be performed.
// Token: 0x06000389 RID: 905 RVA: 0x0000ACD8 File Offset: 0x00008ED8
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value is string)
{
return bool.Parse((string)value);
}
return base.ConvertFrom(context, culture, value);
}
/// Gets a collection of standard values for the Boolean data type.
/// A that holds a standard set of valid values.
/// An that provides a format context.
// Token: 0x0600038A RID: 906 RVA: 0x0000AD00 File Offset: 0x00008F00
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
bool[] array = new bool[2];
array[0] = true;
return new TypeConverter.StandardValuesCollection(array);
}
/// Gets a value indicating whether the list of standard values returned from the method is an exclusive list.
/// true because the returned from is an exhaustive list of possible values. This method never returns false.
/// An that provides a format context.
// Token: 0x0600038B RID: 907 RVA: 0x0000AD14 File Offset: 0x00008F14
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
/// Gets a value indicating whether this object supports a standard set of values that can be picked from a list.
/// true because can be called to find a common set of values the object supports. This method never returns false.
/// An that provides a format context.
// Token: 0x0600038C RID: 908 RVA: 0x0000AD18 File Offset: 0x00008F18
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
}
}