1000 lines
27 KiB
C#
1000 lines
27 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Globalization;
|
|
using System.Reflection.Emit;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
namespace System.Reflection
|
|
{
|
|
// Token: 0x02000256 RID: 598
|
|
internal class MonoGenericClass : MonoType
|
|
{
|
|
// Token: 0x06001EFA RID: 7930 RVA: 0x00071E6C File Offset: 0x0007006C
|
|
internal MonoGenericClass()
|
|
: base(null)
|
|
{
|
|
throw new InvalidOperationException();
|
|
}
|
|
|
|
// Token: 0x06001EFB RID: 7931 RVA: 0x00071E7C File Offset: 0x0007007C
|
|
internal MonoGenericClass(TypeBuilder tb, Type[] args)
|
|
: base(null)
|
|
{
|
|
this.generic_type = tb;
|
|
this.type_arguments = args;
|
|
}
|
|
|
|
// Token: 0x06001EFC RID: 7932
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void initialize(MethodInfo[] methods, ConstructorInfo[] ctors, FieldInfo[] fields, PropertyInfo[] properties, EventInfo[] events);
|
|
|
|
// Token: 0x06001EFD RID: 7933 RVA: 0x00071E94 File Offset: 0x00070094
|
|
private void initialize()
|
|
{
|
|
if (this.initialized)
|
|
{
|
|
return;
|
|
}
|
|
MonoGenericClass monoGenericClass = this.GetParentType() as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
monoGenericClass.initialize();
|
|
}
|
|
EventInfo[] events_internal = this.generic_type.GetEvents_internal(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
|
this.event_count = events_internal.Length;
|
|
this.initialize(this.generic_type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetConstructorsInternal(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), this.generic_type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), events_internal);
|
|
this.initialized = true;
|
|
}
|
|
|
|
// Token: 0x06001EFE RID: 7934 RVA: 0x00071F20 File Offset: 0x00070120
|
|
private Type GetParentType()
|
|
{
|
|
return this.InflateType(this.generic_type.BaseType);
|
|
}
|
|
|
|
// Token: 0x06001EFF RID: 7935 RVA: 0x00071F34 File Offset: 0x00070134
|
|
internal Type InflateType(Type type)
|
|
{
|
|
return this.InflateType(type, null);
|
|
}
|
|
|
|
// Token: 0x06001F00 RID: 7936 RVA: 0x00071F40 File Offset: 0x00070140
|
|
internal Type InflateType(Type type, Type[] method_args)
|
|
{
|
|
if (type == null)
|
|
{
|
|
return null;
|
|
}
|
|
if (!type.IsGenericParameter && !type.ContainsGenericParameters)
|
|
{
|
|
return type;
|
|
}
|
|
if (type.IsGenericParameter)
|
|
{
|
|
if (type.DeclaringMethod == null)
|
|
{
|
|
return this.type_arguments[type.GenericParameterPosition];
|
|
}
|
|
if (method_args != null)
|
|
{
|
|
return method_args[type.GenericParameterPosition];
|
|
}
|
|
return type;
|
|
}
|
|
else
|
|
{
|
|
if (type.IsPointer)
|
|
{
|
|
return this.InflateType(type.GetElementType(), method_args).MakePointerType();
|
|
}
|
|
if (type.IsByRef)
|
|
{
|
|
return this.InflateType(type.GetElementType(), method_args).MakeByRefType();
|
|
}
|
|
if (!type.IsArray)
|
|
{
|
|
Type[] genericArguments = type.GetGenericArguments();
|
|
for (int i = 0; i < genericArguments.Length; i++)
|
|
{
|
|
genericArguments[i] = this.InflateType(genericArguments[i], method_args);
|
|
}
|
|
Type type2 = ((!type.IsGenericTypeDefinition) ? type.GetGenericTypeDefinition() : type);
|
|
return type2.MakeGenericType(genericArguments);
|
|
}
|
|
if (type.GetArrayRank() > 1)
|
|
{
|
|
return this.InflateType(type.GetElementType(), method_args).MakeArrayType(type.GetArrayRank());
|
|
}
|
|
if (type.ToString().EndsWith("[*]", StringComparison.Ordinal))
|
|
{
|
|
return this.InflateType(type.GetElementType(), method_args).MakeArrayType(1);
|
|
}
|
|
return this.InflateType(type.GetElementType(), method_args).MakeArrayType();
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BA RID: 1466
|
|
// (get) Token: 0x06001F01 RID: 7937 RVA: 0x00072094 File Offset: 0x00070294
|
|
public override Type BaseType
|
|
{
|
|
get
|
|
{
|
|
Type parentType = this.GetParentType();
|
|
return (parentType == null) ? this.generic_type.BaseType : parentType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001F02 RID: 7938 RVA: 0x000720C0 File Offset: 0x000702C0
|
|
private Type[] GetInterfacesInternal()
|
|
{
|
|
if (this.generic_type.interfaces == null)
|
|
{
|
|
return new Type[0];
|
|
}
|
|
Type[] array = new Type[this.generic_type.interfaces.Length];
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i] = this.InflateType(this.generic_type.interfaces[i]);
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F03 RID: 7939 RVA: 0x00072124 File Offset: 0x00070324
|
|
public override Type[] GetInterfaces()
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
return this.GetInterfacesInternal();
|
|
}
|
|
|
|
// Token: 0x06001F04 RID: 7940 RVA: 0x00072144 File Offset: 0x00070344
|
|
protected override bool IsValueTypeImpl()
|
|
{
|
|
return this.generic_type.IsValueType;
|
|
}
|
|
|
|
// Token: 0x06001F05 RID: 7941 RVA: 0x00072154 File Offset: 0x00070354
|
|
internal override MethodInfo GetMethod(MethodInfo fromNoninstanciated)
|
|
{
|
|
this.initialize();
|
|
if (!(fromNoninstanciated is MethodBuilder))
|
|
{
|
|
throw new InvalidOperationException("Inflating non MethodBuilder objects is not supported: " + fromNoninstanciated.GetType());
|
|
}
|
|
MethodBuilder methodBuilder = (MethodBuilder)fromNoninstanciated;
|
|
if (this.methods == null)
|
|
{
|
|
this.methods = new Hashtable();
|
|
}
|
|
if (!this.methods.ContainsKey(methodBuilder))
|
|
{
|
|
this.methods[methodBuilder] = new MethodOnTypeBuilderInst(this, methodBuilder);
|
|
}
|
|
return (MethodInfo)this.methods[methodBuilder];
|
|
}
|
|
|
|
// Token: 0x06001F06 RID: 7942 RVA: 0x000721DC File Offset: 0x000703DC
|
|
internal override ConstructorInfo GetConstructor(ConstructorInfo fromNoninstanciated)
|
|
{
|
|
this.initialize();
|
|
if (!(fromNoninstanciated is ConstructorBuilder))
|
|
{
|
|
throw new InvalidOperationException("Inflating non ConstructorBuilder objects is not supported: " + fromNoninstanciated.GetType());
|
|
}
|
|
ConstructorBuilder constructorBuilder = (ConstructorBuilder)fromNoninstanciated;
|
|
if (this.ctors == null)
|
|
{
|
|
this.ctors = new Hashtable();
|
|
}
|
|
if (!this.ctors.ContainsKey(constructorBuilder))
|
|
{
|
|
this.ctors[constructorBuilder] = new ConstructorOnTypeBuilderInst(this, constructorBuilder);
|
|
}
|
|
return (ConstructorInfo)this.ctors[constructorBuilder];
|
|
}
|
|
|
|
// Token: 0x06001F07 RID: 7943 RVA: 0x00072264 File Offset: 0x00070464
|
|
internal override FieldInfo GetField(FieldInfo fromNoninstanciated)
|
|
{
|
|
this.initialize();
|
|
if (!(fromNoninstanciated is FieldBuilder))
|
|
{
|
|
throw new InvalidOperationException("Inflating non FieldBuilder objects is not supported: " + fromNoninstanciated.GetType());
|
|
}
|
|
FieldBuilder fieldBuilder = (FieldBuilder)fromNoninstanciated;
|
|
if (this.fields == null)
|
|
{
|
|
this.fields = new Hashtable();
|
|
}
|
|
if (!this.fields.ContainsKey(fieldBuilder))
|
|
{
|
|
this.fields[fieldBuilder] = new FieldOnTypeBuilderInst(this, fieldBuilder);
|
|
}
|
|
return (FieldInfo)this.fields[fieldBuilder];
|
|
}
|
|
|
|
// Token: 0x06001F08 RID: 7944 RVA: 0x000722EC File Offset: 0x000704EC
|
|
public override MethodInfo[] GetMethods(BindingFlags bf)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
Type type = this;
|
|
for (;;)
|
|
{
|
|
MonoGenericClass monoGenericClass = type as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
arrayList.AddRange(monoGenericClass.GetMethodsInternal(bf, this));
|
|
}
|
|
else
|
|
{
|
|
if (!(type is TypeBuilder))
|
|
{
|
|
break;
|
|
}
|
|
arrayList.AddRange(type.GetMethods(bf));
|
|
}
|
|
if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
|
|
{
|
|
goto Block_4;
|
|
}
|
|
type = type.BaseType;
|
|
if (type == null)
|
|
{
|
|
goto IL_91;
|
|
}
|
|
}
|
|
MonoType monoType = (MonoType)type;
|
|
arrayList.AddRange(monoType.GetMethodsByName(null, bf, false, this));
|
|
Block_4:
|
|
IL_91:
|
|
MethodInfo[] array = new MethodInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F09 RID: 7945 RVA: 0x000723A4 File Offset: 0x000705A4
|
|
private MethodInfo[] GetMethodsInternal(BindingFlags bf, MonoGenericClass reftype)
|
|
{
|
|
if (this.generic_type.num_methods == 0)
|
|
{
|
|
return new MethodInfo[0];
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
this.initialize();
|
|
for (int i = 0; i < this.generic_type.num_methods; i++)
|
|
{
|
|
MethodInfo methodInfo = this.generic_type.methods[i];
|
|
bool flag = false;
|
|
MethodAttributes attributes = methodInfo.Attributes;
|
|
if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public)
|
|
{
|
|
if ((bf & BindingFlags.Public) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
flag = false;
|
|
if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope)
|
|
{
|
|
if ((bf & BindingFlags.Static) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.Instance) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
methodInfo = TypeBuilder.GetMethod(this, methodInfo);
|
|
arrayList.Add(methodInfo);
|
|
}
|
|
}
|
|
}
|
|
MethodInfo[] array = new MethodInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0A RID: 7946 RVA: 0x00072498 File Offset: 0x00070698
|
|
public override ConstructorInfo[] GetConstructors(BindingFlags bf)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
Type type = this;
|
|
for (;;)
|
|
{
|
|
MonoGenericClass monoGenericClass = type as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
arrayList.AddRange(monoGenericClass.GetConstructorsInternal(bf, this));
|
|
}
|
|
else
|
|
{
|
|
if (!(type is TypeBuilder))
|
|
{
|
|
break;
|
|
}
|
|
arrayList.AddRange(type.GetConstructors(bf));
|
|
}
|
|
if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
|
|
{
|
|
goto Block_4;
|
|
}
|
|
type = type.BaseType;
|
|
if (type == null)
|
|
{
|
|
goto IL_8F;
|
|
}
|
|
}
|
|
MonoType monoType = (MonoType)type;
|
|
arrayList.AddRange(monoType.GetConstructors_internal(bf, this));
|
|
Block_4:
|
|
IL_8F:
|
|
ConstructorInfo[] array = new ConstructorInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0B RID: 7947 RVA: 0x0007254C File Offset: 0x0007074C
|
|
private ConstructorInfo[] GetConstructorsInternal(BindingFlags bf, MonoGenericClass reftype)
|
|
{
|
|
if (this.generic_type.ctors == null)
|
|
{
|
|
return new ConstructorInfo[0];
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
this.initialize();
|
|
for (int i = 0; i < this.generic_type.ctors.Length; i++)
|
|
{
|
|
ConstructorInfo constructorInfo = this.generic_type.ctors[i];
|
|
bool flag = false;
|
|
MethodAttributes attributes = constructorInfo.Attributes;
|
|
if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public)
|
|
{
|
|
if ((bf & BindingFlags.Public) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
flag = false;
|
|
if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope)
|
|
{
|
|
if ((bf & BindingFlags.Static) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.Instance) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
arrayList.Add(TypeBuilder.GetConstructor(this, constructorInfo));
|
|
}
|
|
}
|
|
}
|
|
ConstructorInfo[] array = new ConstructorInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0C RID: 7948 RVA: 0x00072638 File Offset: 0x00070838
|
|
public override FieldInfo[] GetFields(BindingFlags bf)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
Type type = this;
|
|
for (;;)
|
|
{
|
|
MonoGenericClass monoGenericClass = type as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
arrayList.AddRange(monoGenericClass.GetFieldsInternal(bf, this));
|
|
}
|
|
else
|
|
{
|
|
if (!(type is TypeBuilder))
|
|
{
|
|
break;
|
|
}
|
|
arrayList.AddRange(type.GetFields(bf));
|
|
}
|
|
if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
|
|
{
|
|
goto Block_4;
|
|
}
|
|
type = type.BaseType;
|
|
if (type == null)
|
|
{
|
|
goto IL_8F;
|
|
}
|
|
}
|
|
MonoType monoType = (MonoType)type;
|
|
arrayList.AddRange(monoType.GetFields_internal(bf, this));
|
|
Block_4:
|
|
IL_8F:
|
|
FieldInfo[] array = new FieldInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0D RID: 7949 RVA: 0x000726EC File Offset: 0x000708EC
|
|
private FieldInfo[] GetFieldsInternal(BindingFlags bf, MonoGenericClass reftype)
|
|
{
|
|
if (this.generic_type.num_fields == 0)
|
|
{
|
|
return new FieldInfo[0];
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
this.initialize();
|
|
for (int i = 0; i < this.generic_type.num_fields; i++)
|
|
{
|
|
FieldInfo fieldInfo = this.generic_type.fields[i];
|
|
bool flag = false;
|
|
FieldAttributes attributes = fieldInfo.Attributes;
|
|
if ((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public)
|
|
{
|
|
if ((bf & BindingFlags.Public) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
flag = false;
|
|
if ((attributes & FieldAttributes.Static) != FieldAttributes.PrivateScope)
|
|
{
|
|
if ((bf & BindingFlags.Static) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.Instance) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
arrayList.Add(TypeBuilder.GetField(this, fieldInfo));
|
|
}
|
|
}
|
|
}
|
|
FieldInfo[] array = new FieldInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0E RID: 7950 RVA: 0x000727D8 File Offset: 0x000709D8
|
|
public override PropertyInfo[] GetProperties(BindingFlags bf)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
Type type = this;
|
|
for (;;)
|
|
{
|
|
MonoGenericClass monoGenericClass = type as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
arrayList.AddRange(monoGenericClass.GetPropertiesInternal(bf, this));
|
|
}
|
|
else
|
|
{
|
|
if (!(type is TypeBuilder))
|
|
{
|
|
break;
|
|
}
|
|
arrayList.AddRange(type.GetProperties(bf));
|
|
}
|
|
if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
|
|
{
|
|
goto Block_4;
|
|
}
|
|
type = type.BaseType;
|
|
if (type == null)
|
|
{
|
|
goto IL_91;
|
|
}
|
|
}
|
|
MonoType monoType = (MonoType)type;
|
|
arrayList.AddRange(monoType.GetPropertiesByName(null, bf, false, this));
|
|
Block_4:
|
|
IL_91:
|
|
PropertyInfo[] array = new PropertyInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F0F RID: 7951 RVA: 0x00072890 File Offset: 0x00070A90
|
|
private PropertyInfo[] GetPropertiesInternal(BindingFlags bf, MonoGenericClass reftype)
|
|
{
|
|
if (this.generic_type.properties == null)
|
|
{
|
|
return new PropertyInfo[0];
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
this.initialize();
|
|
foreach (PropertyBuilder propertyInfo in this.generic_type.properties)
|
|
{
|
|
bool flag = false;
|
|
MethodInfo methodInfo = propertyInfo.GetGetMethod(true);
|
|
if (methodInfo == null)
|
|
{
|
|
methodInfo = propertyInfo.GetSetMethod(true);
|
|
}
|
|
if (methodInfo != null)
|
|
{
|
|
MethodAttributes attributes = methodInfo.Attributes;
|
|
if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public)
|
|
{
|
|
if ((bf & BindingFlags.Public) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
flag = false;
|
|
if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope)
|
|
{
|
|
if ((bf & BindingFlags.Static) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.Instance) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
arrayList.Add(new PropertyOnTypeBuilderInst(reftype, propertyInfo));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
PropertyInfo[] array = new PropertyInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F10 RID: 7952 RVA: 0x000729A0 File Offset: 0x00070BA0
|
|
public override EventInfo[] GetEvents(BindingFlags bf)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
Type type = this;
|
|
for (;;)
|
|
{
|
|
MonoGenericClass monoGenericClass = type as MonoGenericClass;
|
|
if (monoGenericClass != null)
|
|
{
|
|
arrayList.AddRange(monoGenericClass.GetEventsInternal(bf, this));
|
|
}
|
|
else
|
|
{
|
|
if (!(type is TypeBuilder))
|
|
{
|
|
break;
|
|
}
|
|
arrayList.AddRange(type.GetEvents(bf));
|
|
}
|
|
if ((bf & BindingFlags.DeclaredOnly) != BindingFlags.Default)
|
|
{
|
|
goto Block_4;
|
|
}
|
|
type = type.BaseType;
|
|
if (type == null)
|
|
{
|
|
goto IL_8E;
|
|
}
|
|
}
|
|
MonoType monoType = (MonoType)type;
|
|
arrayList.AddRange(monoType.GetEvents(bf));
|
|
Block_4:
|
|
IL_8E:
|
|
EventInfo[] array = new EventInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F11 RID: 7953 RVA: 0x00072A54 File Offset: 0x00070C54
|
|
private EventInfo[] GetEventsInternal(BindingFlags bf, MonoGenericClass reftype)
|
|
{
|
|
if (this.generic_type.events == null)
|
|
{
|
|
return new EventInfo[0];
|
|
}
|
|
this.initialize();
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i = 0; i < this.event_count; i++)
|
|
{
|
|
EventBuilder eventBuilder = this.generic_type.events[i];
|
|
bool flag = false;
|
|
MethodInfo methodInfo = eventBuilder.add_method;
|
|
if (methodInfo == null)
|
|
{
|
|
methodInfo = eventBuilder.remove_method;
|
|
}
|
|
if (methodInfo != null)
|
|
{
|
|
MethodAttributes attributes = methodInfo.Attributes;
|
|
if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public)
|
|
{
|
|
if ((bf & BindingFlags.Public) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.NonPublic) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
flag = false;
|
|
if ((attributes & MethodAttributes.Static) != MethodAttributes.PrivateScope)
|
|
{
|
|
if ((bf & BindingFlags.Static) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if ((bf & BindingFlags.Instance) != BindingFlags.Default)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
arrayList.Add(new EventOnTypeBuilderInst(this, eventBuilder));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
EventInfo[] array = new EventInfo[arrayList.Count];
|
|
arrayList.CopyTo(array);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06001F12 RID: 7954 RVA: 0x00072B60 File Offset: 0x00070D60
|
|
public override Type[] GetNestedTypes(BindingFlags bf)
|
|
{
|
|
return this.generic_type.GetNestedTypes(bf);
|
|
}
|
|
|
|
// Token: 0x06001F13 RID: 7955 RVA: 0x00072B70 File Offset: 0x00070D70
|
|
public override bool IsAssignableFrom(Type c)
|
|
{
|
|
if (c == this)
|
|
{
|
|
return true;
|
|
}
|
|
Type[] interfacesInternal = this.GetInterfacesInternal();
|
|
if (c.IsInterface)
|
|
{
|
|
if (interfacesInternal == null)
|
|
{
|
|
return false;
|
|
}
|
|
foreach (Type type in interfacesInternal)
|
|
{
|
|
if (c.IsAssignableFrom(type))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
Type parentType = this.GetParentType();
|
|
if (parentType == null)
|
|
{
|
|
return c == typeof(object);
|
|
}
|
|
return c.IsAssignableFrom(parentType);
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BB RID: 1467
|
|
// (get) Token: 0x06001F14 RID: 7956 RVA: 0x00072BF0 File Offset: 0x00070DF0
|
|
public override Type UnderlyingSystemType
|
|
{
|
|
get
|
|
{
|
|
return this;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BC RID: 1468
|
|
// (get) Token: 0x06001F15 RID: 7957 RVA: 0x00072BF4 File Offset: 0x00070DF4
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
return this.generic_type.Name;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BD RID: 1469
|
|
// (get) Token: 0x06001F16 RID: 7958 RVA: 0x00072C04 File Offset: 0x00070E04
|
|
public override string Namespace
|
|
{
|
|
get
|
|
{
|
|
return this.generic_type.Namespace;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BE RID: 1470
|
|
// (get) Token: 0x06001F17 RID: 7959 RVA: 0x00072C14 File Offset: 0x00070E14
|
|
public override string FullName
|
|
{
|
|
get
|
|
{
|
|
return this.format_name(true, false);
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BF RID: 1471
|
|
// (get) Token: 0x06001F18 RID: 7960 RVA: 0x00072C20 File Offset: 0x00070E20
|
|
public override string AssemblyQualifiedName
|
|
{
|
|
get
|
|
{
|
|
return this.format_name(true, true);
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005C0 RID: 1472
|
|
// (get) Token: 0x06001F19 RID: 7961 RVA: 0x00072C2C File Offset: 0x00070E2C
|
|
public override Guid GUID
|
|
{
|
|
get
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001F1A RID: 7962 RVA: 0x00072C34 File Offset: 0x00070E34
|
|
private string format_name(bool full_name, bool assembly_qualified)
|
|
{
|
|
StringBuilder stringBuilder = new StringBuilder(this.generic_type.FullName);
|
|
bool isCompilerContext = this.generic_type.IsCompilerContext;
|
|
stringBuilder.Append("[");
|
|
for (int i = 0; i < this.type_arguments.Length; i++)
|
|
{
|
|
if (i > 0)
|
|
{
|
|
stringBuilder.Append(",");
|
|
}
|
|
string text = ((!full_name) ? this.type_arguments[i].ToString() : this.type_arguments[i].AssemblyQualifiedName);
|
|
if (text == null)
|
|
{
|
|
if (!isCompilerContext || !this.type_arguments[i].IsGenericParameter)
|
|
{
|
|
return null;
|
|
}
|
|
text = this.type_arguments[i].Name;
|
|
}
|
|
if (full_name)
|
|
{
|
|
stringBuilder.Append("[");
|
|
}
|
|
stringBuilder.Append(text);
|
|
if (full_name)
|
|
{
|
|
stringBuilder.Append("]");
|
|
}
|
|
}
|
|
stringBuilder.Append("]");
|
|
if (assembly_qualified)
|
|
{
|
|
stringBuilder.Append(", ");
|
|
stringBuilder.Append(this.generic_type.Assembly.FullName);
|
|
}
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
// Token: 0x06001F1B RID: 7963 RVA: 0x00072D58 File Offset: 0x00070F58
|
|
public override string ToString()
|
|
{
|
|
return this.format_name(false, false);
|
|
}
|
|
|
|
// Token: 0x06001F1C RID: 7964 RVA: 0x00072D64 File Offset: 0x00070F64
|
|
public override Type MakeArrayType()
|
|
{
|
|
return new ArrayType(this, 0);
|
|
}
|
|
|
|
// Token: 0x06001F1D RID: 7965 RVA: 0x00072D70 File Offset: 0x00070F70
|
|
public override Type MakeArrayType(int rank)
|
|
{
|
|
if (rank < 1)
|
|
{
|
|
throw new IndexOutOfRangeException();
|
|
}
|
|
return new ArrayType(this, rank);
|
|
}
|
|
|
|
// Token: 0x06001F1E RID: 7966 RVA: 0x00072D88 File Offset: 0x00070F88
|
|
public override Type MakeByRefType()
|
|
{
|
|
return new ByRefType(this);
|
|
}
|
|
|
|
// Token: 0x06001F1F RID: 7967 RVA: 0x00072D90 File Offset: 0x00070F90
|
|
public override Type MakePointerType()
|
|
{
|
|
return new PointerType(this);
|
|
}
|
|
|
|
// Token: 0x06001F20 RID: 7968 RVA: 0x00072D98 File Offset: 0x00070F98
|
|
protected override bool IsCOMObjectImpl()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06001F21 RID: 7969 RVA: 0x00072D9C File Offset: 0x00070F9C
|
|
protected override bool IsPrimitiveImpl()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06001F22 RID: 7970 RVA: 0x00072DA0 File Offset: 0x00070FA0
|
|
protected override TypeAttributes GetAttributeFlagsImpl()
|
|
{
|
|
return this.generic_type.Attributes;
|
|
}
|
|
|
|
// Token: 0x06001F23 RID: 7971 RVA: 0x00072DB0 File Offset: 0x00070FB0
|
|
public override Type GetInterface(string name, bool ignoreCase)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F24 RID: 7972 RVA: 0x00072DB8 File Offset: 0x00070FB8
|
|
public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
|
|
{
|
|
if (!this.generic_type.IsCompilerContext)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
foreach (EventInfo eventInfo in this.GetEvents(bindingAttr))
|
|
{
|
|
if (eventInfo.Name == name)
|
|
{
|
|
return eventInfo;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06001F25 RID: 7973 RVA: 0x00072E10 File Offset: 0x00071010
|
|
public override FieldInfo GetField(string name, BindingFlags bindingAttr)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F26 RID: 7974 RVA: 0x00072E18 File Offset: 0x00071018
|
|
public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F27 RID: 7975 RVA: 0x00072E20 File Offset: 0x00071020
|
|
public override Type GetNestedType(string name, BindingFlags bindingAttr)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F28 RID: 7976 RVA: 0x00072E28 File Offset: 0x00071028
|
|
public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F29 RID: 7977 RVA: 0x00072E30 File Offset: 0x00071030
|
|
protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F2A RID: 7978 RVA: 0x00072E38 File Offset: 0x00071038
|
|
protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F2B RID: 7979 RVA: 0x00072E40 File Offset: 0x00071040
|
|
protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F2C RID: 7980 RVA: 0x00072E48 File Offset: 0x00071048
|
|
public override bool IsDefined(Type attributeType, bool inherit)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F2D RID: 7981 RVA: 0x00072E50 File Offset: 0x00071050
|
|
public override object[] GetCustomAttributes(bool inherit)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x06001F2E RID: 7982 RVA: 0x00072E58 File Offset: 0x00071058
|
|
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x04000AC1 RID: 2753
|
|
private const BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
|
|
|
|
// Token: 0x04000AC2 RID: 2754
|
|
internal TypeBuilder generic_type;
|
|
|
|
// Token: 0x04000AC3 RID: 2755
|
|
private Type[] type_arguments;
|
|
|
|
// Token: 0x04000AC4 RID: 2756
|
|
private bool initialized;
|
|
|
|
// Token: 0x04000AC5 RID: 2757
|
|
private Hashtable fields;
|
|
|
|
// Token: 0x04000AC6 RID: 2758
|
|
private Hashtable ctors;
|
|
|
|
// Token: 0x04000AC7 RID: 2759
|
|
private Hashtable methods;
|
|
|
|
// Token: 0x04000AC8 RID: 2760
|
|
private int event_count;
|
|
}
|
|
}
|