Пример #1
0
 private void SetParameterMappings()
 {
     V_0 = 1;
     while (V_0 < this.statements.get_Count())
     {
         if (this.statements.get_Item(V_0).get_CodeNodeType() == 5)
         {
             V_1 = this.statements.get_Item(V_0) as ExpressionStatement;
             if (V_1.get_Expression().get_CodeNodeType() == 24 && (V_1.get_Expression() as BinaryExpression).get_IsAssignmentExpression())
             {
                 V_2 = V_1.get_Expression() as BinaryExpression;
                 if (V_2.get_Left().get_CodeNodeType() == 30)
                 {
                     V_3 = (V_2.get_Left() as FieldReferenceExpression).get_Field();
                     if ((object)V_3.get_DeclaringType().Resolve() == (object)this.yieldDeclaringType)
                     {
                         this.parameterMappings.set_Item(V_3.Resolve(), V_2.get_Right());
                     }
                 }
             }
         }
         V_0 = V_0 + 1;
     }
     return;
 }
 public ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
 {
     if (node.get_MethodExpression() == null)
     {
         return(null);
     }
     V_0 = node.get_MethodExpression();
     V_1 = V_0.get_Method();
     if (V_1.get_Name() == null)
     {
         return(null);
     }
     V_2 = this.GetEventMethodPrefix(V_1.get_Name());
     if (String.IsNullOrEmpty(V_2))
     {
         return(null);
     }
     if (V_1.get_Parameters().get_Count() != 1)
     {
         return(null);
     }
     V_3 = V_1.get_DeclaringType();
     V_4 = null;
     do
     {
         V_6 = new RebuildEventsStep.u003cu003ec__DisplayClass2_0();
         if (V_3 == null)
         {
             break;
         }
         V_7 = V_3.Resolve();
         if (V_7 == null)
         {
             break;
         }
         V_6.eventName = V_1.get_Name().Substring(V_2.get_Length());
         V_4           = V_7.get_Events().FirstOrDefault <EventDefinition>(new Func <EventDefinition, bool>(V_6.u003cVisitMethodInvocationExpressionu003eb__0));
         if (V_4 != null)
         {
             continue;
         }
         V_3 = V_7.get_BaseType();
     }while (V_3 != null && V_4 == null);
     if (V_4 == null)
     {
         return(null);
     }
     V_5 = new EventReferenceExpression(V_0.get_Target(), V_4, null);
     return(this.GetEventAssignExpression(V_5, node.get_Arguments().get_Item(0), V_2, node.get_InvocationInstructions()));
 }
Пример #3
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;
 }