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

98 lines
3.3 KiB
C#

using System;
using System.Collections;
using System.ComponentModel.Design;
using System.Reflection;
namespace System.ComponentModel
{
// Token: 0x020000D4 RID: 212
internal class ComponentInfo : Info
{
// Token: 0x06000739 RID: 1849 RVA: 0x000137E0 File Offset: 0x000119E0
public ComponentInfo(IComponent component)
: base(component.GetType())
{
this._component = component;
}
// Token: 0x0600073A RID: 1850 RVA: 0x000137F8 File Offset: 0x000119F8
public override AttributeCollection GetAttributes()
{
return base.GetAttributes(this._component);
}
// Token: 0x0600073B RID: 1851 RVA: 0x00013808 File Offset: 0x00011A08
public override EventDescriptorCollection GetEvents()
{
if (this._events != null)
{
return this._events;
}
bool flag = true;
EventInfo[] events = this._component.GetType().GetEvents();
Hashtable hashtable = new Hashtable();
foreach (EventInfo eventInfo in events)
{
hashtable[eventInfo.Name] = new ReflectionEventDescriptor(eventInfo);
}
if (this._component.Site != null)
{
global::System.ComponentModel.Design.ITypeDescriptorFilterService typeDescriptorFilterService = (global::System.ComponentModel.Design.ITypeDescriptorFilterService)this._component.Site.GetService(typeof(global::System.ComponentModel.Design.ITypeDescriptorFilterService));
if (typeDescriptorFilterService != null)
{
flag = typeDescriptorFilterService.FilterEvents(this._component, hashtable);
}
}
ArrayList arrayList = new ArrayList();
arrayList.AddRange(hashtable.Values);
EventDescriptorCollection eventDescriptorCollection = new EventDescriptorCollection(arrayList);
if (flag)
{
this._events = eventDescriptorCollection;
}
return eventDescriptorCollection;
}
// Token: 0x0600073C RID: 1852 RVA: 0x000138E8 File Offset: 0x00011AE8
public override PropertyDescriptorCollection GetProperties()
{
if (this._properties != null)
{
return this._properties;
}
bool flag = true;
PropertyInfo[] properties = this._component.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
Hashtable hashtable = new Hashtable();
for (int i = properties.Length - 1; i >= 0; i--)
{
hashtable[properties[i].Name] = new ReflectionPropertyDescriptor(properties[i]);
}
if (this._component.Site != null)
{
global::System.ComponentModel.Design.ITypeDescriptorFilterService typeDescriptorFilterService = (global::System.ComponentModel.Design.ITypeDescriptorFilterService)this._component.Site.GetService(typeof(global::System.ComponentModel.Design.ITypeDescriptorFilterService));
if (typeDescriptorFilterService != null)
{
flag = typeDescriptorFilterService.FilterProperties(this._component, hashtable);
}
}
PropertyDescriptor[] array = new PropertyDescriptor[hashtable.Values.Count];
hashtable.Values.CopyTo(array, 0);
PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(array, true);
if (flag)
{
this._properties = propertyDescriptorCollection;
}
return propertyDescriptorCollection;
}
// Token: 0x0400020D RID: 525
private IComponent _component;
// Token: 0x0400020E RID: 526
private EventDescriptorCollection _events;
// Token: 0x0400020F RID: 527
private PropertyDescriptorCollection _properties;
}
}