From cbcec482b9362b0e5e7ac663844529746c384f20 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 11 Nov 2019 01:38:14 +0100 Subject: [PATCH] Model: Retrieve assembly-level custom attributes correctly --- Il2CppInspector/Reflection/CustomAttributeData.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Il2CppInspector/Reflection/CustomAttributeData.cs b/Il2CppInspector/Reflection/CustomAttributeData.cs index 57281d5..39ecd48 100644 --- a/Il2CppInspector/Reflection/CustomAttributeData.cs +++ b/Il2CppInspector/Reflection/CustomAttributeData.cs @@ -46,8 +46,7 @@ namespace Il2CppInspector.Reflection private static IList getCustomAttributes(Assembly asm, uint token, int customAttributeIndex) => getCustomAttributes(asm, asm.Model.GetCustomAttributeIndex(asm, token, customAttributeIndex)).ToList(); - // TODO: Get token or customAttributeIndex from Il2CppAssembly(Definition) - public static IList GetCustomAttributes(Assembly asm) => getCustomAttributes(asm, asm.Definition.token, -1); + public static IList GetCustomAttributes(Assembly asm) => getCustomAttributes(asm, asm.AssemblyDefinition.token, asm.AssemblyDefinition.customAttributeIndex); public static IList GetCustomAttributes(EventInfo evt) => getCustomAttributes(evt.Assembly, evt.Definition.token, evt.Definition.customAttributeIndex); public static IList GetCustomAttributes(FieldInfo field) => getCustomAttributes(field.Assembly, field.Definition.token, field.Definition.customAttributeIndex); public static IList GetCustomAttributes(MethodBase method) => getCustomAttributes(method.Assembly, method.Definition.token, method.Definition.customAttributeIndex);