Model: Add PropertyAttributes

This commit is contained in:
Katy Coe
2021-01-07 23:10:57 +01:00
parent bca8baceb9
commit e9a66b98d4

View File

@@ -18,6 +18,9 @@ namespace Il2CppInspector.Reflection {
// Root definition: the property with Definition != null
protected readonly PropertyInfo rootDefinition;
// Information/flags about the property
public PropertyAttributes Attributes { get; }
public bool CanRead => GetMethod != null;
public bool CanWrite => SetMethod != null;
@@ -52,6 +55,9 @@ namespace Il2CppInspector.Reflection {
Name = pkg.Strings[Definition.nameIndex];
rootDefinition = this;
// Copy attributes
Attributes = (PropertyAttributes) Definition.attrs;
// prop.get and prop.set are method indices from the first method of the declaring type
if (Definition.get >= 0)
GetMethod = declaringType.DeclaredMethods.First(x => x.Index == declaringType.Definition.methodStart + Definition.get);