|
1 | 1 | using System;
|
| 2 | +using System.Diagnostics; |
2 | 3 | using System.Linq;
|
3 | 4 | using System.Reflection;
|
4 | 5 | using System.Threading.Tasks;
|
@@ -39,6 +40,9 @@ private static void InjectFieldOffsetAttribute(ApplicationAnalysisContext appCon
|
39 | 40 |
|
40 | 41 | foreach (var f in assemblyAnalysisContext.Types.SelectMany(t => t.Fields))
|
41 | 42 | {
|
| 43 | + if (f.DeclaringType.Name == "FIFJGNHHBKJ") |
| 44 | + Debugger.Break(); |
| 45 | + |
42 | 46 | if (f.CustomAttributes == null || f.BackingData == null || f.IsStatic)
|
43 | 47 | continue;
|
44 | 48 |
|
@@ -116,10 +120,25 @@ private static void InjectTokenAttribute(ApplicationAnalysisContext appContext)
|
116 | 120 |
|
117 | 121 | private static void InjectAttributeAttribute(ApplicationAnalysisContext appContext)
|
118 | 122 | {
|
119 |
| - if(LibCpp2IlMain.MetadataVersion >= 29f) |
| 123 | + if (LibCpp2IlMain.MetadataVersion >= 29f) |
| 124 | + { |
120 | 125 | //All attributes should be fully serializable anyway, as they're stored in metadata
|
| 126 | + //However, we still need to read them all |
| 127 | + var toAnalyze = appContext.Assemblies.SelectMany(ctx => ctx.Types) |
| 128 | + .SelectMany(ctx => |
| 129 | + ctx.Methods.SelectMany(m => m.Parameters.Cast<HasCustomAttributes>().Append(m) |
| 130 | + .Concat(ctx.Fields) |
| 131 | + .Concat(ctx.Events) |
| 132 | + .Concat(ctx.Properties) |
| 133 | + .Append(ctx))); |
| 134 | + |
| 135 | + foreach (var hasCustomAttributes in toAnalyze) |
| 136 | + hasCustomAttributes.AnalyzeCustomAttributeData(); |
| 137 | + |
| 138 | + // MiscUtils.ExecuteParallel(toAnalyze, ctx => ctx.AnalyzeCustomAttributeData()); |
121 | 139 | return;
|
122 |
| - |
| 140 | + } |
| 141 | + |
123 | 142 | var attributeAttributes = appContext.InjectTypeIntoAllAssemblies("Cpp2ILInjected", "AttributeAttribute", appContext.SystemTypes.SystemAttributeType);
|
124 | 143 |
|
125 | 144 | var attributeNameFields = attributeAttributes.InjectFieldToAllAssemblies("Name", appContext.SystemTypes.SystemStringType, FieldAttributes.Public);
|
|
0 commit comments