Model: Don't return duplicates or nulls in Model.Types

Prevents duplicates appearing in IDA Python script
This commit is contained in:
Katy Coe
2020-01-30 07:56:33 +01:00
parent 37f1c49828
commit 007779df62

View File

@@ -30,7 +30,8 @@ namespace Il2CppInspector.Reflection
public ConcurrentDictionary<ulong, TypeInfo> TypesByVirtualAddress { get; } = new ConcurrentDictionary<ulong, TypeInfo>();
// Every type
public IEnumerable<TypeInfo> Types => new IEnumerable<TypeInfo>[] {TypesByDefinitionIndex, TypesByReferenceIndex, TypesByVirtualAddress.Values}.SelectMany(t => t);
public IEnumerable<TypeInfo> Types => new IEnumerable<TypeInfo>[] {TypesByDefinitionIndex, TypesByReferenceIndex, TypesByVirtualAddress.Values}
.SelectMany(t => t).Where(t => t != null).Distinct();
// List of all methods ordered by their MethodDefinitionIndex
public MethodBase[] MethodsByDefinitionIndex { get; }