Exemplo n.º 1
0
        private bool GetYieldExceptionData()
        {
            if ((int)this.theDisposeCFG.get_Blocks().Length == 1)
            {
                return(true);
            }
            V_0 = this.theDisposeCFG.get_OffsetToInstruction().get_Item(0);
            if (V_0.get_OpCode().get_Code() != 2)
            {
                return(false);
            }
            V_0 = this.theDisposeCFG.get_OffsetToInstruction().get_Item(1);
            if (V_0.get_OpCode().get_Code() != 120 || V_0.get_Operand() as FieldReference == null || !this.CheckAndSaveStateField(V_0.get_Operand() as FieldReference))
            {
                return(false);
            }
            V_2 = this.theDisposeCFG.get_SwitchBlocksInformation().get_Values().GetEnumerator();
            try
            {
                while (V_2.MoveNext())
                {
                    V_3 = V_2.get_Current();
                    if (this.DetermineExceptionHandlingStatesFromSwitchData(V_3))
                    {
                        continue;
                    }
                    V_4 = false;
                    goto Label0;
                }
            }
            finally
            {
                ((IDisposable)V_2).Dispose();
            }
            this.DetermineExceptionHandlingStatesFromCFGBlocks();
            V_5 = this.handlerToStatesMap.GetEnumerator();
            try
            {
                while (V_5.MoveNext())
                {
                    V_6 = V_5.get_Current();
                    if (this.TryCreateYieldExceptionHandler(V_6.get_Value(), V_6.get_Key()))
                    {
                        continue;
                    }
                    V_4 = false;
                    goto Label0;
                }
                goto Label1;
            }
            finally
            {
                ((IDisposable)V_5).Dispose();
            }
Label0:
            return(V_4);

Label1:
            return(true);
        }
Exemplo n.º 2
0
 private int CountInstructions(IEnumerable <ILogicalConstruct> trueSuccessor)
 {
     V_0 = 0;
     V_1 = trueSuccessor.GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current().get_CFGBlocks().GetEnumerator();
             try
             {
                 while (V_2.MoveNext())
                 {
                     V_3 = V_2.get_Current();
                     V_4 = 0;
                     if (!this.blockToInstructionsCount.ContainsKey(V_3.get_TheBlock().get_First().get_Offset()))
                     {
                         V_5 = V_3.get_TheBlock().GetEnumerator();
                         try
                         {
                             while (V_5.MoveNext())
                             {
                                 dummyVar0 = V_5.get_Current();
                                 V_4       = V_4 + 1;
                             }
                         }
                         finally
                         {
                             if (V_5 != null)
                             {
                                 V_5.Dispose();
                             }
                         }
                         this.blockToInstructionsCount.Add(V_3.get_TheBlock().get_First().get_Offset(), V_4);
                     }
                     else
                     {
                         V_4 = this.blockToInstructionsCount.get_Item(V_3.get_TheBlock().get_First().get_Offset());
                     }
                     V_0 = V_0 + V_4;
                 }
             }
             finally
             {
                 ((IDisposable)V_2).Dispose();
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     return(V_0);
 }
Exemplo n.º 3
0
        private void MergeWithSingleChild()
        {
            V_0 = false;
            do
            {
                V_1 = null;
                V_2 = this.inferenceGraph.GetEnumerator();
                try
                {
                    while (V_2.MoveNext())
                    {
                        V_3 = V_2.get_Current();
                        if (V_3.get_IsHardNode() || V_3.get_CanAssignTo().get_Count() != 1 || V_3.get_SubTypes().get_Count() != 0)
                        {
                            continue;
                        }
                        V_4 = null;
                        V_5 = V_3.get_CanAssignTo().GetEnumerator();
                        try
                        {
                            if (V_5.MoveNext())
                            {
                                V_4 = V_5.get_Current();
                            }
                        }
                        finally
                        {
                            if (V_5 != null)
                            {
                                V_5.Dispose();
                            }
                        }
                        stackVariable27    = new ClassHierarchyNode[2];
                        stackVariable27[0] = V_3;
                        stackVariable27[1] = V_4;
                        V_1 = (ICollection <ClassHierarchyNode>)stackVariable27;
                        V_0 = true;
                        goto Label0;
                    }
                }
                finally
                {
                    if (V_2 != null)
                    {
                        V_2.Dispose();
                    }
                }
Label0:
                if (!V_0)
                {
                    continue;
                }
                this.MergeNodes(V_1);
            }while (V_0);
            return;
        }
Exemplo n.º 4
0
 private bool SubtreeEndsInInstructionCode(InstructionBlock entryBlock, IEnumerable <Code> operationCodes)
 {
     V_0 = true;
     V_1 = new Queue <InstructionBlock>();
     V_2 = new HashSet <int>();
     V_1.Enqueue(entryBlock);
     while (V_1.get_Count() > 0 & V_0)
     {
         V_3 = V_1.Dequeue();
         if (V_2.Contains(V_3.get_First().get_Offset()))
         {
             continue;
         }
         dummyVar0 = V_2.Add(V_3.get_First().get_Offset());
         if (V_3.get_Successors().Length != 0)
         {
             V_8 = V_3.get_Successors();
             V_9 = 0;
             while (V_9 < (int)V_8.Length)
             {
                 V_1.Enqueue(V_8[V_9]);
                 V_9 = V_9 + 1;
             }
         }
         else
         {
             V_4 = false;
             V_5 = operationCodes.GetEnumerator();
             try
             {
                 while (V_5.MoveNext())
                 {
                     V_6 = V_5.get_Current();
                     V_7 = V_3.get_Last().get_OpCode();
                     V_4 = V_4 | V_7.get_Code() == V_6;
                 }
             }
             finally
             {
                 if (V_5 != null)
                 {
                     V_5.Dispose();
                 }
             }
             V_0 = V_0 & V_4;
         }
     }
     return(V_0);
 }
Exemplo n.º 5
0
 private void AddCasts()
 {
     V_0 = this.context.get_MethodContext().get_StackData().get_VariableToDefineUseInfo().GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             V_2 = V_1.get_Value().get_UsedAt().GetEnumerator();
             try
             {
                 while (V_2.MoveNext())
                 {
                     V_3 = V_2.get_Current();
                     if (!this.offsetToExpression.TryGetValue(V_3, out V_4))
                     {
                         continue;
                     }
                     this.AddCastIfNeeded(V_4, V_1.get_Key());
                 }
             }
             finally
             {
                 ((IDisposable)V_2).Dispose();
             }
             V_5 = V_1.get_Value().get_DefinedAt().GetEnumerator();
             try
             {
                 while (V_5.MoveNext())
                 {
                     V_6 = V_5.get_Current();
                     V_7 = this.offsetToExpression.get_Item(V_6);
                     V_8 = this.GetInstructionBlock(V_6);
                     V_9 = this.context.get_MethodContext().get_Expressions().get_BlockExpressions().get_Item(V_8.get_First().get_Offset());
                     this.FixAssignmentInList(V_9, V_7);
                 }
             }
             finally
             {
                 ((IDisposable)V_5).Dispose();
             }
         }
     }
     finally
     {
         ((IDisposable)V_0).Dispose();
     }
     return;
 }
