Model: Add GetAssembly, GetType, GetMethod, GetField, GetProperty helpers
This commit is contained in:
@@ -44,6 +44,12 @@ namespace Il2CppInspector.Reflection
|
||||
Assemblies.Add(new Assembly(this, image));
|
||||
}
|
||||
|
||||
// Get an assembly by its name
|
||||
public Assembly GetAssembly(string name) => Assemblies.First(a => a.FullName == name);
|
||||
|
||||
// Get a type by its full name
|
||||
public TypeInfo GetType(string name) => Types.First(t => t.FullName == name);
|
||||
|
||||
private TypeInfo getNewTypeUsage(Il2CppType usage, MemberTypes memberType) {
|
||||
switch (usage.type) {
|
||||
case Il2CppTypeEnum.IL2CPP_TYPE_CLASS:
|
||||
|
||||
@@ -70,6 +70,15 @@ namespace Il2CppInspector.Reflection {
|
||||
|
||||
public List<PropertyInfo> DeclaredProperties { get; } = new List<PropertyInfo>();
|
||||
|
||||
// Get a field by its name
|
||||
public FieldInfo GetField(string name) => DeclaredFields.First(f => f.Name == name);
|
||||
|
||||
// Get a method by its name
|
||||
public MethodInfo GetMethod(string name) => DeclaredMethods.First(m => m.Name == name);
|
||||
|
||||
// Get a property by its name
|
||||
public PropertyInfo GetProperty(string name) => DeclaredProperties.First(p => p.Name == name);
|
||||
|
||||
// Method that the type is declared in if this is a type parameter of a generic method
|
||||
public MethodBase DeclaringMethod;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user