Output: FieldAttributes.FamANDAssem is "private protected" from C# 7.2 onwards

This commit is contained in:
Katy Coe
2019-11-05 21:04:06 +01:00
parent 8528c4db9a
commit fa6e1683e5
2 changed files with 8 additions and 8 deletions

View File

@@ -84,7 +84,7 @@ namespace Il2CppInspector
if (type.IsNestedFamORAssem) if (type.IsNestedFamORAssem)
writer.Write("protected internal "); writer.Write("protected internal ");
if (type.IsNestedFamANDAssem) if (type.IsNestedFamANDAssem)
writer.Write("[family and assembly] "); writer.Write("private protected ");
// Roll-up multicast delegates to use the 'delegate' syntactic sugar // Roll-up multicast delegates to use the 'delegate' syntactic sugar
if (type.IsClass && type.IsSealed && type.BaseType?.FullName == "System.MulticastDelegate") { if (type.IsClass && type.IsSealed && type.BaseType?.FullName == "System.MulticastDelegate") {
@@ -162,7 +162,7 @@ namespace Il2CppInspector
if (field.IsFamilyOrAssembly) if (field.IsFamilyOrAssembly)
writer.Write("protected internal "); writer.Write("protected internal ");
if (field.IsFamilyAndAssembly) if (field.IsFamilyAndAssembly)
writer.Write("[family and assembly] "); writer.Write("private protected ");
if (field.IsLiteral) if (field.IsLiteral)
writer.Write("const "); writer.Write("const ");
// All const fields are also static by implication // All const fields are also static by implication
@@ -207,12 +207,12 @@ namespace Il2CppInspector
string modifiers = prop.GetMethod?.GetModifierString() ?? prop.SetMethod.GetModifierString(); string modifiers = prop.GetMethod?.GetModifierString() ?? prop.SetMethod.GetModifierString();
writer.Write($"{prefix}\t{modifiers}{prop.PropertyType.CSharpName} {prop.Name} {{ "); writer.Write($"{prefix}\t{modifiers}{prop.PropertyType.CSharpName} {prop.Name} {{ ");
writer.Write((prop.GetMethod != null ? prop.GetMethod.CustomAttributes.Where(a => !SuppressGenerated || a.AttributeType.FullName != CGAttribute).ToString(inline: true) + "get; " : "") writer.Write((prop.CanRead? prop.GetMethod.CustomAttributes.Where(a => !SuppressGenerated || a.AttributeType.FullName != CGAttribute).ToString(inline: true) + "get; " : "")
+ (prop.SetMethod != null ? prop.SetMethod.CustomAttributes.Where(a => !SuppressGenerated || a.AttributeType.FullName != CGAttribute).ToString(inline: true) + "set; " : "") + "}"); + (prop.CanWrite? prop.SetMethod.CustomAttributes.Where(a => !SuppressGenerated || a.AttributeType.FullName != CGAttribute).ToString(inline: true) + "set; " : "") + "}");
if ((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0) || (prop.SetMethod != null && prop.SetMethod.VirtualAddress != 0)) if ((prop.CanRead && prop.GetMethod.VirtualAddress != 0) || (prop.CanWrite && prop.SetMethod.VirtualAddress != 0))
writer.Write(" // "); writer.Write(" // ");
writer.Write((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0 ? prop.GetMethod.VirtualAddress.ToAddressString() + " " : "") writer.Write((prop.CanRead && prop.GetMethod.VirtualAddress != 0 ? prop.GetMethod.VirtualAddress.ToAddressString() + " " : "")
+ (prop.SetMethod != null && prop.SetMethod.VirtualAddress != 0 ? prop.SetMethod.VirtualAddress.ToAddressString() : "") + "\n"); + (prop.CanWrite && prop.SetMethod.VirtualAddress != 0 ? prop.SetMethod.VirtualAddress.ToAddressString() : "") + "\n");
usedMethods.Add(prop.GetMethod); usedMethods.Add(prop.GetMethod);
usedMethods.Add(prop.SetMethod); usedMethods.Add(prop.SetMethod);
} }

View File

@@ -133,7 +133,7 @@ namespace Il2CppInspector.Reflection
if (IsFamilyOrAssembly) if (IsFamilyOrAssembly)
modifiers.Append("protected internal "); modifiers.Append("protected internal ");
if (IsFamilyAndAssembly) if (IsFamilyAndAssembly)
modifiers.Append("[family and assembly] "); modifiers.Append("private protected ");
if (IsAbstract) if (IsAbstract)
modifiers.Append("abstract "); modifiers.Append("abstract ");