Exemplo n.º 6
0
 private void InitApp(IApi api)
 {
     if (!App._isInitialized)
     {
         V_0 = App._mutex;
         V_1 = false;
         try
         {
             Monitor.Enter(V_0, ref V_1);
             if (!App._isInitialized)
             {
                 stackVariable7 = this._pageTypes;
                 V_2            = api.get_PageTypes().GetAllAsync().GetAwaiter();
                 stackVariable7.Init(V_2.GetResult());
                 stackVariable15 = this._postTypes;
                 V_3             = api.get_PostTypes().GetAllAsync().GetAwaiter();
                 stackVariable15.Init(V_3.GetResult());
                 stackVariable23 = this._siteTypes;
                 V_4             = api.get_SiteTypes().GetAllAsync().GetAwaiter();
                 stackVariable23.Init(V_4.GetResult());
                 V_5 = this._modules.GetEnumerator();
                 try
                 {
                     while (V_5.MoveNext())
                     {
                         V_5.get_Current().get_Instance().Init();
                     }
                 }
                 finally
                 {
                     if (V_5 != null)
                     {
                         V_5.Dispose();
                     }
                 }
                 App._isInitialized = true;
             }
         }
         finally
         {
             if (V_1)
             {
                 Monitor.Exit(V_0);
             }
         }
     }
     return;
 }
Exemplo n.º 7
0
        private bool Precedes(Statement first, Statement second)
        {
            V_0 = this.GetParentsChain(first);
            V_1 = this.GetParentsChain(second);
            V_2 = null;
            while (V_0.Peek() == V_1.Peek())
            {
                V_2       = V_0.Pop();
                dummyVar0 = V_1.Pop();
            }
            if (V_2 as SwitchStatement == null)
            {
                if (V_2 as BlockStatement == null)
                {
                    throw new ArgumentException("No common block found.");
                }
                V_3 = (V_2 as BlockStatement).get_Statements().IndexOf(V_0.Peek());
                V_4 = (V_2 as BlockStatement).get_Statements().IndexOf(V_1.Peek());
                return(V_3 < V_4);
            }
            V_5 = (V_2 as SwitchStatement).get_Cases().GetEnumerator();
            try
            {
                while (V_5.MoveNext())
                {
                    if (V_5.get_Current() != V_0.Peek())
                    {
                        continue;
                    }
                    V_6 = true;
                    goto Label1;
                }
                goto Label0;
            }
            finally
            {
                if (V_5 != null)
                {
                    V_5.Dispose();
                }
            }
Label1:
            return(V_6);

Label0:
            return(false);
        }
