Beispiel #1
0
 private void PopulateTypeDef()
 {
     if (typeDefs == null)
     {
         typeDefs = new TypeDefImpl[TypeDef.records.Length];
         for (int i = 0; i < typeDefs.Length; i++)
         {
             TypeDefImpl type = new TypeDefImpl(this, i);
             typeDefs[i] = type;
             if (type.IsModulePseudoType)
             {
                 moduleType = type;
             }
             else if (!type.IsNestedByFlags)
             {
                 types.Add(new TypeName(type.__Namespace, type.__Name), type);
             }
         }
         // add forwarded types to forwardedTypes dictionary (because Module.GetType(string) should return them)
         for (int i = 0; i < ExportedType.records.Length; i++)
         {
             int implementation = ExportedType.records[i].Implementation;
             if (implementation >> 24 == AssemblyRefTable.Index)
             {
                 TypeName typeName = GetTypeName(ExportedType.records[i].TypeNamespace, ExportedType.records[i].TypeName);
                 forwardedTypes.Add(typeName, new LazyForwardedType((implementation & 0xFFFFFF) - 1));
             }
         }
     }
 }
Beispiel #2
0
 internal FieldInfo GetFieldAt(TypeDefImpl owner, int index)
 {
     if (fields == null)
     {
         fields = new FieldInfo[Field.records.Length];
     }
     if (fields[index] == null)
     {
         fields[index] = new FieldDefImpl(this, owner ?? FindFieldOwner(index), index);
     }
     return(fields[index]);
 }
Beispiel #3
0
 internal MethodBase GetMethodAt(TypeDefImpl owner, int index)
 {
     if (methods == null)
     {
         methods = new MethodBase[MethodDef.records.Length];
     }
     if (methods[index] == null)
     {
         MethodDefImpl method = new MethodDefImpl(this, owner ?? FindMethodOwner(index), index);
         methods[index] = method.IsConstructor ? new ConstructorInfoImpl(method) : (MethodBase)method;
     }
     return(methods[index]);
 }
Beispiel #4
0
 internal FieldDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
 {
     this.module        = module;
     this.declaringType = declaringType;
     this.index         = index;
 }
Beispiel #5
0
 internal MethodBase GetMethodAt(TypeDefImpl owner, int index)
 {
     if (methods == null)
     {
         methods = new MethodBase[MethodDef.records.Length];
     }
     if (methods[index] == null)
     {
         MethodDefImpl method = new MethodDefImpl(this, owner ?? FindMethodOwner(index), index);
         methods[index] = method.IsConstructor ? new ConstructorInfoImpl(method) : (MethodBase)method;
     }
     return methods[index];
 }
Beispiel #6
0
 internal FieldInfo GetFieldAt(TypeDefImpl owner, int index)
 {
     if (fields == null)
     {
         fields = new FieldInfo[Field.records.Length];
     }
     if (fields[index] == null)
     {
         fields[index] = new FieldDefImpl(this, owner ?? FindFieldOwner(index), index);
     }
     return fields[index];
 }
Beispiel #7
0
 private void PopulateTypeDef()
 {
     if (typeDefs == null)
     {
         typeDefs = new TypeDefImpl[TypeDef.records.Length];
         for (int i = 0; i < typeDefs.Length; i++)
         {
             TypeDefImpl type = new TypeDefImpl(this, i);
             typeDefs[i] = type;
             if (type.IsModulePseudoType)
             {
                 moduleType = type;
             }
             else if (!type.IsNestedByFlags)
             {
                 types.Add(new TypeName(type.__Namespace, type.__Name), type);
             }
         }
         // add forwarded types to forwardedTypes dictionary (because Module.GetType(string) should return them)
         for (int i = 0; i < ExportedType.records.Length; i++)
         {
             int implementation = ExportedType.records[i].Implementation;
             if (implementation >> 24 == AssemblyRefTable.Index)
             {
                 TypeName typeName = GetTypeName(ExportedType.records[i].TypeNamespace, ExportedType.records[i].TypeName);
                 forwardedTypes.Add(typeName, new LazyForwardedType(i));
             }
         }
     }
 }
Beispiel #8
0
		internal MethodDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
		{
			this.module = module;
			this.index = index;
			this.declaringType = declaringType;
		}