Output: Attributes on property getters and setters
This commit is contained in:
@@ -80,7 +80,8 @@ namespace Il2CppInspector
|
|||||||
// 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") {
|
||||||
var del = type.DeclaredMethods.First(x => x.Name == "Invoke");
|
var del = type.DeclaredMethods.First(x => x.Name == "Invoke");
|
||||||
// TODO: ReturnType attributes
|
// IL2CPP doesn't seem to retain return type attributes
|
||||||
|
//writer.Write(del.ReturnType.CustomAttributes.ToString(prefix, "return: "));
|
||||||
writer.Write($"delegate {del.ReturnType.CSharpName} {type.CSharpTypeDeclarationName}(");
|
writer.Write($"delegate {del.ReturnType.CSharpName} {type.CSharpTypeDeclarationName}(");
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -190,8 +191,8 @@ 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} {{ ");
|
||||||
// TODO: Custom attributes on getter and setter
|
writer.Write((prop.GetMethod != null ? prop.GetMethod.CustomAttributes.ToString(inline: true) + "get; " : "")
|
||||||
writer.Write((prop.GetMethod != null ? "get; " : "") + (prop.SetMethod != null ? "set; " : "") + "}");
|
+ (prop.SetMethod != null ? prop.SetMethod.CustomAttributes.ToString(inline: true) + "set; " : "") + "}");
|
||||||
if ((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0) || (prop.SetMethod != null && prop.SetMethod.VirtualAddress != 0))
|
if ((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0) || (prop.SetMethod != null && prop.SetMethod.VirtualAddress != 0))
|
||||||
writer.Write(" // ");
|
writer.Write(" // ");
|
||||||
writer.Write((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0 ? Il2CppModel.FormatAddress(prop.GetMethod.VirtualAddress) + " " : "")
|
writer.Write((prop.GetMethod != null && prop.GetMethod.VirtualAddress != 0 ? Il2CppModel.FormatAddress(prop.GetMethod.VirtualAddress) + " " : "")
|
||||||
@@ -256,10 +257,10 @@ namespace Il2CppInspector
|
|||||||
foreach (var method in type.DeclaredMethods.Except(usedMethods)) {
|
foreach (var method in type.DeclaredMethods.Except(usedMethods)) {
|
||||||
// Attributes
|
// Attributes
|
||||||
writer.Write(method.CustomAttributes.ToString(prefix + "\t"));
|
writer.Write(method.CustomAttributes.ToString(prefix + "\t"));
|
||||||
|
// IL2CPP doesn't seem to retain return type attributes
|
||||||
|
//writer.Write(method.ReturnType.CustomAttributes.ToString(prefix + "\t", "return: "));
|
||||||
writer.Write($"{prefix}\t{method.GetModifierString()}");
|
writer.Write($"{prefix}\t{method.GetModifierString()}");
|
||||||
if (method.Name != "op_Implicit" && method.Name != "op_Explicit")
|
if (method.Name != "op_Implicit" && method.Name != "op_Explicit")
|
||||||
// TODO: ReturnType attributes
|
|
||||||
writer.Write($"{method.ReturnType.CSharpName} {method.CSharpName}{method.GetTypeParametersString()}");
|
writer.Write($"{method.ReturnType.CSharpName} {method.CSharpName}{method.GetTypeParametersString()}");
|
||||||
else
|
else
|
||||||
writer.Write($"{method.CSharpName}{method.ReturnType.CSharpName}");
|
writer.Write($"{method.CSharpName}{method.ReturnType.CSharpName}");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
private readonly int returnTypeUsage;
|
private readonly int returnTypeUsage;
|
||||||
public TypeInfo ReturnType => Assembly.Model.GetTypeFromUsage(returnTypeUsage, MemberTypes.TypeInfo);
|
public TypeInfo ReturnType => Assembly.Model.GetTypeFromUsage(returnTypeUsage, MemberTypes.TypeInfo);
|
||||||
|
|
||||||
// TODO: ReturnTypeCustomAttributes
|
// IL2CPP doesn't seem to retain return type custom attributes
|
||||||
|
|
||||||
public MethodInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) : base(pkg, methodIndex, declaringType) {
|
public MethodInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) : base(pkg, methodIndex, declaringType) {
|
||||||
// Add return parameter
|
// Add return parameter
|
||||||
|
|||||||
Reference in New Issue
Block a user