Exemplo n.º 8
0
 public BlockStatement Process(DecompilationContext context, BlockStatement body)
 {
     V_0 = new HashSet <Instruction>(body.get_UnderlyingSameMethodInstructions());
     if (context.get_MethodContext().get_IsMethodBodyChanged())
     {
         context.get_MethodContext().get_Method().RefreshBody();
         context.get_MethodContext().set_IsMethodBodyChanged(false);
     }
     V_1 = new List <Instruction>();
     V_2 = context.get_MethodContext().get_Method().get_Body().get_Instructions().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             if (V_0.Contains(V_3))
             {
                 continue;
             }
             V_1.Add(V_3);
         }
     }
     finally
     {
         V_2.Dispose();
     }
     if (V_1.get_Count() > 0)
     {
         V_4 = new StringBuilder("Found unmapped instructions.\n");
         V_5 = V_1.GetEnumerator();
         try
         {
             while (V_5.MoveNext())
             {
                 V_6       = V_5.get_Current();
                 dummyVar0 = V_4.AppendLine(V_6.ToString());
             }
         }
         finally
         {
             ((IDisposable)V_5).Dispose();
         }
         throw new Exception(V_4.ToString());
     }
     return(body);
 }
        public override ICodeNode VisitBlockStatement(BlockStatement node)
        {
            node = (BlockStatement)this.VisitBlockStatement(node);
            if (node == null)
            {
                return(node);
            }
            V_0 = this.GetCodePatterns();
            V_1 = false;
            do
            {
                V_1 = false;
                V_5 = V_0.GetEnumerator();
                try
                {
                    while (V_5.MoveNext())
                    {
                        if (!V_5.get_Current().TryMatch(node.get_Statements(), out V_4, out V_2, out V_3))
                        {
                            continue;
                        }
                        V_1 = true;
                        if (V_2 == null)
                        {
                            this.RemoveRange(node.get_Statements(), V_4, V_3);
                            goto Label0;
                        }
                        else
                        {
                            this.RemoveRangeAndInsert(node, V_4, V_3, V_2);
                            goto Label0;
                        }
                    }
                }
                finally
                {
                    if (V_5 != null)
                    {
                        V_5.Dispose();
                    }
                }
Label0:
            }while (V_1);
            return(node);
        }
Exemplo n.º 10
0
 public override WriterContext GetWriterContext(IMemberDefinition member, ILanguage language)
 {
     V_0            = new AssemblySpecificContext();
     V_1            = new ModuleSpecificContext();
     V_2            = new TypeSpecificContext(Utilities.GetDeclaringTypeOrSelf(member));
     stackVariable8 = this.GetDecompiledType(member, language);
     V_3            = new Dictionary <string, MethodSpecificContext>();
     V_4            = new Dictionary <string, Statement>();
     V_5            = stackVariable8.get_DecompiledMembers().GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6 = V_5.get_Current();
             V_3.Add(V_6.get_Key(), V_6.get_Value().get_Context());
             V_4.Add(V_6.get_Key(), V_6.get_Value().get_Statement());
         }
     }
     finally
     {
         ((IDisposable)V_5).Dispose();
     }
     return(new WriterContext(V_0, V_1, V_2, V_3, V_4));
 }
 private Dictionary <AssemblyNameReference, List <TypeReference> > GetModuleDependsOnAnalysis(ModuleDefinition module)
 {
     stackVariable1 = module.get_Types();
     V_0            = new HashSet <TypeReference>();
     V_3            = stackVariable1.GetEnumerator();
     try
     {
         while (V_3.MoveNext())
         {
             V_4 = V_3.get_Current();
             if (V_0.Contains(V_4))
             {
                 continue;
             }
             dummyVar0 = V_0.Add(V_4);
         }
     }
     finally
     {
         V_3.Dispose();
     }
     V_5 = module.GetTypeReferences().GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6 = V_5.get_Current();
             if (V_0.Contains(V_6))
             {
                 continue;
             }
             dummyVar1 = V_0.Add(V_6);
         }
     }
     finally
     {
         if (V_5 != null)
         {
             V_5.Dispose();
         }
     }
     V_2 = Utilities.GetAssembliesDependingOnToUsedTypesMap(module, Utilities.GetExpandedTypeDependanceList(V_0));
     V_7 = module.get_AssemblyReferences().GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             if (V_2.ContainsKey(V_8))
             {
                 continue;
             }
             V_2.Add(V_8, new List <TypeReference>());
         }
     }
     finally
     {
         V_7.Dispose();
     }
     return(V_2);
 }
