Model: and Output Handle multi-dimensional arrays (multi-rank arrays) correctly
This commit is contained in:
@@ -48,7 +48,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
n = ElementType.CSharpName;
|
n = ElementType.CSharpName;
|
||||||
var g = (GenericTypeParameters != null ? "<" + string.Join(", ", GenericTypeParameters.Select(x => x.CSharpName)) + ">" : "");
|
var g = (GenericTypeParameters != null ? "<" + string.Join(", ", GenericTypeParameters.Select(x => x.CSharpName)) + ">" : "");
|
||||||
g = (GenericTypeArguments != null ? "<" + string.Join(", ", GenericTypeArguments.Select(x => x.CSharpName)) + ">" : g);
|
g = (GenericTypeArguments != null ? "<" + string.Join(", ", GenericTypeArguments.Select(x => x.CSharpName)) + ">" : g);
|
||||||
return n + g + (IsArray ? "[]" : "") + (IsPointer ? "*" : "");
|
return n + g + (IsArray ? "[" + new string(',', GetArrayRank() - 1) + "]" : "") + (IsPointer ? "*" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
(base.Name.IndexOf("`", StringComparison.Ordinal) == -1 ? base.Name : base.Name.Remove(base.Name.IndexOf("`", StringComparison.Ordinal)))
|
(base.Name.IndexOf("`", StringComparison.Ordinal) == -1 ? base.Name : base.Name.Remove(base.Name.IndexOf("`", StringComparison.Ordinal)))
|
||||||
+ (GenericTypeParameters != null ? "<" + string.Join(", ", GenericTypeParameters.Select(x => x.Name)) + ">" : "")
|
+ (GenericTypeParameters != null ? "<" + string.Join(", ", GenericTypeParameters.Select(x => x.Name)) + ">" : "")
|
||||||
+ (GenericTypeArguments != null ? "<" + string.Join(", ", GenericTypeArguments.Select(x => x.Name)) + ">" : "")
|
+ (GenericTypeArguments != null ? "<" + string.Join(", ", GenericTypeArguments.Select(x => x.Name)) + ">" : "")
|
||||||
+ (IsArray ? "[]" : "")
|
+ (IsArray ? "[" + new string(',', GetArrayRank() - 1) + "]" : "")
|
||||||
+ (IsPointer ? "*" : "");
|
+ (IsPointer ? "*" : "");
|
||||||
|
|
||||||
// Custom attributes for this member
|
// Custom attributes for this member
|
||||||
@@ -110,7 +110,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
+ base.Name
|
+ base.Name
|
||||||
+ (GenericTypeParameters != null ? "[" + string.Join(",", GenericTypeParameters.Select(x => x.FullName ?? x.Name)) + "]" : "")
|
+ (GenericTypeParameters != null ? "[" + string.Join(",", GenericTypeParameters.Select(x => x.FullName ?? x.Name)) + "]" : "")
|
||||||
+ (GenericTypeArguments != null ? "[" + string.Join(",", GenericTypeArguments.Select(x => x.FullName ?? x.Name)) + "]" : "")
|
+ (GenericTypeArguments != null ? "[" + string.Join(",", GenericTypeArguments.Select(x => x.FullName ?? x.Name)) + "]" : "")
|
||||||
+ (IsArray? "[]" : "")
|
+ (IsArray? "[" + new string(',', GetArrayRank() - 1) + "]" : "")
|
||||||
+ (IsPointer? "*" : "");
|
+ (IsPointer? "*" : "");
|
||||||
|
|
||||||
public List<TypeInfo> GenericTypeParameters { get; }
|
public List<TypeInfo> GenericTypeParameters { get; }
|
||||||
@@ -357,6 +357,9 @@ namespace Il2CppInspector.Reflection {
|
|||||||
|
|
||||||
IsPointer = (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_PTR);
|
IsPointer = (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_PTR);
|
||||||
IsArray = !IsPointer;
|
IsArray = !IsPointer;
|
||||||
|
|
||||||
|
// Heap arrays always have one dimension
|
||||||
|
arrayRank = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic type parameter
|
// Generic type parameter
|
||||||
@@ -425,7 +428,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
+ base.Name
|
+ base.Name
|
||||||
+ (GenericTypeParameters != null ? "[" + string.Join(",", GenericTypeParameters.Select(x => x.Namespace != Namespace? x.FullName ?? x.Name : x.ToString())) + "]" : "")
|
+ (GenericTypeParameters != null ? "[" + string.Join(",", GenericTypeParameters.Select(x => x.Namespace != Namespace? x.FullName ?? x.Name : x.ToString())) + "]" : "")
|
||||||
+ (GenericTypeArguments != null ? "[" + string.Join(",", GenericTypeArguments.Select(x => x.Namespace != Namespace? x.FullName ?? x.Name : x.ToString())) + "]" : "")
|
+ (GenericTypeArguments != null ? "[" + string.Join(",", GenericTypeArguments.Select(x => x.Namespace != Namespace? x.FullName ?? x.Name : x.ToString())) + "]" : "")
|
||||||
+ (IsArray ? "[]" : "")
|
+ (IsArray ? "[" + new string(',', GetArrayRank() - 1) + "]" : "")
|
||||||
+ (IsPointer ? "*" : "");
|
+ (IsPointer ? "*" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user