using System; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Reflection; namespace System.ComponentModel { /// Provides a type converter to convert objects to and from various other representations. // Token: 0x0200006B RID: 107 public class DecimalConverter : BaseNumberConverter { /// Initializes a new instance of the class. // Token: 0x060003EF RID: 1007 RVA: 0x0000C04C File Offset: 0x0000A24C public DecimalConverter() { this.InnerType = typeof(decimal); } // Token: 0x1700010F RID: 271 // (get) Token: 0x060003F0 RID: 1008 RVA: 0x0000C064 File Offset: 0x0000A264 internal override bool SupportHex { get { return false; } } /// Gets a value indicating whether this converter can convert an object to the given destination type using the context. /// true if this converter can perform the conversion; otherwise, false. /// An that provides a format context. /// A that represents the type you wish to convert to. // Token: 0x060003F1 RID: 1009 RVA: 0x0000C068 File Offset: 0x0000A268 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(global::System.ComponentModel.Design.Serialization.InstanceDescriptor) || base.CanConvertTo(context, destinationType); } /// Converts the given value object to a using the arguments. /// An that represents the converted value. /// An that provides a format context. /// An optional . If not supplied, the current culture is assumed. /// The to convert. /// The to convert the value to. /// The is null. /// The conversion cannot be performed. // Token: 0x060003F2 RID: 1010 RVA: 0x0000C084 File Offset: 0x0000A284 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(global::System.ComponentModel.Design.Serialization.InstanceDescriptor) && value is decimal) { decimal num = (decimal)value; ConstructorInfo constructor = typeof(decimal).GetConstructor(new Type[] { typeof(int[]) }); return new global::System.ComponentModel.Design.Serialization.InstanceDescriptor(constructor, new object[] { decimal.GetBits(num) }); } return base.ConvertTo(context, culture, value, destinationType); } // Token: 0x060003F3 RID: 1011 RVA: 0x0000C0F8 File Offset: 0x0000A2F8 internal override string ConvertToString(object value, NumberFormatInfo format) { return ((decimal)value).ToString("G", format); } // Token: 0x060003F4 RID: 1012 RVA: 0x0000C11C File Offset: 0x0000A31C internal override object ConvertFromString(string value, NumberFormatInfo format) { return decimal.Parse(value, NumberStyles.Float, format); } } }