Exemplo n.º 12
0
 internal ICollection <ClassHierarchyNode> BuildHierarchy(HashSet <VariableReference> resolvedVariables)
 {
     V_1 = this.methodContext.get_StackData().get_VariableToDefineUseInfo().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_Key();
             if (resolvedVariables.Contains(V_3) || !this.ShouldConsiderVariable(V_3))
             {
                 continue;
             }
             V_4       = this.GetVariableNode(V_3);
             dummyVar0 = this.resultingGraph.Add(V_4);
             V_5       = V_2.get_Value().get_DefinedAt().GetEnumerator();
             try
             {
                 while (V_5.MoveNext())
                 {
                     V_6 = V_5.get_Current();
                     this.OnPhiVariableAssigned(V_6, V_4);
                 }
             }
             finally
             {
                 ((IDisposable)V_5).Dispose();
             }
             V_7 = V_2.get_Value().get_UsedAt().GetEnumerator();
             try
             {
                 while (V_7.MoveNext())
                 {
                     V_8 = V_7.get_Current();
                     this.OnPhiVariableUsed(V_8, V_4);
                 }
             }
             finally
             {
                 ((IDisposable)V_7).Dispose();
             }
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     this.RemoveImpossibleEdges();
     V_0 = new HashSet <ClassHierarchyNode>();
     V_9 = this.resultingGraph.GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             if (!V_10.get_IsHardNode())
             {
                 continue;
             }
             dummyVar1 = V_0.Add(V_10);
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     this.BuildUpHardNodesHierarchy(V_0);
     return(this.resultingGraph);
 }
 private List <Expression> AddAllParameters(CatchClause catchClause, MethodDefinition method, VariableDeclarationExpression variable)
 {
     V_0 = new List <Expression>();
     method.get_Parameters().Add(this.CreateParameter("JustDecompileGenerated_Exception", variable.get_Variable().get_VariableType()));
     V_0.Add(new UnaryExpression(7, new VariableReferenceExpression(variable.get_Variable(), null), null));
     if (this.catchClausesUsedVariablesMap.ContainsKey(catchClause))
     {
         V_1 = this.catchClausesUsedVariablesMap.get_Item(catchClause).GetEnumerator();
         try
         {
             while (V_1.MoveNext())
             {
                 V_2 = V_1.get_Current();
                 if (!this.variablesUsedOutsideFilters.Contains(V_2) || (object)V_2 == (object)variable.get_Variable())
                 {
                     continue;
                 }
                 if (this.context.get_MethodContext().get_VariablesToRename().Contains(V_2))
                 {
                     stackVariable72 = null;
                 }
                 else
                 {
                     stackVariable72 = V_2.get_Name();
                 }
                 V_3 = stackVariable72;
                 V_4 = this.CreateParameter(V_3, V_2.get_VariableType());
                 if (V_3 == null)
                 {
                     if (!this.catchClausesVariablesToParametersMap.ContainsKey(catchClause))
                     {
                         this.catchClausesVariablesToParametersMap.Add(catchClause, new Dictionary <VariableDefinition, ParameterDefinition>());
                     }
                     this.catchClausesVariablesToParametersMap.get_Item(catchClause).Add(V_2, V_4);
                 }
                 method.get_Parameters().Add(V_4);
                 V_0.Add(new UnaryExpression(7, new VariableReferenceExpression(V_2, null), null));
             }
         }
         finally
         {
             ((IDisposable)V_1).Dispose();
         }
     }
     if (this.catchClausesUsedParametersMap.ContainsKey(catchClause))
     {
         V_5 = this.catchClausesUsedParametersMap.get_Item(catchClause).GetEnumerator();
         try
         {
             while (V_5.MoveNext())
             {
                 V_6 = V_5.get_Current();
                 method.get_Parameters().Add(this.CreateParameter(V_6.get_Name(), V_6.get_ParameterType()));
                 V_0.Add(new UnaryExpression(7, new ArgumentReferenceExpression(V_6, null), null));
             }
         }
         finally
         {
             ((IDisposable)V_5).Dispose();
         }
     }
     return(V_0);
 }
		public static ICollection<TypeReference> GetAssemblyAttributesUsedTypes(AssemblyDefinition assembly)
		{
			V_0 = new List<TypeReference>();
			V_1 = new List<ICustomAttribute>();
			V_1.Add(AttributesUtilities.GetAssemblyVersionAttribute(assembly));
			V_3 = assembly.get_CustomAttributes().GetEnumerator();
			try
			{
				while (V_3.MoveNext())
				{
					V_4 = V_3.get_Current();
					V_4.Resolve();
					V_1.Add(V_4);
				}
			}
			finally
			{
				V_3.Dispose();
			}
			if (assembly.get_HasSecurityDeclarations())
			{
				V_5 = assembly.get_SecurityDeclarations().GetEnumerator();
				try
				{
					while (V_5.MoveNext())
					{
						V_6 = V_5.get_Current();
						if (!V_6.get_HasSecurityAttributes())
						{
							continue;
						}
						V_7 = V_6.get_SecurityAttributes().GetEnumerator();
						try
						{
							while (V_7.MoveNext())
							{
								V_8 = V_7.get_Current();
								V_1.Add(V_8);
							}
						}
						finally
						{
							V_7.Dispose();
						}
					}
				}
				finally
				{
					V_5.Dispose();
				}
			}
			if (assembly.get_MainModule().get_HasExportedTypes())
			{
				V_9 = assembly.get_MainModule().get_ExportedTypes().GetEnumerator();
				try
				{
					while (V_9.MoveNext())
					{
						V_10 = V_9.get_Current();
						if (V_10.get_Scope() as ModuleReference != null)
						{
							continue;
						}
						V_1.Add(AttributesUtilities.GetExportedTypeAttribute(V_10, assembly.get_MainModule()));
					}
				}
				finally
				{
					V_9.Dispose();
				}
			}
			V_11 = V_1.GetEnumerator();
			try
			{
				while (V_11.MoveNext())
				{
					V_12 = V_11.get_Current();
					if (V_12 as CustomAttribute == null)
					{
						if (V_12 as SecurityAttribute == null)
						{
							continue;
						}
						V_13 = AttributesUtilities.GetSecurityAttributeUsedTypes(V_12 as SecurityAttribute).GetEnumerator();
						try
						{
							while (V_13.MoveNext())
							{
								V_15 = V_13.get_Current();
								V_0.Add(V_15);
							}
						}
						finally
						{
							if (V_13 != null)
							{
								V_13.Dispose();
							}
						}
					}
					else
					{
						V_13 = AttributesUtilities.GetCustomAttributeUsedTypes(V_12 as CustomAttribute).GetEnumerator();
						try
						{
							while (V_13.MoveNext())
							{
								V_14 = V_13.get_Current();
								V_0.Add(V_14);
							}
						}
						finally
						{
							if (V_13 != null)
							{
								V_13.Dispose();
							}
						}
					}
				}
			}
			finally
			{
				((IDisposable)V_11).Dispose();
			}
			return V_0;
		}
