Output: Fix access modifiers on properties, add to getters and setters

This commit is contained in:
Katy Coe
2019-11-06 00:33:38 +01:00
parent fa6e1683e5
commit 4800575f08
2 changed files with 25 additions and 15 deletions

View File

@@ -115,6 +115,18 @@ namespace Il2CppInspector.Reflection
DeclaredParameters.Add(new ParameterInfo(pkg, p, this));
}
public string GetAccessModifierString() {
return this switch {
{ IsPrivate: true } => "private ",
{ IsPublic: true } => "public ",
{ IsFamily: true } => "protected ",
{ IsAssembly: true } => "internal ",
{ IsFamilyOrAssembly: true } => "protected internal ",
{ IsFamilyAndAssembly: true } => "private protected ",
_ => ""
};
}
public string GetModifierString() {
// Interface methods and properties have no visible modifiers (they are always declared 'public abstract')
if (DeclaringType.IsInterface)
@@ -122,18 +134,7 @@ namespace Il2CppInspector.Reflection
StringBuilder modifiers = new StringBuilder();
if (IsPrivate)
modifiers.Append("private ");
if (IsPublic)
modifiers.Append("public ");
if (IsFamily)
modifiers.Append("protected ");
if (IsAssembly)
modifiers.Append("internal ");
if (IsFamilyOrAssembly)
modifiers.Append("protected internal ");
if (IsFamilyAndAssembly)
modifiers.Append("private protected ");
modifiers.Append(GetAccessModifierString());
if (IsAbstract)
modifiers.Append("abstract ");