Exemplo n.º 1
0
 public virtual void WriteAssemblyAttributes(AssemblyDefinition assembly, ICollection <string> attributesToIgnore = null)
 {
     V_0 = new List <ICustomAttribute>();
     this.securityAttributeToDeclaration = new Dictionary <SecurityAttribute, SecurityDeclaration>();
     V_0.Add(AttributesUtilities.GetAssemblyVersionAttribute(assembly));
     V_2 = assembly.get_CustomAttributes().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_3.Resolve();
             V_0.Add(V_3);
         }
     }
     finally
     {
         V_2.Dispose();
     }
     if (assembly.get_HasSecurityDeclarations())
     {
         V_4 = assembly.get_SecurityDeclarations().GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5 = V_4.get_Current();
                 V_0.AddRange(this.GetSecurityDeclaration(V_5));
             }
         }
         finally
         {
             V_4.Dispose();
         }
     }
     if (assembly.get_MainModule().get_HasExportedTypes())
     {
         V_6 = assembly.get_MainModule().get_ExportedTypes().GetEnumerator();
         try
         {
             while (V_6.MoveNext())
             {
                 V_7 = V_6.get_Current();
                 if (V_7.get_Scope() as ModuleReference != null)
                 {
                     continue;
                 }
                 V_0.Add(AttributesUtilities.GetExportedTypeAttribute(V_7, assembly.get_MainModule()));
             }
         }
         finally
         {
             V_6.Dispose();
         }
     }
     V_0.Sort(new Comparison <ICustomAttribute>(this.u003cWriteAssemblyAttributesu003eb__18_0));
     V_8 = V_0.GetEnumerator();
     try
     {
         while (V_8.MoveNext())
         {
             V_9 = V_8.get_Current();
             if (attributesToIgnore != null && attributesToIgnore.Contains(V_9.get_AttributeType().get_FullName()))
             {
                 continue;
             }
             if (V_9 as CustomAttribute == null)
             {
                 if (V_9 as SecurityAttribute == null)
                 {
                     continue;
                 }
                 dummyVar0 = this.WriteSecurityAttribute(assembly.get_MainModule(), true, V_9 as SecurityAttribute, this.securityAttributeToDeclaration.get_Item(V_9 as SecurityAttribute), out V_10, false, false);
             }
             else
             {
                 this.WriteAssemblyAttribute(V_9 as CustomAttribute);
             }
         }
     }
     finally
     {
         ((IDisposable)V_8).Dispose();
     }
     return;
 }