From 98366a7b494476f163fbd2e3bbd987e35e124fe6 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Thu, 12 Dec 2019 11:14:14 +0100 Subject: [PATCH] Output: Explicitly implemented generic properties could have mismatched chevrons --- Il2CppInspector/Reflection/PropertyInfo.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Il2CppInspector/Reflection/PropertyInfo.cs b/Il2CppInspector/Reflection/PropertyInfo.cs index 1d78c82..181a806 100644 --- a/Il2CppInspector/Reflection/PropertyInfo.cs +++ b/Il2CppInspector/Reflection/PropertyInfo.cs @@ -4,6 +4,7 @@ All rights reserved. */ +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -28,12 +29,17 @@ namespace Il2CppInspector.Reflection { public override string Name { get; protected set; } - public string CSharpName => - // Explicit interface implementation - CSharpSafeName.IndexOf('.') != -1? string.Join('.', CSharpSafeName.Split('.')[^2..]) + public string CSharpName { + get { + // Explicit interface implementation + if (DeclaringType.ImplementedInterfaces + .FirstOrDefault(i => CSharpSafeName.IndexOf("." + i.CSharpTypeDeclarationName, StringComparison.Ordinal) != -1) is TypeInfo @interface) + return CSharpSafeName.Substring(CSharpSafeName.IndexOf("." + @interface.CSharpTypeDeclarationName, StringComparison.Ordinal) + 1); - // Regular method - : Name; + // Regular method + return Name; + } + } public TypeInfo PropertyType => GetMethod?.ReturnType ?? SetMethod.DeclaredParameters[^1].ParameterType;