Output: Fix regressions in TypeInfo.CSharpTypeDeclarationName and TypeInfo.CSharpName

This commit is contained in:
Katy Coe
2019-11-18 02:19:25 +01:00
parent 4e3a8f25cc
commit 3849b38520
2 changed files with 5 additions and 1 deletions

View File

@@ -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);
}))()

View File

@@ -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 ? "*" : "");