Don't output property and event methods individually
This commit is contained in:
@@ -117,6 +117,8 @@ namespace Il2CppInspector
|
|||||||
(k, v) => new { k, v }).OrderBy(x => x.v).Select(x => $"\t{x.k} = {x.v}")) + "\n");
|
(k, v) => new { k, v }).OrderBy(x => x.v).Select(x => $"\t{x.k} = {x.v}")) + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var usedMethods = new List<Reflection.MethodInfo>();
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
if (type.DeclaredProperties.Count > 0)
|
if (type.DeclaredProperties.Count > 0)
|
||||||
writer.Write("\t// Properties\n");
|
writer.Write("\t// Properties\n");
|
||||||
@@ -126,6 +128,8 @@ namespace Il2CppInspector
|
|||||||
writer.Write($"\t{modifiers} {prop.PropertyType.CSharpName} {prop.Name} {{ ");
|
writer.Write($"\t{modifiers} {prop.PropertyType.CSharpName} {prop.Name} {{ ");
|
||||||
writer.Write((prop.GetMethod != null ? "get; " : "") + (prop.SetMethod != null ? "set; " : "") + "} // ");
|
writer.Write((prop.GetMethod != null ? "get; " : "") + (prop.SetMethod != null ? "set; " : "") + "} // ");
|
||||||
writer.Write((prop.GetMethod != null ? "0x{0:X8} " : "") + (prop.SetMethod != null? "0x{1:X8}" : "") + "\n", prop.GetMethod?.VirtualAddress, prop.SetMethod?.VirtualAddress);
|
writer.Write((prop.GetMethod != null ? "0x{0:X8} " : "") + (prop.SetMethod != null? "0x{1:X8}" : "") + "\n", prop.GetMethod?.VirtualAddress, prop.SetMethod?.VirtualAddress);
|
||||||
|
usedMethods.Add(prop.GetMethod);
|
||||||
|
usedMethods.Add(prop.SetMethod);
|
||||||
}
|
}
|
||||||
if (type.DeclaredProperties.Count > 0)
|
if (type.DeclaredProperties.Count > 0)
|
||||||
writer.Write("\n");
|
writer.Write("\n");
|
||||||
@@ -142,6 +146,9 @@ namespace Il2CppInspector
|
|||||||
if (evt.RemoveMethod != null) m.Add("remove", evt.RemoveMethod.VirtualAddress);
|
if (evt.RemoveMethod != null) m.Add("remove", evt.RemoveMethod.VirtualAddress);
|
||||||
if (evt.RaiseMethod != null) m.Add("raise", evt.RaiseMethod.VirtualAddress);
|
if (evt.RaiseMethod != null) m.Add("raise", evt.RaiseMethod.VirtualAddress);
|
||||||
writer.Write(string.Join("\n", m.Select(x => $"\t\t{x.Key}; // 0x{x.Value:X8}")) + "\n\t}\n");
|
writer.Write(string.Join("\n", m.Select(x => $"\t\t{x.Key}; // 0x{x.Value:X8}")) + "\n\t}\n");
|
||||||
|
usedMethods.Add(evt.AddMethod);
|
||||||
|
usedMethods.Add(evt.RemoveMethod);
|
||||||
|
usedMethods.Add(evt.RaiseMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.DeclaredEvents.Count > 0)
|
if (type.DeclaredEvents.Count > 0)
|
||||||
@@ -152,6 +159,10 @@ namespace Il2CppInspector
|
|||||||
writer.Write("\t// Methods\n");
|
writer.Write("\t// Methods\n");
|
||||||
|
|
||||||
foreach (var method in type.DeclaredMethods) {
|
foreach (var method in type.DeclaredMethods) {
|
||||||
|
// Don't re-output methods for constructors, properties, events etc.
|
||||||
|
if (usedMethods.Contains(method))
|
||||||
|
continue;
|
||||||
|
|
||||||
writer.Write($"\t{method.GetModifierString()} {method.ReturnType.CSharpName} {method.Name}(");
|
writer.Write($"\t{method.GetModifierString()} {method.ReturnType.CSharpName} {method.Name}(");
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user