protected override void ProcessAssembly (AssemblyDefinition assembly) { if (Annotations.GetAction (assembly) != AssemblyAction.Link) return; module = assembly.MainModule; foreach (TypeDefinition type in module.GetAllTypes ()) { if (!type.IsNSObject ()) continue; ProcessNSObject (type); } imported = false; }
private static IDictionary<uint, IMetadataTokenProvider> InitializeTokenProviderCache(ModuleDefinition module) { var dict = new Dictionary<uint, IMetadataTokenProvider>(); var allTypes = module.GetAllTypes(); foreach (var type in allTypes) { foreach (var prop in type.Properties) { dict[prop.MetadataToken.ToUInt32()] = prop; } foreach (var vent in type.Events) { dict[vent.MetadataToken.ToUInt32()] = vent; } } foreach (var expType in module.ExportedTypes) { dict[expType.MetadataToken.ToUInt32()] = expType; } foreach (var modRef in module.ModuleReferences) { dict[modRef.MetadataToken.ToUInt32()] = modRef; } foreach (var assRef in module.AssemblyReferences) { dict[assRef.MetadataToken.ToUInt32()] = assRef; } return dict; }