internal static TypeReference LoadExportedType(Module module, int rid) { var image = module.Image; var typeRef = image.ExportedTypeSignatures[rid - 1]; if (typeRef != null) { return(typeRef); } ExportedTypeRow row; image.GetExportedType(rid, out row); typeRef = new TypeReference(); typeRef._name = image.GetString(row.TypeName); typeRef._namespace = image.GetString(row.TypeNamespace); typeRef._owner = LoadExportedTypeImplementation(module, MetadataToken.DecompressImplementation(row.Implementation)); typeRef._isValueType = false; module.AddSignature(ref typeRef); image.ExportedTypeSignatures[rid - 1] = typeRef; return(typeRef); }
protected void Load() { var image = _module.Image; ManifestResourceRow row; image.GetManifestResource(_rid, out row); _name = image.GetString(row.Name); _visibility = (ResourceVisibilityFlags)row.Flags; _offset = row.Offset; int implementationToken = MetadataToken.DecompressImplementation(row.Implementation); switch (MetadataToken.GetType(implementationToken)) { case MetadataTokenType.AssemblyRef: { int rid = MetadataToken.GetRID(implementationToken); _owner = AssemblyReference.LoadRef(_module, rid); } break; case MetadataTokenType.File: { int rid = MetadataToken.GetRID(implementationToken); _owner = FileReference.Load(_module, rid); } break; default: { _opFlags = _opFlags.SetBitAtIndex(LoadDataFromImageFlag, true); } break; } }