Exemplo n.º 15
0
 internal void RemoveBlockAt(int index)
 {
     V_0 = this.get_Blocks()[index];
     V_1 = V_0.get_Last().get_Next();
     if (V_0.get_Predecessors().get_Count() > 0)
     {
         throw new Exception("The block to be removed cannot have predecessors");
     }
     V_2 = this.get_Blocks();
     this.set_Blocks(new InstructionBlock[(int)this.get_Blocks().Length - 1]);
     V_3 = 0;
     while (V_3 < (int)this.get_Blocks().Length)
     {
         if (V_3 >= index)
         {
             stackVariable29 = 1;
         }
         else
         {
             stackVariable29 = 0;
         }
         V_4 = stackVariable29;
         this.get_Blocks()[V_3] = V_2[V_3 + V_4];
         this.get_Blocks()[V_3].set_Index(V_3);
         dummyVar0 = this.get_Blocks()[V_3].get_Predecessors().Remove(V_0);
         if ((object)this.get_Blocks()[V_3].get_First().get_Previous() == (object)V_0.get_Last())
         {
             this.get_Blocks()[V_3].get_First().set_Previous(V_0.get_First().get_Previous());
         }
         if ((object)this.get_Blocks()[V_3].get_Last().get_Next() == (object)V_0.get_First())
         {
             this.get_Blocks()[V_3].get_Last().set_Next(V_0.get_Last().get_Next());
         }
         V_3 = V_3 + 1;
     }
     dummyVar1 = this.get_InstructionToBlockMapping().Remove(V_0.get_First().get_Offset());
     dummyVar2 = this.get_SwitchBlocksInformation().Remove(V_0);
     V_0.set_Successors(new InstructionBlock[0]);
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6       = V_5.get_Current();
             dummyVar3 = this.get_OffsetToInstruction().Remove(V_6.get_Offset());
         }
     }
     finally
     {
         if (V_5 != null)
         {
             V_5.Dispose();
         }
     }
     V_7 = this.get_MethodBody().get_ExceptionHandlers().GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             if ((object)V_8.get_TryStart() == (object)V_0.get_First())
             {
                 V_8.set_TryStart(V_1);
             }
             if ((object)V_8.get_TryEnd() == (object)V_0.get_First())
             {
                 V_8.set_TryEnd(V_1);
             }
             if ((object)V_8.get_HandlerStart() == (object)V_0.get_First())
             {
                 V_8.set_HandlerStart(V_1);
             }
             if ((object)V_8.get_HandlerEnd() == (object)V_0.get_First())
             {
                 V_8.set_HandlerEnd(V_1);
             }
             if ((object)V_8.get_FilterStart() == (object)V_0.get_First())
             {
                 V_8.set_FilterStart(V_1);
             }
             if ((object)V_8.get_FilterEnd() != (object)V_0.get_First())
             {
                 continue;
             }
             V_8.set_FilterEnd(V_1);
         }
     }
     finally
     {
         V_7.Dispose();
     }
     V_0.set_Index(-1);
     return;
 }
