public NuGenModuleScope(NuGenIMetaDataImport2 import, NuGenAssembly assembly) { Assembly = assembly; uint moduleNameLength; import.GetScopeProps(NuGenProject.DefaultCharArray, Convert.ToUInt32(NuGenProject.DefaultCharArray.Length), out moduleNameLength, ref mvid); if (moduleNameLength > NuGenProject.DefaultCharArray.Length) { NuGenProject.DefaultCharArray = new char[moduleNameLength]; import.GetScopeProps(NuGenProject.DefaultCharArray, Convert.ToUInt32(NuGenProject.DefaultCharArray.Length), out moduleNameLength, ref mvid); } Name = NuGenHelperFunctions.GetString(NuGenProject.DefaultCharArray, 0, moduleNameLength); uint token; import.GetModuleFromScope(out token); Token = token; Assembly.AllTokens[Token] = this; }
public void EnumerateTypeDefinitions(NuGenIMetaDataImport2 import, ModuleWrapper debuggedModule) { DebuggedModule = debuggedModule; IntPtr enumHandle = IntPtr.Zero; uint[] typeDefs = new uint[NuGenProject.DefaultArrayCount]; uint count = 0; import.EnumTypeDefs(ref enumHandle, typeDefs, Convert.ToUInt32(typeDefs.Length), out count); while (count > 0) { for (uint typeDefsIndex = 0; typeDefsIndex < count; typeDefsIndex++) { uint token = typeDefs[typeDefsIndex]; uint typeNameLength; uint typeDefFlags; uint baseTypeToken; import.GetTypeDefProps(token, NuGenProject.DefaultCharArray, Convert.ToUInt32(NuGenProject.DefaultCharArray.Length), out typeNameLength, out typeDefFlags, out baseTypeToken); if (typeNameLength > NuGenProject.DefaultCharArray.Length) { NuGenProject.DefaultCharArray = new char[typeNameLength]; import.GetTypeDefProps(token, NuGenProject.DefaultCharArray, Convert.ToUInt32(NuGenProject.DefaultCharArray.Length), out typeNameLength, out typeDefFlags, out baseTypeToken); } NuGenTypeDefinition typeDefinition = new NuGenTypeDefinition(import, this, NuGenHelperFunctions.GetString(NuGenProject.DefaultCharArray, 0, typeNameLength), token, (CorTypeAttr)typeDefFlags, baseTypeToken); TypeDefinitions[token] = typeDefinition; Assembly.AllTokens[token] = typeDefinition; } import.EnumTypeDefs(ref enumHandle, typeDefs, Convert.ToUInt32(typeDefs.Length), out count); } import.CloseEnum(enumHandle); foreach (NuGenTypeDefinition typeDefinition in TypeDefinitions.Values) { if (typeDefinition.IsNestedType) { typeDefinition.FindEnclosingType(import); } } DebuggedModule = null; }