using System; using System.Collections; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Runtime.InteropServices; namespace System.ComponentModel { /// Provides a unified way of converting types of values to other types, as well as for accessing standard values and subproperties. // Token: 0x020000C7 RID: 199 [ComVisible(true)] public class TypeConverter { /// Returns whether this converter can convert an object of the given type to the type of this converter. /// true if this converter can perform the conversion; otherwise, false. /// A that represents the type you want to convert from. // Token: 0x06000683 RID: 1667 RVA: 0x000110C8 File Offset: 0x0000F2C8 public bool CanConvertFrom(Type sourceType) { return this.CanConvertFrom(null, sourceType); } /// Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context. /// true if this converter can perform the conversion; otherwise, false. /// An that provides a format context. /// A that represents the type you want to convert from. // Token: 0x06000684 RID: 1668 RVA: 0x000110D4 File Offset: 0x0000F2D4 public virtual bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(global::System.ComponentModel.Design.Serialization.InstanceDescriptor); } /// Returns whether this converter can convert the object to the specified type. /// true if this converter can perform the conversion; otherwise, false. /// A that represents the type you want to convert to. // Token: 0x06000685 RID: 1669 RVA: 0x000110EC File Offset: 0x0000F2EC public bool CanConvertTo(Type destinationType) { return this.CanConvertTo(null, destinationType); } /// Returns whether this converter can convert the object to the specified type, using the specified context. /// true if this converter can perform the conversion; otherwise, false. /// An that provides a format context. /// A that represents the type you want to convert to. // Token: 0x06000686 RID: 1670 RVA: 0x000110F8 File Offset: 0x0000F2F8 public virtual bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string); } /// Converts the given value to the type of this converter. /// An that represents the converted value. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000687 RID: 1671 RVA: 0x00011108 File Offset: 0x0000F308 public object ConvertFrom(object o) { return this.ConvertFrom(null, CultureInfo.CurrentCulture, o); } /// Converts the given object to the type of this converter, using the specified context and culture information. /// An that represents the converted value. /// An that provides a format context. /// The to use as the current culture. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000688 RID: 1672 RVA: 0x00011118 File Offset: 0x0000F318 public virtual object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is global::System.ComponentModel.Design.Serialization.InstanceDescriptor) { return ((global::System.ComponentModel.Design.Serialization.InstanceDescriptor)value).Invoke(); } return this.GetConvertFromException(value); } /// Converts the given string to the type of this converter, using the invariant culture. /// An that represents the converted text. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000689 RID: 1673 RVA: 0x00011138 File Offset: 0x0000F338 public object ConvertFromInvariantString(string text) { return this.ConvertFromInvariantString(null, text); } /// Converts the given string to the type of this converter, using the invariant culture and the specified context. /// An that represents the converted text. /// An that provides a format context. /// The to convert. /// The conversion cannot be performed. // Token: 0x0600068A RID: 1674 RVA: 0x00011144 File Offset: 0x0000F344 public object ConvertFromInvariantString(ITypeDescriptorContext context, string text) { return this.ConvertFromString(context, CultureInfo.InvariantCulture, text); } /// Converts the specified text to an object. /// An that represents the converted text. /// The text representation of the object to convert. /// The string cannot be converted into the appropriate object. // Token: 0x0600068B RID: 1675 RVA: 0x00011154 File Offset: 0x0000F354 public object ConvertFromString(string text) { return this.ConvertFrom(text); } /// Converts the given text to an object, using the specified context. /// An that represents the converted text. /// An that provides a format context. /// The to convert. /// The conversion cannot be performed. // Token: 0x0600068C RID: 1676 RVA: 0x00011160 File Offset: 0x0000F360 public object ConvertFromString(ITypeDescriptorContext context, string text) { return this.ConvertFromString(context, CultureInfo.CurrentCulture, text); } /// Converts the given text to an object, using the specified context and culture information. /// An that represents the converted text. /// An that provides a format context. /// A . If null is passed, the current culture is assumed. /// The to convert. /// The conversion cannot be performed. // Token: 0x0600068D RID: 1677 RVA: 0x00011170 File Offset: 0x0000F370 public object ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, string text) { return this.ConvertFrom(context, culture, text); } /// Converts the given value object to the specified type, using the arguments. /// An that represents the converted value. /// The to convert. /// The to convert the parameter to. /// The parameter is null. /// The conversion cannot be performed. // Token: 0x0600068E RID: 1678 RVA: 0x0001117C File Offset: 0x0000F37C public object ConvertTo(object value, Type destinationType) { return this.ConvertTo(null, null, value, destinationType); } /// Converts the given value object to the specified type, using the specified context and culture information. /// An that represents the converted value. /// An that provides a format context. /// A . If null is passed, the current culture is assumed. /// The to convert. /// The to convert the parameter to. /// The parameter is null. /// The conversion cannot be performed. // Token: 0x0600068F RID: 1679 RVA: 0x00011188 File Offset: 0x0000F388 public virtual object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType != typeof(string)) { return this.GetConvertToException(value, destinationType); } if (value != null) { return value.ToString(); } return string.Empty; } /// Converts the specified value to a culture-invariant string representation. /// A that represents the converted value. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000690 RID: 1680 RVA: 0x000111D4 File Offset: 0x0000F3D4 public string ConvertToInvariantString(object value) { return this.ConvertToInvariantString(null, value); } /// Converts the specified value to a culture-invariant string representation, using the specified context. /// A that represents the converted value. /// An that provides a format context. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000691 RID: 1681 RVA: 0x000111E0 File Offset: 0x0000F3E0 public string ConvertToInvariantString(ITypeDescriptorContext context, object value) { return (string)this.ConvertTo(context, CultureInfo.InvariantCulture, value, typeof(string)); } /// Converts the specified value to a string representation. /// An that represents the converted value. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000692 RID: 1682 RVA: 0x00011200 File Offset: 0x0000F400 public string ConvertToString(object value) { return (string)this.ConvertTo(null, CultureInfo.CurrentCulture, value, typeof(string)); } /// Converts the given value to a string representation, using the given context. /// An that represents the converted value. /// An that provides a format context. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000693 RID: 1683 RVA: 0x00011220 File Offset: 0x0000F420 public string ConvertToString(ITypeDescriptorContext context, object value) { return (string)this.ConvertTo(context, CultureInfo.CurrentCulture, value, typeof(string)); } /// Converts the given value to a string representation, using the specified context and culture information. /// An that represents the converted value. /// An that provides a format context. /// A . If null is passed, the current culture is assumed. /// The to convert. /// The conversion cannot be performed. // Token: 0x06000694 RID: 1684 RVA: 0x00011240 File Offset: 0x0000F440 public string ConvertToString(ITypeDescriptorContext context, CultureInfo culture, object value) { return (string)this.ConvertTo(context, culture, value, typeof(string)); } /// Returns an exception to throw when a conversion cannot be performed. /// An that represents the exception to throw when a conversion cannot be performed. /// The to convert, or null if the object is not available. /// Automatically thrown by this method. // Token: 0x06000695 RID: 1685 RVA: 0x0001125C File Offset: 0x0000F45C protected Exception GetConvertFromException(object value) { string text; if (value == null) { text = "(null)"; } else { text = value.GetType().FullName; } throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "{0} cannot convert from {1}.", new object[] { base.GetType().Name, text })); } /// Returns an exception to throw when a conversion cannot be performed. /// An that represents the exception to throw when a conversion cannot be performed. /// The to convert, or null if the object is not available. /// A that represents the type the conversion was trying to convert to. /// Automatically thrown by this method. // Token: 0x06000696 RID: 1686 RVA: 0x000112B4 File Offset: 0x0000F4B4 protected Exception GetConvertToException(object value, Type destinationType) { string text; if (value == null) { text = "(null)"; } else { text = value.GetType().FullName; } throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "'{0}' is unable to convert '{1}' to '{2}'.", new object[] { base.GetType().Name, text, destinationType.FullName })); } /// Re-creates an given a set of property values for the object. /// An representing the given , or null if the object cannot be created. This method always returns null. /// An that represents a dictionary of new property values. // Token: 0x06000697 RID: 1687 RVA: 0x00011314 File Offset: 0x0000F514 public object CreateInstance(IDictionary propertyValues) { return this.CreateInstance(null, propertyValues); } /// Creates an instance of the type that this is associated with, using the specified context, given a set of property values for the object. /// An representing the given , or null if the object cannot be created. This method always returns null. /// An that provides a format context. /// An of new property values. // Token: 0x06000698 RID: 1688 RVA: 0x00011320 File Offset: 0x0000F520 public virtual object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) { return null; } /// Returns whether changing a value on this object requires a call to the method to create a new value. /// true if changing a property on this object requires a call to to create a new value; otherwise, false. // Token: 0x06000699 RID: 1689 RVA: 0x00011324 File Offset: 0x0000F524 public bool GetCreateInstanceSupported() { return this.GetCreateInstanceSupported(null); } /// Returns whether changing a value on this object requires a call to to create a new value, using the specified context. /// true if changing a property on this object requires a call to to create a new value; otherwise, false. /// An that provides a format context. // Token: 0x0600069A RID: 1690 RVA: 0x00011330 File Offset: 0x0000F530 public virtual bool GetCreateInstanceSupported(ITypeDescriptorContext context) { return false; } /// Returns a collection of properties for the type of array specified by the value parameter. /// A with the properties that are exposed for this data type, or null if there are no properties. /// An that specifies the type of array for which to get properties. // Token: 0x0600069B RID: 1691 RVA: 0x00011334 File Offset: 0x0000F534 public PropertyDescriptorCollection GetProperties(object value) { return this.GetProperties(null, value); } /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context. /// A with the properties that are exposed for this data type, or null if there are no properties. /// An that provides a format context. /// An that specifies the type of array for which to get properties. // Token: 0x0600069C RID: 1692 RVA: 0x00011340 File Offset: 0x0000F540 public PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value) { return this.GetProperties(context, value, new Attribute[] { BrowsableAttribute.Yes }); } /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. /// A with the properties that are exposed for this data type, or null if there are no properties. /// An that provides a format context. /// An that specifies the type of array for which to get properties. /// An array of type that is used as a filter. // Token: 0x0600069D RID: 1693 RVA: 0x00011358 File Offset: 0x0000F558 public virtual PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { return null; } /// Returns whether this object supports properties. /// true if should be called to find the properties of this object; otherwise, false. // Token: 0x0600069E RID: 1694 RVA: 0x0001135C File Offset: 0x0000F55C public bool GetPropertiesSupported() { return this.GetPropertiesSupported(null); } /// Returns whether this object supports properties, using the specified context. /// true if should be called to find the properties of this object; otherwise, false. /// An that provides a format context. // Token: 0x0600069F RID: 1695 RVA: 0x00011368 File Offset: 0x0000F568 public virtual bool GetPropertiesSupported(ITypeDescriptorContext context) { return false; } /// Returns a collection of standard values from the default context for the data type this type converter is designed for. /// A containing a standard set of valid values, or null if the data type does not support a standard set of values. // Token: 0x060006A0 RID: 1696 RVA: 0x0001136C File Offset: 0x0000F56C public ICollection GetStandardValues() { return this.GetStandardValues(null); } /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context. /// A that holds a standard set of valid values, or null if the data type does not support a standard set of values. /// An that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null. // Token: 0x060006A1 RID: 1697 RVA: 0x00011378 File Offset: 0x0000F578 public virtual TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return null; } /// Returns whether the collection of standard values returned from is an exclusive list. /// true if the returned from is an exhaustive list of possible values; false if other values are possible. // Token: 0x060006A2 RID: 1698 RVA: 0x0001137C File Offset: 0x0000F57C public bool GetStandardValuesExclusive() { return this.GetStandardValuesExclusive(null); } /// Returns whether the collection of standard values returned from is an exclusive list of possible values, using the specified context. /// true if the returned from is an exhaustive list of possible values; false if other values are possible. /// An that provides a format context. // Token: 0x060006A3 RID: 1699 RVA: 0x00011388 File Offset: 0x0000F588 public virtual bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } /// Returns whether this object supports a standard set of values that can be picked from a list. /// true if should be called to find a common set of values the object supports; otherwise, false. // Token: 0x060006A4 RID: 1700 RVA: 0x0001138C File Offset: 0x0000F58C public bool GetStandardValuesSupported() { return this.GetStandardValuesSupported(null); } /// Returns whether this object supports a standard set of values that can be picked from a list, using the specified context. /// true if should be called to find a common set of values the object supports; otherwise, false. /// An that provides a format context. // Token: 0x060006A5 RID: 1701 RVA: 0x00011398 File Offset: 0x0000F598 public virtual bool GetStandardValuesSupported(ITypeDescriptorContext context) { return false; } /// Returns whether the given value object is valid for this type. /// true if the specified value is valid for this object; otherwise, false. /// The object to test for validity. // Token: 0x060006A6 RID: 1702 RVA: 0x0001139C File Offset: 0x0000F59C public bool IsValid(object value) { return this.IsValid(null, value); } /// Returns whether the given value object is valid for this type and for the specified context. /// true if the specified value is valid for this object; otherwise, false. /// An that provides a format context. /// The to test for validity. // Token: 0x060006A7 RID: 1703 RVA: 0x000113A8 File Offset: 0x0000F5A8 public virtual bool IsValid(ITypeDescriptorContext context, object value) { return true; } /// Sorts a collection of properties. /// A that contains the sorted properties. /// A that has the properties to sort. /// An array of names in the order you want the properties to appear in the collection. // Token: 0x060006A8 RID: 1704 RVA: 0x000113AC File Offset: 0x0000F5AC protected PropertyDescriptorCollection SortProperties(PropertyDescriptorCollection props, string[] names) { props.Sort(names); return props; } /// Represents a collection of values. // Token: 0x020000C8 RID: 200 public class StandardValuesCollection : ICollection, IEnumerable { /// Initializes a new instance of the class. /// An that represents the objects to put into the collection. // Token: 0x060006A9 RID: 1705 RVA: 0x000113B8 File Offset: 0x0000F5B8 public StandardValuesCollection(ICollection values) { this.values = values; } /// Copies the contents of this collection to an array. /// The array to copy to. /// The index in the array where copying should begin. // Token: 0x060006AA RID: 1706 RVA: 0x000113C8 File Offset: 0x0000F5C8 void ICollection.CopyTo(Array array, int index) { this.CopyTo(array, index); } /// For a description of this member, see . /// An that can be used to iterate through the collection. // Token: 0x060006AB RID: 1707 RVA: 0x000113D4 File Offset: 0x0000F5D4 IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } /// For a description of this member, see . /// false in all cases. // Token: 0x170001AF RID: 431 // (get) Token: 0x060006AC RID: 1708 RVA: 0x000113DC File Offset: 0x0000F5DC bool ICollection.IsSynchronized { get { return false; } } /// For a description of this member, see . /// null in all cases. // Token: 0x170001B0 RID: 432 // (get) Token: 0x060006AD RID: 1709 RVA: 0x000113E0 File Offset: 0x0000F5E0 object ICollection.SyncRoot { get { return null; } } /// For a description of this member, see . /// The number of elements contained in the . // Token: 0x170001B1 RID: 433 // (get) Token: 0x060006AE RID: 1710 RVA: 0x000113E4 File Offset: 0x0000F5E4 int ICollection.Count { get { return this.Count; } } /// Copies the contents of this collection to an array. /// An that represents the array to copy to. /// The index to start from. // Token: 0x060006AF RID: 1711 RVA: 0x000113EC File Offset: 0x0000F5EC public void CopyTo(Array array, int index) { this.values.CopyTo(array, index); } /// Returns an enumerator for this collection. /// An enumerator of type . // Token: 0x060006B0 RID: 1712 RVA: 0x000113FC File Offset: 0x0000F5FC public IEnumerator GetEnumerator() { return this.values.GetEnumerator(); } /// Gets the number of objects in the collection. /// The number of objects in the collection. // Token: 0x170001B2 RID: 434 // (get) Token: 0x060006B1 RID: 1713 RVA: 0x0001140C File Offset: 0x0000F60C public int Count { get { return this.values.Count; } } /// Gets the object at the specified index number. /// The with the specified index. /// The zero-based index of the to get from the collection. // Token: 0x170001B3 RID: 435 public object this[int index] { get { return ((IList)this.values)[index]; } } // Token: 0x040001EE RID: 494 private ICollection values; } /// Represents an abstract class that provides properties for objects that do not have properties. // Token: 0x020000C9 RID: 201 protected abstract class SimplePropertyDescriptor : PropertyDescriptor { /// Initializes a new instance of the class. /// A that represents the type of component to which this property descriptor binds. /// The name of the property. /// A that represents the data type for this property. // Token: 0x060006B3 RID: 1715 RVA: 0x00011430 File Offset: 0x0000F630 public SimplePropertyDescriptor(Type componentType, string name, Type propertyType) : this(componentType, name, propertyType, null) { } /// Initializes a new instance of the class. /// A that represents the type of component to which this property descriptor binds. /// The name of the property. /// A that represents the data type for this property. /// An array with the attributes to associate with the property. // Token: 0x060006B4 RID: 1716 RVA: 0x0001143C File Offset: 0x0000F63C public SimplePropertyDescriptor(Type componentType, string name, Type propertyType, Attribute[] attributes) : base(name, attributes) { this.componentType = componentType; this.propertyType = propertyType; } /// Gets the type of component to which this property description binds. /// A that represents the type of component to which this property binds. // Token: 0x170001B4 RID: 436 // (get) Token: 0x060006B5 RID: 1717 RVA: 0x00011458 File Offset: 0x0000F658 public override Type ComponentType { get { return this.componentType; } } /// Gets the type of the property. /// A that represents the type of the property. // Token: 0x170001B5 RID: 437 // (get) Token: 0x060006B6 RID: 1718 RVA: 0x00011460 File Offset: 0x0000F660 public override Type PropertyType { get { return this.propertyType; } } /// Gets a value indicating whether this property is read-only. /// true if the property is read-only; false if the property is read/write. // Token: 0x170001B6 RID: 438 // (get) Token: 0x060006B7 RID: 1719 RVA: 0x00011468 File Offset: 0x0000F668 public override bool IsReadOnly { get { return this.Attributes.Contains(ReadOnlyAttribute.Yes); } } /// Returns whether the value of this property can persist. /// true if the value of the property can persist; otherwise, false. /// The component with the property that is to be examined for persistence. // Token: 0x060006B8 RID: 1720 RVA: 0x0001147C File Offset: 0x0000F67C public override bool ShouldSerializeValue(object component) { return false; } /// Returns whether resetting the component changes the value of the component. /// true if resetting the component changes the value of the component; otherwise, false. /// The component to test for reset capability. // Token: 0x060006B9 RID: 1721 RVA: 0x00011480 File Offset: 0x0000F680 public override bool CanResetValue(object component) { DefaultValueAttribute defaultValueAttribute = (DefaultValueAttribute)this.Attributes[typeof(DefaultValueAttribute)]; return defaultValueAttribute != null && defaultValueAttribute.Value == this.GetValue(component); } /// Resets the value for this property of the component. /// The component with the property value to be reset. // Token: 0x060006BA RID: 1722 RVA: 0x000114C0 File Offset: 0x0000F6C0 public override void ResetValue(object component) { DefaultValueAttribute defaultValueAttribute = (DefaultValueAttribute)this.Attributes[typeof(DefaultValueAttribute)]; if (defaultValueAttribute != null) { this.SetValue(component, defaultValueAttribute.Value); } } // Token: 0x040001EF RID: 495 private Type componentType; // Token: 0x040001F0 RID: 496 private Type propertyType; } } }