Ejemplo n.º 1
0
        public static void LoadFromDatabase(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            UnitOfWorkHelper <MixCmsContext> .InitTransaction(_context, _transaction, ref V_0, ref V_1, ref V_2);

            try
            {
                try
                {
                    MixService.get_Instance().set_Translator(new JObject());
                    V_3 = V_0.get_MixLanguage().ToList <MixLanguage>();
                    V_4 = V_0.get_MixCulture().ToList <MixCulture>();
                    V_6 = V_4.GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_7             = new MixService.u003cu003ec__DisplayClass63_0();
                            V_7.culture     = V_6.get_Current();
                            V_8             = new JObject();
                            stackVariable22 = V_3;
                            stackVariable24 = V_7.u003cu003e9__0;
                            if (stackVariable24 == null)
                            {
                                dummyVar0          = stackVariable24;
                                stackVariable50    = new Func <MixLanguage, bool>(V_7.u003cLoadFromDatabaseu003eb__0);
                                V_10               = stackVariable50;
                                V_7.u003cu003e9__0 = stackVariable50;
                                stackVariable24    = V_10;
                            }
                            V_9 = stackVariable22.Where <MixLanguage>(stackVariable24).ToList <MixLanguage>().GetEnumerator();
                            try
                            {
                                while (V_9.MoveNext())
                                {
                                    V_11            = V_9.get_Current();
                                    stackVariable33 = V_11.get_Keyword();
                                    stackVariable35 = V_11.get_Value();
                                    if (stackVariable35 == null)
                                    {
                                        dummyVar1       = stackVariable35;
                                        stackVariable35 = V_11.get_DefaultValue();
                                    }
                                    V_8.Add(new JProperty(stackVariable33, stackVariable35));
                                }
                            }
                            finally
                            {
                                ((IDisposable)V_9).Dispose();
                            }
                            MixService.get_Instance().get_Translator().Add(new JProperty(V_7.culture.get_Specificulture(), V_8));
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                    MixService.get_Instance().set_LocalSettings(new JObject());
                    V_5 = V_0.get_MixConfiguration().ToList <MixConfiguration>();
                    V_6 = V_4.GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_13            = new MixService.u003cu003ec__DisplayClass63_1();
                            V_13.culture    = V_6.get_Current();
                            V_14            = new JObject();
                            stackVariable65 = V_5;
                            stackVariable67 = V_13.u003cu003e9__1;
                            if (stackVariable67 == null)
                            {
                                dummyVar2           = stackVariable67;
                                stackVariable92     = new Func <MixConfiguration, bool>(V_13.u003cLoadFromDatabaseu003eb__1);
                                V_16                = stackVariable92;
                                V_13.u003cu003e9__1 = stackVariable92;
                                stackVariable67     = V_16;
                            }
                            V_15 = stackVariable65.Where <MixConfiguration>(stackVariable67).ToList <MixConfiguration>().GetEnumerator();
                            try
                            {
                                while (V_15.MoveNext())
                                {
                                    V_17 = V_15.get_Current();
                                    V_18 = new JProperty(V_17.get_Keyword(), V_17.get_Value());
                                    V_14.Add(V_18);
                                }
                            }
                            finally
                            {
                                ((IDisposable)V_15).Dispose();
                            }
                            MixService.get_Instance().get_LocalSettings().Add(new JProperty(V_13.culture.get_Specificulture(), V_14));
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                    UnitOfWorkHelper <MixCmsContext> .HandleTransaction(true, V_2, V_1);
                }
                catch (Exception exception_0)
                {
                    dummyVar3 = UnitOfWorkHelper <MixCmsContext> .HandleException <MixLanguage>(exception_0, V_2, V_1);
                }
            }
            finally
            {
                if (V_2)
                {
                    RelationalDatabaseFacadeExtensions.CloseConnection(V_0.get_Database());
                    V_1.Dispose();
                    V_0.Dispose();
                }
            }
            return;
        }
