Files
2026-06-04 11:42:34 +02:00

179 lines
8.1 KiB
C#

using System;
using System.Collections;
namespace System.ComponentModel
{
/// <summary>Provides supplemental metadata to the <see cref="T:System.ComponentModel.TypeDescriptor" />.</summary>
// Token: 0x020000CB RID: 203
public abstract class TypeDescriptionProvider
{
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> class.</summary>
// Token: 0x060006C2 RID: 1730 RVA: 0x00011580 File Offset: 0x0000F780
protected TypeDescriptionProvider()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> class using a parent type description provider.</summary>
/// <param name="parent">The parent type description provider.</param>
// Token: 0x060006C3 RID: 1731 RVA: 0x00011588 File Offset: 0x0000F788
protected TypeDescriptionProvider(TypeDescriptionProvider parent)
{
this._parent = parent;
}
/// <summary>Creates an object that can substitute for another data type.</summary>
/// <returns>The substitute <see cref="T:System.Object" />.</returns>
/// <param name="provider">An optional service provider.</param>
/// <param name="objectType">The type of object to create. This parameter is never null.</param>
/// <param name="argTypes">An optional array of types that represent the parameter types to be passed to the object's constructor. This array can be null or of zero length.</param>
/// <param name="args">An optional array of parameter values to pass to the object's constructor.</param>
// Token: 0x060006C4 RID: 1732 RVA: 0x00011598 File Offset: 0x0000F798
public virtual object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args)
{
if (this._parent != null)
{
return this._parent.CreateInstance(provider, objectType, argTypes, args);
}
return Activator.CreateInstance(objectType, args);
}
/// <summary>Gets a per-object cache, accessed as an <see cref="T:System.Collections.IDictionary" /> of key/value pairs.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionary" /> if the provided object supports caching; otherwise, null.</returns>
/// <param name="instance">The object for which to get the cache.</param>
// Token: 0x060006C5 RID: 1733 RVA: 0x000115CC File Offset: 0x0000F7CC
public virtual IDictionary GetCache(object instance)
{
if (this._parent != null)
{
return this._parent.GetCache(instance);
}
return null;
}
/// <summary>Gets an extended custom type descriptor for the given object.</summary>
/// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide extended metadata for the object.</returns>
/// <param name="instance">The object for which to get the extended type descriptor.</param>
// Token: 0x060006C6 RID: 1734 RVA: 0x000115E8 File Offset: 0x0000F7E8
public virtual ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance)
{
if (this._parent != null)
{
return this._parent.GetExtendedTypeDescriptor(instance);
}
if (this._emptyCustomTypeDescriptor == null)
{
this._emptyCustomTypeDescriptor = new TypeDescriptionProvider.EmptyCustomTypeDescriptor();
}
return this._emptyCustomTypeDescriptor;
}
/// <summary>Gets the name of the specified component, or null if the component has no name.</summary>
/// <returns>The name of the specified component.</returns>
/// <param name="component">The specified component.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="component" /> is null.</exception>
// Token: 0x060006C7 RID: 1735 RVA: 0x0001162C File Offset: 0x0000F82C
public virtual string GetFullComponentName(object component)
{
if (this._parent != null)
{
return this._parent.GetFullComponentName(component);
}
return this.GetTypeDescriptor(component).GetComponentName();
}
/// <summary>Performs normal reflection against the given object.</summary>
/// <returns>A <see cref="T:System.Type" />.</returns>
/// <param name="instance">An instance of the type (should not be null).</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="instance" /> is null.</exception>
// Token: 0x060006C8 RID: 1736 RVA: 0x00011660 File Offset: 0x0000F860
public Type GetReflectionType(object instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
return this.GetReflectionType(instance.GetType(), instance);
}
/// <summary>Performs normal reflection against a type.</summary>
/// <returns>A <see cref="T:System.Type" />.</returns>
/// <param name="objectType">The type of object for which to retrieve the <see cref="T:System.Reflection.IReflect" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="objectType" /> is null.</exception>
// Token: 0x060006C9 RID: 1737 RVA: 0x00011680 File Offset: 0x0000F880
public Type GetReflectionType(Type objectType)
{
return this.GetReflectionType(objectType, null);
}
/// <summary>Performs normal reflection against the given object with the given type.</summary>
/// <returns>A <see cref="T:System.Type" />.</returns>
/// <param name="objectType">The type of object for which to retrieve the <see cref="T:System.Reflection.IReflect" />.</param>
/// <param name="instance">An instance of the type. Can be null.</param>
// Token: 0x060006CA RID: 1738 RVA: 0x0001168C File Offset: 0x0000F88C
public virtual Type GetReflectionType(Type objectType, object instance)
{
if (this._parent != null)
{
return this._parent.GetReflectionType(objectType, instance);
}
return objectType;
}
/// <summary>Gets a custom type descriptor for the given object.</summary>
/// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide metadata for the type.</returns>
/// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor" />.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="instance" /> is null.</exception>
// Token: 0x060006CB RID: 1739 RVA: 0x000116A8 File Offset: 0x0000F8A8
public ICustomTypeDescriptor GetTypeDescriptor(object instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
return this.GetTypeDescriptor(instance.GetType(), instance);
}
/// <summary>Gets a custom type descriptor for the given type.</summary>
/// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide metadata for the type.</returns>
/// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
// Token: 0x060006CC RID: 1740 RVA: 0x000116C8 File Offset: 0x0000F8C8
public ICustomTypeDescriptor GetTypeDescriptor(Type objectType)
{
return this.GetTypeDescriptor(objectType, null);
}
/// <summary>Gets a custom type descriptor for the given type and object.</summary>
/// <returns>An <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> that can provide metadata for the type.</returns>
/// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
/// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor" />.</param>
// Token: 0x060006CD RID: 1741 RVA: 0x000116D4 File Offset: 0x0000F8D4
public virtual ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
{
if (this._parent != null)
{
return this._parent.GetTypeDescriptor(objectType, instance);
}
if (this._emptyCustomTypeDescriptor == null)
{
this._emptyCustomTypeDescriptor = new TypeDescriptionProvider.EmptyCustomTypeDescriptor();
}
return this._emptyCustomTypeDescriptor;
}
// Token: 0x040001F3 RID: 499
private TypeDescriptionProvider.EmptyCustomTypeDescriptor _emptyCustomTypeDescriptor;
// Token: 0x040001F4 RID: 500
private TypeDescriptionProvider _parent;
// Token: 0x020000CC RID: 204
private sealed class EmptyCustomTypeDescriptor : CustomTypeDescriptor
{
}
}
}