Model: Add PropertyInfo.Definition and Index
This commit is contained in:
@@ -10,6 +10,10 @@ using System.Reflection;
|
|||||||
namespace Il2CppInspector.Reflection {
|
namespace Il2CppInspector.Reflection {
|
||||||
public class PropertyInfo : MemberInfo
|
public class PropertyInfo : MemberInfo
|
||||||
{
|
{
|
||||||
|
// IL2CPP-specific data
|
||||||
|
public Il2CppPropertyDefinition Definition { get; }
|
||||||
|
public int Index { get; }
|
||||||
|
|
||||||
public bool CanRead => GetMethod != null;
|
public bool CanRead => GetMethod != null;
|
||||||
public bool CanWrite => SetMethod != null;
|
public bool CanWrite => SetMethod != null;
|
||||||
|
|
||||||
@@ -26,15 +30,15 @@ namespace Il2CppInspector.Reflection {
|
|||||||
|
|
||||||
public PropertyInfo(Il2CppInspector pkg, int propIndex, TypeInfo declaringType) :
|
public PropertyInfo(Il2CppInspector pkg, int propIndex, TypeInfo declaringType) :
|
||||||
base(declaringType) {
|
base(declaringType) {
|
||||||
var prop = pkg.Properties[propIndex];
|
Index = propIndex;
|
||||||
|
Definition = pkg.Properties[propIndex];
|
||||||
Name = pkg.Strings[prop.nameIndex];
|
Name = pkg.Strings[Definition.nameIndex];
|
||||||
|
|
||||||
// prop.get and prop.set are method indices from the first method of the declaring type
|
// prop.get and prop.set are method indices from the first method of the declaring type
|
||||||
if (prop.get >= 0)
|
if (Definition.get >= 0)
|
||||||
GetMethod = declaringType.DeclaredMethods.First(x => x.Index == declaringType.Definition.methodStart + prop.get);
|
GetMethod = declaringType.DeclaredMethods.First(x => x.Index == declaringType.Definition.methodStart + Definition.get);
|
||||||
if (prop.set >= 0)
|
if (Definition.set >= 0)
|
||||||
SetMethod = declaringType.DeclaredMethods.First(x => x.Index == declaringType.Definition.methodStart + prop.set);
|
SetMethod = declaringType.DeclaredMethods.First(x => x.Index == declaringType.Definition.methodStart + Definition.set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user