Model: Groundwork for custom attribute processisng

This commit is contained in:
Katy Coe
2019-11-03 06:44:50 +01:00
parent defd553e0e
commit 7f398f40cb
6 changed files with 116 additions and 4 deletions

View File

@@ -31,8 +31,6 @@ namespace Il2CppInspector.Reflection
// List of all methods ordered by their MethodDefinitionIndex
public MethodBase[] MethodsByDefinitionIndex { get; }
// List of all types
public Il2CppModel(Il2CppInspector package) {
Package = package;
TypesByDefinitionIndex = new TypeInfo[package.TypeDefinitions.Length];
@@ -108,5 +106,19 @@ namespace Il2CppInspector.Reflection
TypesByVirtualAddress.Add(ptr, newUsage);
return newUsage;
}
// Attribute management
private int getCustomAttributeIndex(Assembly asm, uint token, int customAttributeIndex) {
var image = asm.Definition;
throw new NotImplementedException();
}
public int GetCustomAttributeIndex(Assembly asm) => getCustomAttributeIndex(asm, asm.Definition.token, -1);
public int GetCustomAttributeIndex(EventInfo evt) => getCustomAttributeIndex(evt.Assembly, evt.Definition.token, evt.Definition.customAttributeIndex);
public int GetCustomAttributeIndex(FieldInfo field) => getCustomAttributeIndex(field.Assembly, field.Definition.token, field.Definition.customAttributeIndex);
public int GetCustomAttributeIndex(MethodBase method) => getCustomAttributeIndex(method.Assembly, method.Definition.token, method.Definition.customAttributeIndex);
public int GetCustomAttributeIndex(ParameterInfo param) => getCustomAttributeIndex(param.Member.Assembly, param.Definition.token, param.Definition.customAttributeIndex);
public int GetCustomAttributeIndex(PropertyInfo prop) => getCustomAttributeIndex(prop.Assembly, prop.Definition.token, prop.Definition.customAttributeIndex);
}
}