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