Ejemplo n.º 2
0
        private DecompiledType GetDecompiledType(IMemberDefinition member, ILanguage language)
        {
            V_0 = Utilities.GetDeclaringTypeOrSelf(member);
            V_1 = new DecompiledType(V_0);
            V_2 = new Queue <IMemberDefinition>();
            V_2.Enqueue(member);
Label0:
            while (V_2.get_Count() > 0)
            {
                V_3 = V_2.Dequeue();
                if (V_3 as TypeDefinition != null && (object)V_3 == (object)member)
                {
                    V_4 = Utilities.GetTypeMembers(V_3 as TypeDefinition, language, true, null, null, null, V_1.get_TypeContext().GetFieldToPropertyMap(language).get_Keys()).GetEnumerator();
                    try
                    {
                        while (V_4.MoveNext())
                        {
                            V_5 = V_4.get_Current();
                            V_2.Enqueue(V_5);
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_4).Dispose();
                    }
                }
                if (V_3 as MethodDefinition != null)
                {
                    this.DecompileMember(V_3 as MethodDefinition, language, V_1);
                }
                if (V_3 as EventDefinition != null)
                {
                    V_6 = V_3 as EventDefinition;
                    if ((new AutoImplementedEventMatcher(V_6, language)).IsAutoImplemented())
                    {
                        dummyVar0 = V_1.get_TypeContext().get_AutoImplementedEvents().Add(V_6);
                    }
                    if (V_6.get_AddMethod() != null)
                    {
                        this.DecompileMember(V_6.get_AddMethod(), language, V_1);
                    }
                    if (V_6.get_RemoveMethod() != null)
                    {
                        this.DecompileMember(V_6.get_RemoveMethod(), language, V_1);
                    }
                    if (V_6.get_InvokeMethod() != null)
                    {
                        this.DecompileMember(V_6.get_InvokeMethod(), language, V_1);
                    }
                }
                if (V_3 as PropertyDefinition != null)
                {
                    V_7             = V_3 as PropertyDefinition;
                    stackVariable52 = new PropertyDecompiler(V_7, language, this.renameInvalidMembers, this.cacheService, V_1.get_TypeContext());
                    stackVariable52.add_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown));
                    stackVariable52.Decompile(out V_8, out V_9, out V_10);
                    stackVariable52.remove_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown));
                    if (V_10)
                    {
                        dummyVar1 = V_1.get_TypeContext().get_AutoImplementedProperties().Add(V_7);
                    }
                    if (V_8 != null)
                    {
                        this.AddDecompiledMemberToDecompiledType(V_8, V_1);
                    }
                    if (V_9 != null)
                    {
                        this.AddDecompiledMemberToDecompiledType(V_9, V_1);
                    }
                    V_11 = stackVariable52.get_ExceptionsWhileDecompiling().GetEnumerator();
                    try
                    {
                        while (V_11.MoveNext())
                        {
                            V_12 = V_11.get_Current();
                            this.get_ExceptionsWhileDecompiling().Add(V_12);
                        }
                    }
                    finally
                    {
                        if (V_11 != null)
                        {
                            V_11.Dispose();
                        }
                    }
                }
                if (V_3 as FieldDefinition == null)
                {
                    continue;
                }
                V_13 = V_3 as FieldDefinition;
                V_14 = V_3.get_DeclaringType().get_Methods().GetEnumerator();
                try
                {
                    while (V_14.MoveNext())
                    {
                        V_15 = V_14.get_Current();
                        if (!V_15.get_IsConstructor() || V_13.get_IsStatic() != V_15.get_IsStatic())
                        {
                            continue;
                        }
                        this.DecompileConstructorChain(V_15, language, V_1);
                        goto Label0;
                    }
                }
                finally
                {
                    V_14.Dispose();
                }
            }
            V_1.get_TypeContext().set_ExplicitlyImplementedMembers(this.GetExplicitlyImplementedInterfaceMethods(V_0, language));
            this.AddGeneratedFilterMethodsToDecompiledType(V_1, V_1.get_TypeContext(), language);
            return(V_1);
        }
 public override void VisitBinaryExpression(BinaryExpression node)
 {
     V_0 = this.GetExpressionTypeName(node.get_Left());
     V_1 = this.GetExpressionTypeName(node.get_Right());
     this.VisitBinaryExpression(node);
     if (String.op_Inequality(this.GetExpressionTypeName(node.get_Left()), V_0))
     {
         stackVariable16 = true;
     }
     else
     {
         stackVariable16 = String.op_Inequality(this.GetExpressionTypeName(node.get_Right()), V_1);
     }
     V_2 = stackVariable16;
     if (node.get_IsAssignmentExpression() || node.get_IsSelfAssign() && !node.get_IsEventHandlerAddOrRemove())
     {
         V_3 = node.get_Left();
         V_4 = node.get_Right();
         if (V_4.get_HasType() && V_3.get_HasType())
         {
             V_5 = V_3.get_ExpressionType();
             V_6 = V_4.get_ExpressionType().Resolve();
             if (this.ShouldAddCast(V_6, V_5))
             {
                 node.set_Right(new ExplicitCastExpression(V_4, V_5, null));
                 V_2 = true;
             }
             V_7 = V_5.Resolve();
             if (V_7 != null && V_6 != null && V_7.get_IsEnum() && V_6.get_IsValueType() && String.op_Inequality(V_7.get_FullName(), V_6.get_FullName()))
             {
                 node.set_Right(new ExplicitCastExpression(V_4, V_5, null));
                 V_2 = true;
             }
         }
     }
     else
     {
         if (!this.IsArithmeticOperator(node.get_Operator()))
         {
             if (this.IsBitwiseOperator(node.get_Operator()) || node.get_IsComparisonExpression())
             {
                 V_10 = node.get_Left();
                 V_11 = node.get_Right();
                 if (V_11.get_HasType() && V_10.get_HasType())
                 {
                     V_12 = V_10.get_ExpressionType();
                     V_13 = V_11.get_ExpressionType().Resolve();
                     if (this.ShouldAddCast(V_13, V_12))
                     {
                         node.set_Right(new ExplicitCastExpression(V_11, V_12, null));
                         V_2 = true;
                     }
                     V_14 = V_11.get_ExpressionType();
                     V_15 = V_10.get_ExpressionType().Resolve();
                     if (this.ShouldAddCast(V_15, V_14))
                     {
                         node.set_Left(new ExplicitCastExpression(V_10, V_14, null));
                         V_2 = true;
                     }
                     if (V_15 != null && V_15.get_IsEnum() && V_13 != null && V_13.get_IsEnum() && String.op_Inequality(V_15.get_FullName(), V_13.get_FullName()))
                     {
                         node.set_Left(new ExplicitCastExpression(V_10, this.GetEnumUnderlyingType(V_15), null));
                         node.set_Right(new ExplicitCastExpression(V_11, this.GetEnumUnderlyingType(V_15), null));
                         V_2 = true;
                     }
                 }
             }
             else
             {
                 if (this.IsShiftOperator(node.get_Operator()))
                 {
                     if (node.get_Left().get_HasType())
                     {
                         V_16 = node.get_Left().get_ExpressionType().Resolve();
                         if (V_16 != null && V_16.get_IsEnum())
                         {
                             node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_16), null));
                             V_2 = true;
                         }
                     }
                     if (node.get_Right().get_HasType())
                     {
                         V_17 = node.get_Right().get_ExpressionType().Resolve();
                         if (V_17 != null && V_17.get_IsEnum())
                         {
                             node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_17), null));
                             V_2 = true;
                         }
                     }
                 }
             }
         }
         else
         {
             if (node.get_Left().get_HasType())
             {
                 V_8 = node.get_Left().get_ExpressionType().Resolve();
                 if (V_8 != null && V_8.get_IsEnum())
                 {
                     node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_8), null));
                     V_2 = true;
                 }
             }
             if (node.get_Right().get_HasType())
             {
                 V_9 = node.get_Right().get_ExpressionType().Resolve();
                 if (V_9 != null && V_9.get_IsEnum())
                 {
                     node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_9), null));
                     V_2 = true;
                 }
             }
         }
     }
     if (V_2)
     {
         node.UpdateType();
     }
     return;
 }
