/** get the class from metadata info. */ public CorClass GetClassFromToken(int classToken) { ICorDebugClass c = null; m_module.GetClassFromToken((uint)classToken, out c); return(new CorClass(c)); }
/** get the class from metadata info. */ public DebuggedClass GetClassFromToken(int typeDef) { ICorDebugClass c = null; m_mod.GetClassFromToken((uint)typeDef, out c); return(new DebuggedClass(c)); }
// TypeDef are Types that are 'Defined' in the current Module public IEnumerable <Tuple <uint, string> > TypeDefs() { IMetadataImport importer = GetMetadataInterface <IMetadataImport>(); IntPtr enumPtr = IntPtr.Zero; var typeDefs = new List <Tuple <uint, string> >(); try { while (true) { // TODO fix this so that we fetch more than one at a time importer.EnumTypeDefs(ref enumPtr, out uint typeDef, 1, out uint fetched); if (fetched == 0) { break; } comodule.GetClassFromToken(typeDef, out ICorDebugClass _); var nameBuilder = new StringBuilder(capacity: 256); GetMetaDataTypeDefName(importer, (int)typeDef, nameBuilder); typeDefs.Add(Tuple.Create(typeDef, nameBuilder.ToString())); } } catch (Exception e) { Console.WriteLine(e); } finally { if (enumPtr != IntPtr.Zero) { importer.CloseEnum(enumPtr); } } return(typeDefs); }