protected override bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result, out int replacedStatementsCount)
 {
     result = null;
     replacedStatementsCount = 0;
     if (!this.TryGetObjectCreation(statements, startIndex, out V_0, out V_1))
     {
         return(false);
     }
     V_2 = new ExpressionCollection();
     V_3 = new HashSet <string>();
     if (V_0.get_Initializer() != null)
     {
         if (V_0.get_Initializer().get_InitializerType() != 1)
         {
             return(false);
         }
         V_4 = V_0.get_Initializer().get_Expressions().GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5       = V_4.get_Current();
                 V_6       = this.GetName((V_5 as BinaryExpression).get_Left());
                 dummyVar0 = V_3.Add(V_6);
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
     }
     V_7 = startIndex + 1;
     while (V_7 < statements.get_Count() && this.TryGetNextExpression(statements.get_Item(V_7), out V_8))
     {
         V_9 = V_8 as BinaryExpression;
         if (!this.IsObjectPropertyOrFieldAssignment(V_9, V_1))
         {
             break;
         }
         V_10 = null;
         if (V_9.get_Left().get_CodeNodeType() != 42)
         {
             if (V_9.get_Left().get_CodeNodeType() == 30)
             {
                 V_13 = (V_9.get_Left() as FieldReferenceExpression).get_Field().Resolve();
                 if (!this.Visit(V_13.get_Name(), V_3))
                 {
                     break;
                 }
                 V_10 = new FieldInitializerExpression(V_13, V_13.get_FieldType(), V_9.get_Left().get_UnderlyingSameMethodInstructions());
             }
         }
         else
         {
             V_12 = (V_9.get_Left() as PropertyReferenceExpression).get_Property();
             if (!this.Visit(V_12.get_Name(), V_3))
             {
                 break;
             }
             V_10 = new PropertyInitializerExpression(V_12, V_12.get_PropertyType(), V_9.get_Left().get_UnderlyingSameMethodInstructions());
         }
         V_11 = new BinaryExpression(26, V_10, V_9.get_Right().Clone(), this.typeSystem, null, false);
         V_2.Add(V_11);
         V_7 = V_7 + 1;
     }
     if (V_2.get_Count() == 0)
     {
         return(false);
     }
     if (V_0.get_Initializer() != null)
     {
         V_4 = V_2.GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_15 = V_4.get_Current();
                 V_0.get_Initializer().get_Expressions().Add(V_15);
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
     }
     else
     {
         V_14 = new InitializerExpression(V_2, 1);
         V_14.set_IsMultiLine(true);
         V_0.set_Initializer(V_14);
     }
     result = statements.get_Item(startIndex);
     replacedStatementsCount = V_2.get_Count() + 1;
     return(true);
 }
Esempio n. 2
0
 public static int CompareToSecurityAttribute(this SecurityAttribute first, SecurityAttribute second, SecurityDeclaration firstDeclaration, SecurityDeclaration secondDeclaration)
 {
     if ((object)first == (object)second)
     {
         return(0);
     }
     V_0 = firstDeclaration.get_Action().ToString();
     V_1 = secondDeclaration.get_Action().ToString();
     if (String.op_Inequality(V_0, V_1))
     {
         return(V_0.CompareTo(V_1));
     }
     V_2 = Math.Max(first.get_Properties().get_Count(), second.get_Properties().get_Count());
     V_5 = 0;
     while (V_5 < V_2)
     {
         if (V_5 >= first.get_Properties().get_Count())
         {
             return(1);
         }
         if (V_5 >= second.get_Properties().get_Count())
         {
             return(-1);
         }
         V_6 = first.get_Properties().get_Item(V_5);
         V_7 = second.get_Properties().get_Item(V_5);
         if (!String.op_Equality(V_6.get_Name(), V_7.get_Name()))
         {
             return(V_6.get_Name().CompareTo(V_7.get_Name()));
         }
         V_10 = V_6.get_Argument();
         V_8  = V_10.get_Value().ToString();
         V_10 = V_7.get_Argument();
         V_9  = V_10.get_Value().ToString();
         if (String.op_Inequality(V_8, V_9))
         {
             return(V_8.CompareTo(V_9));
         }
         V_5 = V_5 + 1;
     }
     V_3  = Math.Max(first.get_Fields().get_Count(), second.get_Fields().get_Count());
     V_11 = 0;
     while (V_11 < V_3)
     {
         if (V_11 >= first.get_Fields().get_Count())
         {
             return(1);
         }
         if (V_11 >= second.get_Fields().get_Count())
         {
             return(-1);
         }
         V_12 = first.get_Fields().get_Item(V_11);
         V_13 = second.get_Fields().get_Item(V_11);
         if (!String.op_Equality(V_12.get_Name(), V_13.get_Name()))
         {
             return(V_12.get_Name().CompareTo(V_13.get_Name()));
         }
         V_10 = V_12.get_Argument();
         V_14 = V_10.get_Value().ToString();
         V_10 = V_13.get_Argument();
         V_15 = V_10.get_Value().ToString();
         if (String.op_Inequality(V_14, V_15))
         {
             return(V_14.CompareTo(V_15));
         }
         V_11 = V_11 + 1;
     }
     return(0);
 }