Ejemplo n.º 4
0
 private void Preprocess()
 {
     V_0 = 0;
     V_1 = new Dictionary <ParameterDefinition, string>();
     V_2 = this.methodContext.get_ParameterDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_4 = V_3.get_Key();
             V_5 = V_3.get_Value();
             V_6 = V_5;
             V_7 = !V_6.IsValidIdentifier();
             while (V_7 || this.HasMethodParameterWithSameName(V_6))
             {
                 V_7             = false;
                 stackVariable22 = V_0;
                 V_0             = stackVariable22 + 1;
                 V_8             = stackVariable22;
                 V_6             = String.Concat("argument", V_8.ToString());
             }
             if (!String.op_Inequality(V_6, V_5))
             {
                 continue;
             }
             V_1.Add(V_4, V_6);
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_2 = V_1.GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_9 = V_2.get_Current();
             this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_9.get_Key(), V_9.get_Value());
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_10 = this.methodContext.get_Body().get_Method().get_Parameters().GetEnumerator();
     try
     {
         while (V_10.MoveNext())
         {
             V_11 = V_10.get_Current();
             V_12 = V_11.get_Name();
             if (String.IsNullOrEmpty(V_12))
             {
                 V_12 = this.GetNameByType(V_11.get_ParameterType());
             }
             this.methodContext.get_ParameterDefinitionToNameMap().Add(V_11, V_12);
         }
     }
     finally
     {
         V_10.Dispose();
     }
     if (this.methodContext.get_Method().get_IsSetter() && this.methodContext.get_Method().get_Parameters().get_Count() == 1)
     {
         V_13 = this.methodContext.get_Method().get_Parameters().get_Item(0);
         this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_13, "value");
     }
     V_14 = this.methodContext.get_Body().get_Variables().GetEnumerator();
     try
     {
         while (V_14.MoveNext())
         {
             V_15 = V_14.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_15.get_Name()))
             {
                 continue;
             }
             dummyVar0 = this.methodContext.get_VariablesToRename().Add(V_15);
         }
     }
     finally
     {
         V_14.Dispose();
     }
     V_16 = this.methodContext.get_VariableDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_16.MoveNext())
         {
             V_17 = V_16.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_17.get_Value()))
             {
                 continue;
             }
             dummyVar1 = this.methodContext.get_VariablesToRename().Add(V_17.get_Key());
         }
     }
     finally
     {
         ((IDisposable)V_16).Dispose();
     }
     return;
 }