172 lines
4.8 KiB
C#
172 lines
4.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel.Design;
|
|
|
|
namespace System.ComponentModel
|
|
{
|
|
// Token: 0x020000D3 RID: 211
|
|
internal abstract class Info
|
|
{
|
|
// Token: 0x0600072F RID: 1839 RVA: 0x00013460 File Offset: 0x00011660
|
|
public Info(Type infoType)
|
|
{
|
|
this._infoType = infoType;
|
|
}
|
|
|
|
// Token: 0x06000730 RID: 1840
|
|
public abstract AttributeCollection GetAttributes();
|
|
|
|
// Token: 0x06000731 RID: 1841
|
|
public abstract EventDescriptorCollection GetEvents();
|
|
|
|
// Token: 0x06000732 RID: 1842
|
|
public abstract PropertyDescriptorCollection GetProperties();
|
|
|
|
// Token: 0x170001BC RID: 444
|
|
// (get) Token: 0x06000733 RID: 1843 RVA: 0x00013470 File Offset: 0x00011670
|
|
public Type InfoType
|
|
{
|
|
get
|
|
{
|
|
return this._infoType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000734 RID: 1844 RVA: 0x00013478 File Offset: 0x00011678
|
|
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
|
{
|
|
EventDescriptorCollection events = this.GetEvents();
|
|
if (attributes == null)
|
|
{
|
|
return events;
|
|
}
|
|
return events.Filter(attributes);
|
|
}
|
|
|
|
// Token: 0x06000735 RID: 1845 RVA: 0x0001349C File Offset: 0x0001169C
|
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
|
{
|
|
PropertyDescriptorCollection properties = this.GetProperties();
|
|
if (attributes == null)
|
|
{
|
|
return properties;
|
|
}
|
|
return properties.Filter(attributes);
|
|
}
|
|
|
|
// Token: 0x06000736 RID: 1846 RVA: 0x000134C0 File Offset: 0x000116C0
|
|
public EventDescriptor GetDefaultEvent()
|
|
{
|
|
if (this._gotDefaultEvent)
|
|
{
|
|
return this._defaultEvent;
|
|
}
|
|
DefaultEventAttribute defaultEventAttribute = (DefaultEventAttribute)this.GetAttributes()[typeof(DefaultEventAttribute)];
|
|
if (defaultEventAttribute == null || defaultEventAttribute.Name == null)
|
|
{
|
|
this._defaultEvent = null;
|
|
}
|
|
else
|
|
{
|
|
EventDescriptorCollection events = this.GetEvents();
|
|
this._defaultEvent = events[defaultEventAttribute.Name];
|
|
}
|
|
this._gotDefaultEvent = true;
|
|
return this._defaultEvent;
|
|
}
|
|
|
|
// Token: 0x06000737 RID: 1847 RVA: 0x00013540 File Offset: 0x00011740
|
|
public PropertyDescriptor GetDefaultProperty()
|
|
{
|
|
if (this._gotDefaultProperty)
|
|
{
|
|
return this._defaultProperty;
|
|
}
|
|
DefaultPropertyAttribute defaultPropertyAttribute = (DefaultPropertyAttribute)this.GetAttributes()[typeof(DefaultPropertyAttribute)];
|
|
if (defaultPropertyAttribute == null || defaultPropertyAttribute.Name == null)
|
|
{
|
|
this._defaultProperty = null;
|
|
}
|
|
else
|
|
{
|
|
PropertyDescriptorCollection properties = this.GetProperties();
|
|
this._defaultProperty = properties[defaultPropertyAttribute.Name];
|
|
}
|
|
this._gotDefaultProperty = true;
|
|
return this._defaultProperty;
|
|
}
|
|
|
|
// Token: 0x06000738 RID: 1848 RVA: 0x000135C0 File Offset: 0x000117C0
|
|
protected AttributeCollection GetAttributes(IComponent comp)
|
|
{
|
|
if (this._attributes != null)
|
|
{
|
|
return this._attributes;
|
|
}
|
|
bool flag = true;
|
|
ArrayList arrayList = new ArrayList();
|
|
foreach (Attribute attribute in this._infoType.GetCustomAttributes(false))
|
|
{
|
|
arrayList.Add(attribute);
|
|
}
|
|
Type type = this._infoType.BaseType;
|
|
while (type != null && type != typeof(object))
|
|
{
|
|
foreach (Attribute attribute2 in type.GetCustomAttributes(false))
|
|
{
|
|
arrayList.Add(attribute2);
|
|
}
|
|
type = type.BaseType;
|
|
}
|
|
foreach (Type type2 in this._infoType.GetInterfaces())
|
|
{
|
|
foreach (object obj in TypeDescriptor.GetAttributes(type2))
|
|
{
|
|
Attribute attribute3 = (Attribute)obj;
|
|
arrayList.Add(attribute3);
|
|
}
|
|
}
|
|
Hashtable hashtable = new Hashtable();
|
|
for (int l = arrayList.Count - 1; l >= 0; l--)
|
|
{
|
|
Attribute attribute4 = (Attribute)arrayList[l];
|
|
hashtable[attribute4.TypeId] = attribute4;
|
|
}
|
|
if (comp != null && comp.Site != null)
|
|
{
|
|
global::System.ComponentModel.Design.ITypeDescriptorFilterService typeDescriptorFilterService = (global::System.ComponentModel.Design.ITypeDescriptorFilterService)comp.Site.GetService(typeof(global::System.ComponentModel.Design.ITypeDescriptorFilterService));
|
|
if (typeDescriptorFilterService != null)
|
|
{
|
|
flag = typeDescriptorFilterService.FilterAttributes(comp, hashtable);
|
|
}
|
|
}
|
|
Attribute[] array = new Attribute[hashtable.Values.Count];
|
|
hashtable.Values.CopyTo(array, 0);
|
|
AttributeCollection attributeCollection = new AttributeCollection(array);
|
|
if (flag)
|
|
{
|
|
this._attributes = attributeCollection;
|
|
}
|
|
return attributeCollection;
|
|
}
|
|
|
|
// Token: 0x04000207 RID: 519
|
|
private Type _infoType;
|
|
|
|
// Token: 0x04000208 RID: 520
|
|
private EventDescriptor _defaultEvent;
|
|
|
|
// Token: 0x04000209 RID: 521
|
|
private bool _gotDefaultEvent;
|
|
|
|
// Token: 0x0400020A RID: 522
|
|
private PropertyDescriptor _defaultProperty;
|
|
|
|
// Token: 0x0400020B RID: 523
|
|
private bool _gotDefaultProperty;
|
|
|
|
// Token: 0x0400020C RID: 524
|
|
private AttributeCollection _attributes;
|
|
}
|
|
}
|