Exemplo n.º 16
0
        private bool MergeWithLowestCommonAncestor()
        {
            V_0 = false;
            V_1 = null;
            V_2 = this.inferenceGraph.GetEnumerator();
            try
            {
                while (V_2.MoveNext())
                {
                    V_3 = V_2.get_Current();
                    if (V_3.get_IsHardNode())
                    {
                        continue;
                    }
                    V_0 = true;
                    V_4 = new HashSet <ClassHierarchyNode>();
                    V_5 = V_3.get_SubTypes().GetEnumerator();
                    try
                    {
                        while (V_5.MoveNext())
                        {
                            V_6 = V_5.get_Current();
                            if (V_6.get_IsClassNode())
                            {
                                dummyVar0 = V_4.Add(V_6);
                            }
                            else
                            {
                                V_0 = false;
                                goto Label1;
                            }
                        }
                    }
                    finally
                    {
                        if (V_5 != null)
                        {
                            V_5.Dispose();
                        }
                    }
Label1:
                    if (!V_0)
                    {
                        continue;
                    }
                    V_7 = this.FindLowestCommonAncestor(V_4);
                    if (V_7 == null || V_7 == V_3)
                    {
                        V_0 = false;
                    }
                    else
                    {
                        stackVariable35    = new ClassHierarchyNode[2];
                        stackVariable35[0] = V_7;
                        stackVariable35[1] = V_3;
                        V_1 = stackVariable35;
                        goto Label0;
                    }
                }
            }
            finally
            {
                if (V_2 != null)
                {
                    V_2.Dispose();
                }
            }
Label0:
            if (V_0)
            {
                this.MergeNodes(V_1);
            }
            return(V_0);
        }
        public void FixCases(SwitchStatement theSwitch)
        {
            V_0 = new FixSwitchCasesStep.u003cu003ec__DisplayClass0_0();
            V_1 = theSwitch.get_Cases().LastOrDefault <SwitchCase>() as DefaultCase;
            V_2 = 0;
            V_3 = null;
            if (V_1 != null && !this.TryGetSimpleCaseStatementType(V_1, out V_2, out V_3))
            {
                return;
            }
            V_0.casesToRemove = new HashSet <SwitchCase>();
            V_4 = new List <SwitchCase>(theSwitch.get_Cases());
            V_5 = V_4.GetEnumerator();
            try
            {
                while (V_5.MoveNext())
                {
                    V_6 = V_5.get_Current();
                    if (V_6 != V_1)
                    {
                        if (V_6.get_Body() != null)
                        {
                            if (this.TryGetSimpleCaseStatementType(V_6, out V_7, out V_8))
                            {
                                if (V_1 == null)
                                {
                                    if (V_7 == 2)
                                    {
                                        dummyVar2 = V_0.casesToRemove.Add(V_6);
                                        goto Label0;
                                    }
                                }
                                else
                                {
                                    if (V_2 == V_7 && String.op_Equality(V_3, V_8))
                                    {
                                        dummyVar1 = V_0.casesToRemove.Add(V_6);
                                        goto Label0;
                                    }
                                }
                            }
                            V_0.casesToRemove.Clear();
                        }
                        else
                        {
                            dummyVar0 = V_0.casesToRemove.Add(V_6);
                        }
                    }
                    else
                    {
                        goto Label0;
                    }
                }
            }
            finally
            {
                ((IDisposable)V_5).Dispose();
            }
Label0:
            if (V_0.casesToRemove.get_Count() > 0)
            {
                theSwitch.set_Cases(V_4.Where <SwitchCase>(new Func <SwitchCase, bool>(V_0.u003cFixCasesu003eb__0)));
            }
            return;
        }
Exemplo n.º 18
0
        private bool GetBuilderField()
        {
            stackVariable2 = this.GetStateMachineMethod("SetStateMachine");
            if (stackVariable2 == null)
            {
                dummyVar0      = stackVariable2;
                stackVariable2 = this.GetStateMachineMethod("System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine");
            }
            V_0 = stackVariable2;
            if (V_0 == null || V_0.get_Body() == null)
            {
                return(false);
            }
            if (V_0.get_Body().get_Instructions().get_Count() <= 1)
            {
                V_5 = this.stateMachineTypeDef.get_Fields().GetEnumerator();
                try
                {
                    while (V_5.MoveNext())
                    {
                        V_6 = V_5.get_Current();
                        if (!String.op_Equality(V_6.get_FieldType().get_Name(), "AsyncVoidMethodBuilder") && !String.op_Equality(V_6.get_FieldType().get_Name(), "AsyncTaskMethodBuilder") && !String.op_Equality(V_6.get_FieldType().get_Name(), "AsyncTaskMethodBuilder`1"))
                        {
                            continue;
                        }
                        this.builderField = V_6;
                        V_4 = true;
                        goto Label1;
                    }
                    goto Label0;
                }
                finally
                {
                    V_5.Dispose();
                }
            }
            else
            {
                V_1 = V_0.get_Body().get_Instructions().GetEnumerator();
                try
                {
                    while (V_1.MoveNext())
                    {
                        V_2 = V_1.get_Current();
                        if (V_2.get_OpCode().get_Code() != 121)
                        {
                            continue;
                        }
                        this.builderField = ((FieldReference)V_2.get_Operand()).Resolve();
                        V_4 = true;
                        goto Label1;
                    }
                    goto Label0;
                }
                finally
                {
                    V_1.Dispose();
                }
            }
Label1:
            return(V_4);

Label0:
            return(false);
        }
