Output: Fix regressions in TypeInfo.CSharpTypeDeclarationName and TypeInfo.CSharpName
This commit is contained in:
@@ -61,6 +61,9 @@ namespace Il2CppInspector.Reflection
|
||||
((Func<string>)(() => {
|
||||
var implementingInterface = DeclaringType.ImplementedInterfaces.FirstOrDefault(i => Name.StartsWith(i.Namespace + "." + i.CSharpName + "."))
|
||||
?? DeclaringType.ImplementedInterfaces.FirstOrDefault(i => Name.StartsWith(Regex.Replace(i.FullName, @"`\d", "").Replace('[', '<').Replace(']', '>') + "."));
|
||||
// TODO: There are some combinations we haven't dealt with so use this test as a safety valve
|
||||
if (implementingInterface == null)
|
||||
return Name;
|
||||
var sliceLength = Regex.Replace(implementingInterface.FullName, @"`\d", "").Length + 1;
|
||||
return implementingInterface.CSharpName + "." + Name.Substring(sliceLength);
|
||||
}))()
|
||||
|
||||
@@ -69,7 +69,8 @@ namespace Il2CppInspector.Reflection {
|
||||
((GenericParameterAttributes & GenericParameterAttributes.Contravariant) == GenericParameterAttributes.Contravariant? "in " : "")
|
||||
+ ((GenericParameterAttributes & GenericParameterAttributes.Covariant) == GenericParameterAttributes.Covariant? "out ":"")
|
||||
+ (base.Name.IndexOf("`", StringComparison.Ordinal) == -1 ? base.Name : base.Name.Remove(base.Name.IndexOf("`", StringComparison.Ordinal)))
|
||||
+ ((IsNested? GenericTypeParameters.Where(p => DeclaringType.GenericTypeParameters.All(dp => dp.Name != p.Name)) : GenericTypeParameters)?.Any() ?? false ? "<" + string.Join(", ", GenericTypeParameters.Select(x => x.CSharpTypeDeclarationName)) + ">" : "")
|
||||
+ ((IsNested? GenericTypeParameters?.Where(p => DeclaringType.GenericTypeParameters?.All(dp => dp.Name != p.Name) ?? true) : GenericTypeParameters)?.Any() ?? false?
|
||||
"<" + string.Join(", ", GenericTypeParameters.Select(x => x.CSharpTypeDeclarationName)) + ">" : "")
|
||||
+ (GenericTypeArguments != null ? "<" + string.Join(", ", GenericTypeArguments.Select(x => x.CSharpTypeDeclarationName)) + ">" : ""))
|
||||
+ (IsArray ? "[" + new string(',', GetArrayRank() - 1) + "]" : "")
|
||||
+ (IsPointer ? "*" : "");
|
||||
|
||||
Reference in New Issue
Block a user