Esempio n. 1
0
 NestedType CreateModuleNestedType(
   uint typeDefRowId,
   TypeDefRow typeDefRow,
   TypeBase parentModuleType
 ) {
   IName typeName = this.GetNameFromOffset(typeDefRow.Name);
   if (typeDefRow.Namespace != 0) {
     IName namespaceName = this.GetNameFromOffset(typeDefRow.Namespace);
     typeName = this.NameTable.GetNameFor(namespaceName.Value+"."+typeName.Value);
   }
   uint genericParamRowIdStart;
   uint genericParamRowIdEnd;
   this.GetGenericParamInfoForType(typeDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
   NestedType type;
   if (genericParamRowIdStart == 0) {
     type = new NonGenericNestedType(this, typeName, typeDefRowId, typeDefRow.Flags, parentModuleType);
   } else {
     IName unmangledTypeName = this.GetUnmangledNameFromOffset(typeDefRow.Name);
     if (typeDefRow.Namespace != 0) {
       IName namespaceName = this.GetNameFromOffset(typeDefRow.Namespace);
       unmangledTypeName = this.NameTable.GetNameFor(namespaceName.Value+"."+unmangledTypeName.Value);
     }
     type = new GenericNestedType(this, unmangledTypeName, typeDefRowId, typeDefRow.Flags, parentModuleType, typeName, genericParamRowIdStart, genericParamRowIdEnd);
   }
   return type;
 }
 internal TypeDefRow this[uint rowId] //  This is 1 based...
 {
   get
     //^ requires rowId <= this.NumberOfRows;
   {
     int rowOffset = (int)(rowId - 1) * this.RowSize;
     TypeDefFlags flags = (TypeDefFlags)this.TypeDefTableMemoryReader.PeekUInt32(rowOffset + this.FlagsOffset);
     uint name = this.TypeDefTableMemoryReader.PeekReference(rowOffset + this.NameOffset, this.IsStringHeapRefSizeSmall);
     uint @namespace = this.TypeDefTableMemoryReader.PeekReference(rowOffset + this.NamespaceOffset, this.IsStringHeapRefSizeSmall);
     uint extends = this.TypeDefTableMemoryReader.PeekReference(rowOffset + this.ExtendsOffset, this.IsTypeDefOrRefRefSizeSmall);
     extends = TypeDefOrRefTag.ConvertToToken(extends);
     uint fieldList = this.TypeDefTableMemoryReader.PeekReference(rowOffset + this.FieldListOffset, this.IsFieldRefSizeSmall);
     uint methodList = this.TypeDefTableMemoryReader.PeekReference(rowOffset + this.MethodListOffset, this.IsMethodRefSizeSmall);
     TypeDefRow typeDefRow = new TypeDefRow(flags, name, @namespace, extends, fieldList, methodList);
     return typeDefRow;
   }
 }
Esempio n. 3
0
 NamespaceType CreateModuleNamespaceType(
   uint typeDefRowId,
   TypeDefRow typeDefRow,
   Namespace moduleNamespace,
   MetadataReaderSignatureTypeCode signatureTypeCode
 ) {
   IName typeName = this.GetNameFromOffset(typeDefRow.Name);
   uint genericParamRowIdStart;
   uint genericParamRowIdEnd;
   this.GetGenericParamInfoForType(typeDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
   NamespaceType type;
   if (genericParamRowIdStart == 0) {
     if (signatureTypeCode == MetadataReaderSignatureTypeCode.NotModulePrimitive)
       type = new NonGenericNamespaceTypeWithoutPrimitiveType(this, typeName, typeDefRowId, typeDefRow.Flags, moduleNamespace);
     else
       type = new NonGenericNamespaceTypeWithPrimitiveType(this, typeName, typeDefRowId, typeDefRow.Flags, moduleNamespace, signatureTypeCode);
   } else {
     IName unmangledTypeName = this.GetUnmangledNameFromOffset(typeDefRow.Name);
     type = new GenericNamespaceType(this, unmangledTypeName, typeDefRowId, typeDefRow.Flags, moduleNamespace, typeName, genericParamRowIdStart, genericParamRowIdEnd);
   }
   return type;
 }