Implement and output TypeInfo.InterfaceUsageIndices

This commit is contained in:
Katy Coe
2017-11-09 14:24:37 +01:00
parent 3722705301
commit 35db6cabd6
3 changed files with 16 additions and 3 deletions

View File

@@ -67,6 +67,10 @@ namespace Il2CppInspector.Reflection {
public List<TypeInfo> GenericTypeParameters { get; }
public bool HasElementType => ElementType != null;
private Il2CppType[] implementedInterfaces;
public IEnumerable<TypeInfo> ImplementedInterfaces => implementedInterfaces.Select(x => Assembly.Model.GetType(x, MemberTypes.TypeInfo));
public bool IsAbstract => (Attributes & TypeAttributes.Abstract) == TypeAttributes.Abstract;
public bool IsArray { get; }
public bool IsByRef => throw new NotImplementedException();
@@ -140,6 +144,11 @@ namespace Il2CppInspector.Reflection {
if (!IsInterface)
Attributes |= TypeAttributes.Class;
// Add all implemented interfaces
implementedInterfaces = new Il2CppType[Definition.interfaces_count];
for (var i = 0; i < Definition.interfaces_count; i++)
implementedInterfaces[i] = pkg.TypeUsages[pkg.Metadata.InterfaceUsageIndices[Definition.interfacesStart + i]];
// Add all fields
for (var f = Definition.fieldStart; f < Definition.fieldStart + Definition.field_count; f++)
DeclaredFields.Add(new FieldInfo(pkg, f, this));