Exemplo n.º 19
0
 protected void DecompileConstructorChain(MethodDefinition method, ILanguage language, DecompiledType decompiledType)
 {
     if (this.cacheService.IsDecompiledMemberInCache(method, language, this.renameInvalidMembers))
     {
         V_3 = this.cacheService.GetDecompiledMemberFromCache(method, language, this.renameInvalidMembers);
         this.AddDecompiledMemberToDecompiledType(V_3, decompiledType);
         BaseWriterContextService.AddAssignmentDataToDecompiledType(V_3, decompiledType);
         return;
     }
     if (method.get_Body() == null)
     {
         V_4 = new CachedDecompiledMember(new DecompiledMember(Utilities.GetMemberUniqueName(method), null, null));
         this.cacheService.AddDecompiledMemberToCache(method, language, this.renameInvalidMembers, V_4);
         return;
     }
     V_0 = this.DecompileMethod(language, method, decompiledType.get_TypeContext().ShallowPartialClone());
     V_1 = new List <CachedDecompiledMember>();
     V_2 = method.get_DeclaringType();
     if (!method.get_IsStatic())
     {
         V_5 = V_2.get_Methods().GetEnumerator();
         try
         {
             while (V_5.MoveNext())
             {
                 V_6 = V_5.get_Current();
                 if (!V_6.get_IsConstructor() || String.op_Equality(V_6.get_FullName(), V_0.get_Member().get_MemberFullName()) || V_6.get_IsStatic())
                 {
                     continue;
                 }
                 if (V_6.get_Body() != null)
                 {
                     V_1.Add(this.DecompileMethod(language, V_6, decompiledType.get_TypeContext().ShallowPartialClone()));
                 }
                 else
                 {
                     V_7 = new CachedDecompiledMember(new DecompiledMember(Utilities.GetMemberUniqueName(V_6), null, null));
                     V_1.Add(V_7);
                 }
             }
         }
         finally
         {
             V_5.Dispose();
         }
         V_1.Add(V_0);
         this.MergeConstructorsTypeContexts(V_1, decompiledType);
         V_8 = V_1.GetEnumerator();
         try
         {
             while (V_8.MoveNext())
             {
                 V_9             = new BaseWriterContextService.u003cu003ec__DisplayClass15_0();
                 V_9.constructor = V_8.get_Current();
                 if (language as IntermediateLanguage == null)
                 {
                     this.RemoveBaseCtorInvocationStatements(V_9.constructor, decompiledType);
                 }
                 if (V_9.constructor.get_Member().get_Context() != null)
                 {
                     if (!this.cacheService.IsDecompiledMemberInCache(V_9.constructor.get_Member().get_Context().get_Method(), language, this.renameInvalidMembers))
                     {
                         this.cacheService.AddDecompiledMemberToCache(V_9.constructor.get_Member().get_Context().get_Method(), language, this.renameInvalidMembers, V_9.constructor);
                     }
                 }
                 else
                 {
                     V_10 = decompiledType.get_Type().get_Methods().First <MethodDefinition>(new Func <MethodDefinition, bool>(V_9.u003cDecompileConstructorChainu003eb__0));
                     if (!this.cacheService.IsDecompiledMemberInCache(V_10, language, this.renameInvalidMembers))
                     {
                         this.cacheService.AddDecompiledMemberToCache(V_10, language, this.renameInvalidMembers, V_9.constructor);
                     }
                 }
                 this.AddDecompiledMemberToDecompiledType(V_9.constructor, decompiledType);
             }
         }
         finally
         {
             ((IDisposable)V_8).Dispose();
         }
     }
     return;
 }
