@@ -94,8 +94,8 @@ public static bool IsInstance(uint aObjectType, uint aDesiredObjectType, bool aI
9494
9595 public static void SetTypeInfo ( int aType , uint aBaseType , uint aSize , uint aInterfaceCount , uint [ ] aInterfaceIndexes ,
9696 uint aMethodCount , uint [ ] aMethodIndexes , uint [ ] aMethodAddresses ,
97- uint aInterfaceMethodCount , uint [ ] aInterfaceMethodIndexes , uint [ ] aTargetMethodIndexes , uint aGCFieldCount , uint [ ] aGCFieldOffsets , uint [ ] aGCFieldTypes ,
98- bool aIsValueType , bool aIsStruct )
97+ uint aInterfaceMethodCount , uint [ ] aInterfaceMethodIndexes , uint [ ] aTargetMethodIndexes , uint aGCFieldCount ,
98+ uint [ ] aGCFieldOffsets , uint [ ] aGCFieldTypes , bool aIsValueType , bool aIsStruct , string aName , string aAssemblyQualifiedName )
9999 {
100100 var vTable = new VTable ( ) ;
101101 vTable . BaseTypeIdentifier = aBaseType ;
@@ -110,6 +110,8 @@ public static void SetTypeInfo(int aType, uint aBaseType, uint aSize, uint aInte
110110 vTable . TargetMethodIndexes = aTargetMethodIndexes ;
111111 vTable . IsValueType = aIsValueType ;
112112 vTable . IsStruct = aIsStruct ;
113+ vTable . Name = aName ;
114+ vTable . AssemblyQualifiedName = aAssemblyQualifiedName ;
113115 mTypes [ aType ] = vTable ;
114116 var gcTable = new GCTable ( ) ;
115117 gcTable . GCFieldCount = aGCFieldCount ;
@@ -341,10 +343,68 @@ public static bool IsStruct(uint aType)
341343 {
342344 return mTypes [ aType ] . IsStruct ;
343345 }
346+
347+ /// <summary>
348+ /// Gets the Name of the type
349+ /// </summary>
350+ /// <param name="aType"></param>
351+ /// <returns></returns>
352+ public static string GetName ( uint aType )
353+ {
354+ return mTypes [ aType ] . Name ;
355+ }
356+
357+ /// <summary>
358+ /// Gets the Assembly Qualified Name for the type
359+ /// </summary>
360+ /// <param name="aType"></param>
361+ /// <returns></returns>
362+ public static string GetAssemblyQualifiedName ( uint aType )
363+ {
364+ return mTypes [ aType ] . AssemblyQualifiedName ;
365+ }
366+
367+ /// <summary>
368+ /// Get type id of type matching the name
369+ /// The name can either be name of the class or the assembly qualified name
370+ /// Only inlcuding the first or first two parts of the assembly qualified name also works
371+ /// </summary>
372+ /// <param name="name"></param>
373+ /// <returns>Returns -1 if no type can be found</returns>
374+ public static int GetType ( string name )
375+ {
376+ for ( int i = 0 ; i < mTypes . Length ; i ++ )
377+ {
378+ var currType = mTypes [ i ] ;
379+ if ( currType . Name == name || currType . AssemblyQualifiedName == name )
380+ {
381+ return i ;
382+ }
383+ else
384+ {
385+ bool difference = false ;
386+ for ( int k = 0 ; k < name . Length ; k ++ )
387+ {
388+ if ( name [ k ] != currType . AssemblyQualifiedName [ k ] )
389+ {
390+ difference = true ;
391+ break ;
392+ }
393+ }
394+ if ( ! difference )
395+ {
396+ return i ;
397+ }
398+ }
399+ }
400+ return - 1 ;
401+ }
344402 }
345403
346404 public struct VTable
347405 {
406+ public string Name ;
407+ public string AssemblyQualifiedName ;
348408 public uint BaseTypeIdentifier ;
349409 public uint Size ;
350410
0 commit comments