From 6fb95c52dac8bdd03cd936ac6087129b5df3d8d9 Mon Sep 17 00:00:00 2001 From: Robert Xiao Date: Sun, 12 Apr 2020 15:16:01 -0700 Subject: [PATCH] Only include GenericMethod definers in Types Including *every* generated type in Types defeats the purpose of the Types property, which is to list all types directly referred to by the Il2Cpp metadata. Therefore, we return to the previous implementation: only list types referred to by DefinitionIndex, ReferenceIndex, and classIndexIndex. --- Il2CppInspector.Common/Reflection/Il2CppModel.cs | 9 ++------- Il2CppInspector.Common/Reflection/TypeInfo.cs | 13 ------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/Il2CppInspector.Common/Reflection/Il2CppModel.cs b/Il2CppInspector.Common/Reflection/Il2CppModel.cs index 2266935..8fbc79c 100644 --- a/Il2CppInspector.Common/Reflection/Il2CppModel.cs +++ b/Il2CppInspector.Common/Reflection/Il2CppModel.cs @@ -32,13 +32,8 @@ namespace Il2CppInspector.Reflection public Dictionary TypesByFullName { get; } = new Dictionary(); // Every type - public IEnumerable Types { - get { - var result = new IEnumerable[] { TypesByDefinitionIndex, TypesByReferenceIndex }.SelectMany(t => t); - result = result.Concat(result.SelectMany(t => t.CachedGeneratedTypes)); - return result.Distinct(); - } - } + public IEnumerable Types => TypesByDefinitionIndex.Concat(TypesByReferenceIndex) + .Concat(GenericMethods.Values.Select(m => m.DeclaringType)).Distinct(); // List of all methods ordered by their MethodDefinitionIndex public MethodBase[] MethodsByDefinitionIndex { get; } diff --git a/Il2CppInspector.Common/Reflection/TypeInfo.cs b/Il2CppInspector.Common/Reflection/TypeInfo.cs index 5c512b6..3f42c74 100644 --- a/Il2CppInspector.Common/Reflection/TypeInfo.cs +++ b/Il2CppInspector.Common/Reflection/TypeInfo.cs @@ -37,19 +37,6 @@ namespace Il2CppInspector.Reflection { private Dictionary generatedArrayTypes = new Dictionary(); private TypeInfo generatedByRefType; private TypeInfo generatedPointerType; - // This property exposes all types which have been generated directly from this one. - public IEnumerable CachedGeneratedTypes { - get { - IEnumerable result = generatedArrayTypes.Values; - if (genericTypeInstances != null) - result = result.Concat(genericTypeInstances.Values); - if (generatedByRefType != null) - result = result.Append(generatedByRefType); - if (generatedPointerType != null) - result = result.Append(generatedPointerType); - return result; - } - } // Information/flags about the type // Undefined if the Type represents a generic type parameter