Exemplo n.º 20
0
		public override void ExpandView(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
		{
			V_0 = new SyncViewModel.u003cu003ec__DisplayClass178_0();
			V_0.u003cu003e4__this = this;
			V_0._context = _context;
			V_0._transaction = _transaction;
			if (this.get_Id() == 0)
			{
				this.set_ExtraFields(MixService.GetConfig<string>("DefaultPostAttr"));
			}
			this.set_Cultures(this.LoadCultures(this.get_Specificulture(), V_0._context, V_0._transaction));
			this.set_UrlAliases(this.GetAliases(V_0._context, V_0._transaction));
			if (!string.IsNullOrEmpty(this.get_Tags()))
			{
				this.set_ListTag(JArray.Parse(this.get_Tags()));
			}
			this.set_Columns(new List<ModuleFieldViewModel>());
			if (!string.IsNullOrEmpty(this.get_ExtraFields()))
			{
				stackVariable35 = JArray.Parse(this.get_ExtraFields());
			}
			else
			{
				stackVariable35 = new JArray();
			}
			V_5 = stackVariable35.GetEnumerator();
			try
			{
				while (V_5.MoveNext())
				{
					V_6 = V_5.get_Current();
					stackVariable41 = new ModuleFieldViewModel();
					stackVariable41.set_Name(CommonHelper.ParseJsonPropertyName(V_6.get_Item("name").ToString()));
					stackVariable49 = V_6.get_Item("title");
					if (stackVariable49 != null)
					{
						stackVariable50 = stackVariable49.ToString();
					}
					else
					{
						dummyVar0 = stackVariable49;
						stackVariable50 = null;
					}
					stackVariable41.set_Title(stackVariable50);
					if (V_6.get_Item("options") != null)
					{
						stackVariable57 = Newtonsoft.Json.Linq.Extensions.Value<JArray>(V_6.get_Item("options"));
					}
					else
					{
						stackVariable57 = new JArray();
					}
					stackVariable41.set_Options(stackVariable57);
					if (V_6.get_Item("priority") != null)
					{
						stackVariable64 = Newtonsoft.Json.Linq.Extensions.Value<int>(V_6.get_Item("priority"));
					}
					else
					{
						stackVariable64 = 0;
					}
					stackVariable41.set_Priority(stackVariable64);
					stackVariable41.set_DataType(JToken.op_Explicit(V_6.get_Item("dataType")));
					if (V_6.get_Item("width") != null)
					{
						stackVariable75 = Newtonsoft.Json.Linq.Extensions.Value<int>(V_6.get_Item("width"));
					}
					else
					{
						stackVariable75 = 3;
					}
					stackVariable41.set_Width(stackVariable75);
					if (V_6.get_Item("isUnique") != null)
					{
						stackVariable82 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isUnique"));
					}
					else
					{
						stackVariable82 = true;
					}
					stackVariable41.set_IsUnique(stackVariable82);
					if (V_6.get_Item("isRequired") != null)
					{
						stackVariable89 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isRequired"));
					}
					else
					{
						stackVariable89 = true;
					}
					stackVariable41.set_IsRequired(stackVariable89);
					if (V_6.get_Item("isDisplay") != null)
					{
						stackVariable96 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isDisplay"));
					}
					else
					{
						stackVariable96 = true;
					}
					stackVariable41.set_IsDisplay(stackVariable96);
					if (V_6.get_Item("isSelect") != null)
					{
						stackVariable103 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isSelect"));
					}
					else
					{
						stackVariable103 = false;
					}
					stackVariable41.set_IsSelect(stackVariable103);
					if (V_6.get_Item("isGroupBy") != null)
					{
						stackVariable110 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isGroupBy"));
					}
					else
					{
						stackVariable110 = false;
					}
					stackVariable41.set_IsGroupBy(stackVariable110);
					this.get_Columns().Add(stackVariable41);
				}
			}
			finally
			{
				if (V_5 != null)
				{
					V_5.Dispose();
				}
			}
			this.set_Properties(new List<ExtraProperty>());
			if (!string.IsNullOrEmpty(this.get_ExtraProperties()))
			{
				V_5 = JArray.Parse(this.get_ExtraProperties()).GetEnumerator();
				try
				{
					while (V_5.MoveNext())
					{
						V_8 = V_5.get_Current();
						this.get_Properties().Add(V_8.ToObject<ExtraProperty>());
					}
				}
				finally
				{
					if (V_5 != null)
					{
						V_5.Dispose();
					}
				}
			}
			stackVariable121 = this.get_Templates();
			if (stackVariable121 == null)
			{
				dummyVar1 = stackVariable121;
				stackVariable686 = ViewModelBase<MixCmsContext, MixTemplate, Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>.Repository;
				V_9 = Expression.Parameter(System.Type.GetTypeFromHandle(// 
Exemplo n.º 21
0
 private void RedirectConstraints()
 {
     V_0 = new List <KeyValuePair <ClassHierarchyNode, ClassHierarchyNode> >();
     V_1 = this.get_ContainedNodes().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_CanAssignTo().GetEnumerator();
             try
             {
                 while (V_3.MoveNext())
                 {
                     V_4 = V_3.get_Current();
                     if (this.get_ContainedNodes().Contains(V_4))
                     {
                         continue;
                     }
                     if (!V_4.get_IsHardNode() || !V_4.get_NodeType().get_IsPrimitive() || !V_2.get_IsHardNode() || this.IsAssignable(V_2.get_NodeType(), V_4.get_NodeType()))
                     {
                         V_0.Add(new KeyValuePair <ClassHierarchyNode, ClassHierarchyNode>(V_2, V_4));
                     }
                     else
                     {
                         dummyVar0 = V_4.get_SubTypes().Remove(V_2);
                     }
                 }
             }
             finally
             {
                 if (V_3 != null)
                 {
                     V_3.Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6 = V_5.get_Current();
             V_7 = V_6.get_Key();
             V_8 = V_6.get_Value();
             this.get_CanAssignTo().Add(V_8);
             dummyVar1 = V_7.get_CanAssignTo().Remove(V_8);
             dummyVar2 = V_8.get_SubTypes().Remove(V_7);
             if (V_8.get_SubTypes().Contains(this))
             {
                 continue;
             }
             V_8.get_SubTypes().Add(this);
         }
     }
     finally
     {
         ((IDisposable)V_5).Dispose();
     }
     V_0 = new List <KeyValuePair <ClassHierarchyNode, ClassHierarchyNode> >();
     V_1 = this.get_ContainedNodes().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_9 = V_1.get_Current();
             V_3 = V_9.get_SubTypes().GetEnumerator();
             try
             {
                 while (V_3.MoveNext())
                 {
                     V_10 = V_3.get_Current();
                     if (this.get_ContainedNodes().Contains(V_10))
                     {
                         continue;
                     }
                     if (!V_10.get_IsHardNode() || !V_10.get_NodeType().get_IsPrimitive() || !V_9.get_IsHardNode() || this.IsAssignable(V_10.get_NodeType(), V_9.get_NodeType()))
                     {
                         V_0.Add(new KeyValuePair <ClassHierarchyNode, ClassHierarchyNode>(V_9, V_10));
                     }
                     else
                     {
                         dummyVar3 = V_10.get_CanAssignTo().Remove(V_9);
                     }
                 }
             }
             finally
             {
                 if (V_3 != null)
                 {
                     V_3.Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_11 = V_5.get_Current();
             V_12 = V_11.get_Key();
             V_13 = V_11.get_Value();
             this.get_SubTypes().Add(V_13);
             dummyVar4 = V_12.get_SubTypes().Remove(V_13);
             dummyVar5 = V_13.get_CanAssignTo().Remove(V_12);
             if (V_13.get_CanAssignTo().Contains(this))
             {
                 continue;
             }
             V_13.get_CanAssignTo().Add(this);
         }
     }
     finally
     {
         ((IDisposable)V_5).Dispose();
     }
     return;
 }