コード例 #1
0
 public int WriteParameterAttributes(ParameterDefinition parameter, bool isWinRTMethodImplementation)
 {
     if (isWinRTMethodImplementation)
     {
         stackVariable1 = null;
     }
     else
     {
         stackVariable1 = this.GetInAttribute(parameter);
     }
     V_0 = stackVariable1;
     if (isWinRTMethodImplementation)
     {
         stackVariable3 = null;
     }
     else
     {
         stackVariable3 = this.GetOutAttribute(parameter);
     }
     V_1 = stackVariable3;
     V_2 = new List <CustomAttribute>();
     if (V_0 != null)
     {
         V_2.Add(V_0);
     }
     if (V_1 != null)
     {
         V_2.Add(V_1);
     }
     V_2.AddRange(parameter.get_CustomAttributes());
     V_3 = 0;
     V_4 = V_2.GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (this.attributesNotToShow.Contains(V_5.get_AttributeType().get_FullName()))
             {
                 continue;
             }
             if (V_3 != 0)
             {
                 this.genericWriter.Write(this.get_ParameterAttributeSeparator());
             }
             this.WriteAttribute(V_5, true, false);
             V_3 = V_3 + 1;
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return(V_3);
 }
コード例 #2
0
 protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedCFGBlocks, LogicalFlowBuilderContext context)
 {
     V_0       = new StringBuilder(this.GetType().get_Name());
     dummyVar0 = V_0.AppendLine();
     dummyVar1 = V_0.AppendLine("{");
     this.IndentAndAppendString(V_0, (this.get_Entry() as LogicalConstructBase).ToString(context));
     dummyVar2 = V_0.AppendLine();
     if (this.get_DefaultCase() != null)
     {
         this.IndentAndAppendString(V_0, this.get_DefaultCase().ToString(context));
     }
     V_1 = this.get_ConditionCases();
     V_2 = 0;
     while (V_2 < (int)V_1.Length)
     {
         this.IndentAndAppendString(V_0, V_1[V_2].ToString(context));
         V_2 = V_2 + 1;
     }
     V_4 = this.get_NonDominatedCFGSuccessors().GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5       = V_4.get_Current();
             dummyVar3 = V_0.Append("\tCase");
             V_6       = V_5.get_Key().GetEnumerator();
             try
             {
                 while (V_6.MoveNext())
                 {
                     V_7       = V_6.get_Current();
                     dummyVar4 = V_0.Append(" ").Append(V_7);
                 }
             }
             finally
             {
                 ((IDisposable)V_6).Dispose();
             }
             dummyVar5 = V_0.Append(": ").AppendLine(this.NodeILOffset(context, V_5.get_Value()));
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     if (this.get_DefaultCase() == null)
     {
         dummyVar6 = V_0.Append("\tDefault: ").AppendLine(this.NodeILOffset(context, this.get_DefaultCFGSuccessor()));
     }
     dummyVar7 = V_0.Append("\tFollowNode: ").AppendLine(this.NodeILOffset(context, this.get_CFGFollowNode()));
     dummyVar8 = V_0.AppendLine("}");
     printedCFGBlocks.UnionWith(this.get_CFGBlocks());
     return(V_0.ToString());
 }
コード例 #3
0
		private void GenerateStackData()
		{
			V_0 = new StackUsageData();
			V_1 = this.instructionOffsetToUsedInstructionsMap.GetEnumerator();
			try
			{
				while (V_1.MoveNext())
				{
					V_2 = V_1.get_Current();
					V_3 = new List<VariableDefinition>(V_2.get_Value().Select<int, VariableDefinition>(new Func<int, VariableDefinition>(this.u003cGenerateStackDatau003eb__25_0)));
					V_0.get_InstructionOffsetToUsedStackVariablesMap().set_Item(V_2.get_Key(), V_3);
					V_4 = V_3.GetEnumerator();
					try
					{
						while (V_4.MoveNext())
						{
							V_5 = V_4.get_Current();
							this.GetDefineUseInfo(V_0, V_5).get_UsedAt().Add(V_2.get_Key());
						}
					}
					finally
					{
						((IDisposable)V_4).Dispose();
					}
				}
			}
			finally
			{
				((IDisposable)V_1).Dispose();
			}
			V_6 = this.instructionOffsetToVariableDefinitionMap.GetEnumerator();
			try
			{
				while (V_6.MoveNext())
				{
					V_7 = V_6.get_Current();
					if (V_7.get_Key() >= 0)
					{
						V_0.get_InstructionOffsetToAssignedVariableMap().Add(V_7.get_Key(), V_7.get_Value());
						dummyVar0 = this.GetDefineUseInfo(V_0, V_7.get_Value()).get_DefinedAt().Add(V_7.get_Key());
					}
					else
					{
						V_0.get_ExceptionHandlerStartToExceptionVariableMap().Add(-V_7.get_Key(), V_7.get_Value());
					}
				}
			}
			finally
			{
				((IDisposable)V_6).Dispose();
			}
			this.methodContext.set_StackData(V_0);
			return;
		}
コード例 #4
0
        public IEnumerable <ICollection <ClassHierarchyNode> > GetConnectedComponents()
        {
            do
            {
                V_0 = null;
                V_2 = this.inferenceGraph.GetEnumerator();
                try
                {
                    while (V_2.MoveNext())
                    {
                        V_3 = V_2.get_Current();
                        if (this.used.ContainsKey(V_3))
                        {
                            continue;
                        }
                        V_0 = V_3;
                        goto Label0;
                    }
                }
                finally
                {
                    if (V_2 != null)
                    {
                        V_2.Dispose();
                    }
                }
Label0:
                if (V_0 == null)
                {
                    continue;
                }
                this.RecursiveDfs(V_0);
            }while (V_0 != null);
            V_1 = new ICollection <ClassHierarchyNode> [this.componentCount];
            V_4 = this.nodeToComponent.get_Keys().GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_5 = V_4.get_Current();
                    V_6 = this.nodeToComponent.get_Item(V_5);
                    if (V_1[V_6] == null)
                    {
                        V_1[V_6] = new List <ClassHierarchyNode>();
                    }
                    ((List <ClassHierarchyNode>)V_1[V_6]).Add(V_5);
                }
            }
            finally
            {
                ((IDisposable)V_4).Dispose();
            }
            return(V_1);
        }
コード例 #5
0
 private Statement FixSwitchingStatement(Statement statement)
 {
     if (statement as SwitchStatement == null)
     {
         if (statement as IfElseIfStatement != null)
         {
             V_4 = (statement as IfElseIfStatement).get_ConditionBlocks().GetEnumerator();
             try
             {
                 while (V_4.MoveNext())
                 {
                     V_5 = V_4.get_Current();
                     this.FixConditionExpression(V_5.get_Key() as BinaryExpression);
                 }
             }
             finally
             {
                 ((IDisposable)V_4).Dispose();
             }
         }
     }
     else
     {
         V_0 = statement as SwitchStatement;
         if (V_0.get_Condition().Equals(this.theIntVariable))
         {
             V_0.set_Condition(this.theStringVariable.CloneExpressionOnly());
         }
         V_1 = V_0.get_Cases().GetEnumerator();
         try
         {
             while (V_1.MoveNext())
             {
                 V_2 = V_1.get_Current();
                 if (V_2 as ConditionCase == null)
                 {
                     continue;
                 }
                 stackVariable34 = V_2 as ConditionCase;
                 V_3             = (Int32)(stackVariable34.get_Condition() as LiteralExpression).get_Value();
                 stackVariable34.set_Condition(new LiteralExpression(this.valueDictionary.get_Item(V_3), this.theTypeSystem, null));
             }
         }
         finally
         {
             if (V_1 != null)
             {
                 V_1.Dispose();
             }
         }
     }
     return(statement);
 }
コード例 #6
0
 private Dictionary <string, List <string> > GetModuleCollisionTypesData(ModuleDefinition module, ILanguage language)
 {
     V_0 = new Dictionary <string, List <string> >(language.get_IdentifierComparer());
     V_1 = new Dictionary <string, string>(language.get_IdentifierComparer());
     this.UpdateCollisionTypesDataWithTypes(V_0, V_1, module.get_Types());
     V_2 = this.GetModuleDependsOnAnalysis(module);
     if (Mono.Cecil.AssemblyResolver.Extensions.IsReferenceAssembly(module))
     {
         stackVariable16 = 1;
     }
     else
     {
         stackVariable16 = 0;
     }
     V_3 = stackVariable16;
     V_4 = V_2.get_Keys().GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             V_6 = module.get_AssemblyResolver().Resolve(V_5, "", ModuleDefinitionExtensions.GetModuleArchitecture(module), V_3, true);
             if (V_6 == null)
             {
                 this.UpdateCollisionTypesDataWithTypes(V_0, V_1, V_2.get_Item(V_5));
             }
             else
             {
                 V_7 = V_6.get_Modules().GetEnumerator();
                 try
                 {
                     while (V_7.MoveNext())
                     {
                         V_8 = V_7.get_Current();
                         this.UpdateCollisionTypesDataWithTypes(V_0, V_1, V_8.get_Types());
                     }
                 }
                 finally
                 {
                     V_7.Dispose();
                 }
             }
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return(V_0);
 }
コード例 #7
0
        private void ProcessLogicalConstruct(ILogicalConstruct construct)
        {
            V_0 = this.GetDominatorTreeFromContext(construct);
            V_1 = 0x7fffffff;
            this.RemoveBackEdgesFromSwitchConstructs(construct);
            while (V_1 > 1)
            {
                V_2             = (new IntervalAnalyzer(construct, this.removedEdges)).ReduceCfg();
                stackVariable14 = new List <IntervalConstruct>(V_2);
                stackVariable14.Reverse();
                V_3 = false;
                V_4 = stackVariable14.GetEnumerator();
                try
                {
                    while (V_4.MoveNext())
                    {
                        V_5 = V_4.get_Current();
                        if (!this.TryMakeLoop(V_5, V_0))
                        {
                            continue;
                        }
                        V_3 = true;
                        goto Label0;
                    }
                }
                finally
                {
                    ((IDisposable)V_4).Dispose();
                }
Label0:
                if (!V_3)
                {
                    if (V_2.get_Count() == V_1)
                    {
                        this.RemoveBlockingEdges(V_2);
                    }
                    if (V_2.get_Count() > V_1)
                    {
                        throw new Exception("Intervails are more than in the last iteration.");
                    }
                    V_1 = V_2.get_Count();
                }
                else
                {
                    V_1 = V_2.get_Count();
                }
            }
            return;
        }
コード例 #8
0
 private List <KeyValuePair <int, int> > MaximumWeightBipartiteGraphMatching()
 {
     this.Initialization();
     while (true)
     {
         this.GenerateExcessMatrixAndEqualitySubgraph();
         V_0 = this.FindMaximumCardianlityMatching();
         if (V_0.get_Count() == this.size)
         {
             break;
         }
         V_1 = this.MinimumVertexCover(V_0);
         V_2 = this.GetMinElement(V_1);
         V_6 = 0;
         while (V_6 < this.size)
         {
             if (!V_1[V_6])
             {
                 stackVariable40 = &this.u[V_6];
                 stackVariable40 = stackVariable40 - V_2;
             }
             if (V_1[V_6 + this.size])
             {
                 stackVariable33 = &this.v[V_6];
                 stackVariable33 = stackVariable33 + V_2;
             }
             V_6 = V_6 + 1;
         }
     }
     V_3 = new List <KeyValuePair <int, int> >();
     V_4 = V_0.GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (this.graph[V_5.get_Key(), V_5.get_Value() - this.size] == 0)
             {
                 continue;
             }
             V_3.Add(new KeyValuePair <int, int>(V_5.get_Key(), V_5.get_Value() - this.size));
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return(V_3);
 }
コード例 #9
0
 private void FindReachableBlocks()
 {
     this.GetGuardedBlockToExceptionHandlersMap();
     stackVariable3    = new InstructionBlock[1];
     stackVariable3[0] = this.theCFG.get_Blocks()[0];
     this.GetReachableBlocks(stackVariable3);
     while (true)
     {
         V_0 = new List <InstructionBlock>();
         V_1 = new List <InstructionBlock>();
         V_2 = this.guardedBlockToExceptionHandler.GetEnumerator();
         try
         {
             while (V_2.MoveNext())
             {
                 V_3 = V_2.get_Current();
                 if (!this.reachableBlocks.Contains(V_3.get_Key()))
                 {
                     continue;
                 }
                 V_0.Add(V_3.get_Key());
                 V_1.AddRange(V_3.get_Value());
             }
         }
         finally
         {
             ((IDisposable)V_2).Dispose();
         }
         if (V_0.get_Count() == 0)
         {
             break;
         }
         V_4 = V_0.GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5       = V_4.get_Current();
                 dummyVar0 = this.guardedBlockToExceptionHandler.Remove(V_5);
             }
         }
         finally
         {
             ((IDisposable)V_4).Dispose();
         }
         this.GetReachableBlocks(V_1);
     }
     return;
 }
コード例 #10
0
		public static List<TypeDefinition> GetBaseTypes(this TypeDefinition targetType)
		{
			V_0 = new List<TypeDefinition>();
			if (targetType == null)
			{
				return V_0;
			}
			V_0.Add(targetType);
			V_1 = 0;
			while (V_1 < V_0.get_Count())
			{
				stackVariable10 = V_0.get_Item(V_1);
				V_2 = stackVariable10.get_BaseType();
				if (V_2 != null)
				{
					V_3 = V_2.Resolve();
					if (V_3 != null)
					{
						V_0.Add(V_3);
					}
				}
				V_4 = stackVariable10.get_Interfaces().GetEnumerator();
				try
				{
					while (V_4.MoveNext())
					{
						V_5 = V_4.get_Current();
						if (V_5 == null)
						{
							continue;
						}
						V_6 = V_5.Resolve();
						if (V_6 == null)
						{
							continue;
						}
						V_0.Add(V_6);
					}
				}
				finally
				{
					V_4.Dispose();
				}
				V_1 = V_1 + 1;
			}
			return V_0;
		}
コード例 #11
0
 public List <FileViewModel> GetFiles(string fullPath)
 {
     this.CreateDirectoryIfNotExist(fullPath);
     V_0 = new List <FileViewModel>();
     V_1 = Directory.GetDirectories(fullPath, "*", 1);
     V_2 = 0;
     while (V_2 < (int)V_1.Length)
     {
         stackVariable15 = new DirectoryInfo(V_1[V_2]);
         V_3             = stackVariable15.get_Name();
         stackVariable17 = stackVariable15.GetFiles();
         stackVariable18 = FileRepository.u003cu003ec.u003cu003e9__30_0;
         if (stackVariable18 == null)
         {
             dummyVar0       = stackVariable18;
             stackVariable18 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetFilesu003eb__30_0);
             FileRepository.u003cu003ec.u003cu003e9__30_0 = stackVariable18;
         }
         V_4 = ((IEnumerable <FileInfo>)stackVariable17).OrderByDescending <FileInfo, DateTime>(stackVariable18).GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5 = V_4.get_Current();
                 V_6 = new FileViewModel();
                 V_6.set_FolderName(V_3);
                 stackVariable31    = new string[2];
                 stackVariable31[0] = fullPath;
                 stackVariable31[1] = V_3;
                 V_6.set_FileFolder(CommonHelper.GetFullPath(stackVariable31));
                 V_6.set_Filename(V_5.get_Name().Substring(0, V_5.get_Name().LastIndexOf('.')));
                 V_6.set_Extension(V_5.get_Extension());
                 V_0.Add(V_6);
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
         V_2 = V_2 + 1;
     }
     return(V_0);
 }
コード例 #12
0
 private void RemoveExcessNodesFromTheTryBlock()
 {
     V_0 = new HashSet <ILogicalConstruct>(this.finallyBlocks);
     V_1 = new Queue <ILogicalConstruct>(this.finallyBlocks);
     while (V_1.get_Count() > 0)
     {
         V_2 = V_1.Dequeue().get_SameParentSuccessors().GetEnumerator();
         try
         {
             while (V_2.MoveNext())
             {
                 V_3 = (ILogicalConstruct)V_2.get_Current();
                 if (V_0.Contains(V_3) || V_3 == this.entryOfTry)
                 {
                     continue;
                 }
                 dummyVar0 = V_0.Add(V_3);
                 V_1.Enqueue(V_3);
             }
         }
         finally
         {
             ((IDisposable)V_2).Dispose();
         }
     }
     V_4 = V_0.GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (V_5 == this.entryOfTry)
             {
                 continue;
             }
             dummyVar1 = this.newTryBody.Remove(V_5);
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return;
 }
コード例 #13
0
 private void CollectVariableNames()
 {
     V_0 = new HashSet <string>(this.methodContext.get_VariableNamesCollection(), this.context.get_Language().get_IdentifierComparer());
     V_1 = this.methodContext.get_Body().get_Variables().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             if (!this.methodContext.get_VariableDefinitionToNameMap().TryGetValue(V_2, out V_3))
             {
                 V_3 = V_2.get_Name();
             }
             if (V_0.Contains(V_3))
             {
                 continue;
             }
             dummyVar0 = V_0.Add(V_3);
         }
     }
     finally
     {
         V_1.Dispose();
     }
     V_4 = this.methodContext.get_VariableDefinitionToNameMap().get_Values().GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (V_0.Contains(V_5))
             {
                 continue;
             }
             dummyVar1 = V_0.Add(V_5);
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     this.methodContext.set_VariableNamesCollection(V_0);
     return;
 }
コード例 #14
0
ファイル: SiteMap.cs プロジェクト: codemerx/CodemerxDecompile
 public XElement ParseXElement()
 {
     dummyVar0       = XNamespace.op_Implicit("http://www.w3.org/1999/xhtml");
     V_0             = XNamespace.op_Implicit("http://www.sitemaps.org/schemas/sitemap/0.9");
     V_1             = XNamespace.op_Implicit("http://www.w3.org/1999/xhtml");
     V_2             = new XElement(XNamespace.op_Addition(V_0, "url"));
     stackVariable10 = V_2;
     stackVariable13 = XNamespace.op_Addition(V_0, "lastmod");
     if (this.get_LastMod().get_HasValue())
     {
         stackVariable21 = this.get_LastMod().get_Value();
     }
     else
     {
         stackVariable21 = DateTime.get_UtcNow();
     }
     stackVariable10.Add(new XElement(stackVariable13, (object)stackVariable21));
     V_2.Add(new XElement(XNamespace.op_Addition(V_0, "changefreq"), this.get_ChangeFreq()));
     V_2.Add(new XElement(XNamespace.op_Addition(V_0, "priority"), (object)this.get_Priority()));
     V_2.Add(new XElement(XNamespace.op_Addition(V_0, "loc"), this.get_Loc()));
     V_4 = this.get_OtherLanguages().GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5                = V_4.get_Current();
             stackVariable56    = XNamespace.op_Addition(V_1, "link");
             stackVariable58    = new object[4];
             stackVariable58[0] = new XAttribute(XNamespace.op_Addition(XNamespace.get_Xmlns(), "xhtml"), V_1.get_NamespaceName());
             stackVariable58[1] = new XAttribute(XName.op_Implicit("rel"), "alternate");
             stackVariable58[2] = new XAttribute(XName.op_Implicit("hreflang"), V_5.get_HrefLang());
             stackVariable58[3] = new XAttribute(XName.op_Implicit("href"), V_5.get_Href());
             V_2.Add(new XElement(stackVariable56, stackVariable58));
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return(V_2);
 }
コード例 #15
0
 private bool[,] GeenrateAdjacencyMatrix(Dictionary <ClassHierarchyNode, int> nodeToIndex)
 {
     stackVariable2 = this.inferenceGraph.get_Count();
     V_0            = new bool[stackVariable2, stackVariable2];
     V_1            = this.inferenceGraph.GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = nodeToIndex.get_Item(V_2);
             V_4 = V_2.get_CanAssignTo().GetEnumerator();
             try
             {
                 while (V_4.MoveNext())
                 {
                     V_5 = V_4.get_Current();
                     V_0[V_3, nodeToIndex.get_Item(V_5)] = true;
                 }
             }
             finally
             {
                 if (V_4 != null)
                 {
                     V_4.Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     return(V_0);
 }
コード例 #16
0
 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);
 }
コード例 #17
0
 private CFGBlockLogicalConstruct ProcessFinallyNode(CFGBlockLogicalConstruct finallyBlockEntry, CFGBlockLogicalConstruct finallyBlockEnd)
 {
     V_1 = finallyBlockEntry.get_SameParentPredecessors().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = (ILogicalConstruct)V_1.get_Current();
             if (this.newTryBody.Contains(V_2))
             {
                 continue;
             }
             throw new Exception("Invalid entry to the finally block");
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     V_3 = finallyBlockEnd.get_CFGSuccessors().GetEnumerator();
     try
     {
         dummyVar0 = V_3.MoveNext();
         V_0       = V_3.get_Current();
         if (V_3.MoveNext())
         {
             throw new Exception("Invalid count of successors");
         }
     }
     finally
     {
         if (V_3 != null)
         {
             V_3.Dispose();
         }
     }
     V_4 = (new HashSet <CFGBlockLogicalConstruct>(finallyBlockEntry.get_CFGPredecessors())).GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             if (InstructionBlock.op_Inequality(V_5.get_TheBlock(), finallyBlockEntry.get_TheBlock()) && (int)V_5.get_TheBlock().get_Successors().Length > 1)
             {
                 this.ProcessMultiWayCFGPredecessor(finallyBlockEntry, V_5.get_TheBlock(), V_0.get_TheBlock());
             }
             V_6 = V_5;
             while (V_6 != finallyBlockEntry.get_Parent())
             {
                 dummyVar1 = V_6.RemoveFromSuccessors(finallyBlockEntry);
                 V_6.AddToSuccessors(V_0);
                 V_6 = V_6.get_Parent() as LogicalConstructBase;
             }
             V_0.AddToPredecessors(V_5);
             dummyVar2 = finallyBlockEntry.RemoveFromPredecessors(V_5);
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     dummyVar3 = V_0.RemoveFromPredecessors(finallyBlockEnd);
     dummyVar4 = finallyBlockEnd.RemoveFromSuccessors(V_0);
     return(V_0);
 }
コード例 #18
0
        protected virtual ClassHierarchyNode FindLowestCommonAncestor(ICollection <ClassHierarchyNode> typeNodes)
        {
            V_0 = 0;
            V_1 = null;
            V_4 = typeNodes.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_0 = V_0 + 1;
                    V_1 = V_4.get_Current();
                }
            }
            finally
            {
                if (V_4 != null)
                {
                    V_4.Dispose();
                }
            }
            if (V_0 == 1)
            {
                return(V_1);
            }
            V_2 = new Queue <ClassHierarchyNode>();
            V_3 = new HashSet <ClassHierarchyNode>();
            V_4 = typeNodes.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_5 = V_4.get_Current();
                    if (V_2.get_Count() != 0)
                    {
                        V_10 = V_5;
                        while (!V_3.Contains(V_10))
                        {
                            stackVariable28 = V_5.get_CanAssignTo();
                            stackVariable29 = TypeInferer.u003cu003ec.u003cu003e9__18_0;
                            if (stackVariable29 == null)
                            {
                                dummyVar1       = stackVariable29;
                                stackVariable29 = new Func <ClassHierarchyNode, bool>(TypeInferer.u003cu003ec.u003cu003e9.u003cFindLowestCommonAncestoru003eb__18_0);
                                TypeInferer.u003cu003ec.u003cu003e9__18_0 = stackVariable29;
                            }
                            if (stackVariable28.Count <ClassHierarchyNode>(stackVariable29) <= 1)
                            {
                                stackVariable33 = V_10.get_CanAssignTo();
                                stackVariable34 = TypeInferer.u003cu003ec.u003cu003e9__18_1;
                                if (stackVariable34 == null)
                                {
                                    dummyVar2       = stackVariable34;
                                    stackVariable34 = new Func <ClassHierarchyNode, bool>(TypeInferer.u003cu003ec.u003cu003e9.u003cFindLowestCommonAncestoru003eb__18_1);
                                    TypeInferer.u003cu003ec.u003cu003e9__18_1 = stackVariable34;
                                }
                                V_10 = stackVariable33.FirstOrDefault <ClassHierarchyNode>(stackVariable34);
                            }
                            else
                            {
                                V_11 = null;
                                goto Label1;
                            }
                        }
                        while (V_2.Peek() != V_10)
                        {
                            dummyVar3 = V_3.Remove(V_2.Dequeue());
                        }
                    }
                    else
                    {
                        V_6 = V_5;
                        while (V_6 != null)
                        {
                            V_2.Enqueue(V_6);
                            dummyVar0 = V_3.Add(V_6);
                            V_7       = null;
                            V_8       = V_6.get_CanAssignTo().GetEnumerator();
                            try
                            {
                                while (V_8.MoveNext())
                                {
                                    V_9 = V_8.get_Current();
                                    if (!V_9.get_IsHardNode())
                                    {
                                        continue;
                                    }
                                    V_7 = V_9;
                                    goto Label2;
                                }
                            }
                            finally
                            {
                                if (V_8 != null)
                                {
                                    V_8.Dispose();
                                }
                            }
Label2:
                            V_6 = V_7;
                        }
                    }
                }
                goto Label0;
            }
            finally
            {
                if (V_4 != null)
                {
                    V_4.Dispose();
                }
            }
Label1:
            return(V_11);

Label0:
            return(V_2.Peek());
        }
コード例 #19
0
        private bool ChangesAssignedExpression(Expression currentExpression, Expression assignedValue, Expression assignmentRecipient)
        {
            if (currentExpression as MethodInvocationExpression != null)
            {
                V_1 = currentExpression as MethodInvocationExpression;
                if (assignedValue.get_ExpressionType().get_IsByReference() && V_1.get_MethodExpression().get_Target() != null)
                {
                    V_2 = V_1.get_MethodExpression().get_Target();
                    if (V_2.Equals(assignmentRecipient))
                    {
                        return(false);
                    }
                    if (V_2 as UnaryExpression != null && (V_2 as UnaryExpression).get_Operator() == 8 && (V_2 as UnaryExpression).get_Operand().Equals(assignmentRecipient))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            if (currentExpression as BinaryExpression == null)
            {
                return(false);
            }
            V_0 = currentExpression as BinaryExpression;
            if (V_0.get_Left().Equals(assignedValue))
            {
                return(true);
            }
            if (assignedValue as ArrayIndexerExpression != null)
            {
                V_3 = assignedValue as ArrayIndexerExpression;
                if (V_0.get_Left().Equals(V_3.get_Target()))
                {
                    return(true);
                }
                V_4 = V_3.get_Indices().GetEnumerator();
                try
                {
                    while (V_4.MoveNext())
                    {
                        V_5 = V_4.get_Current();
                        if (!V_0.get_Left().Equals(V_5))
                        {
                            continue;
                        }
                        V_6 = true;
                        goto Label1;
                    }
                    goto Label0;
                }
                finally
                {
                    if (V_4 != null)
                    {
                        V_4.Dispose();
                    }
                }
Label1:
                return(V_6);
            }
Label0:
            if (assignedValue as UnaryExpression != null)
            {
                return(this.ChangesAssignedExpression(currentExpression, (assignedValue as UnaryExpression).get_Operand(), assignmentRecipient));
            }
            if (assignedValue as ExplicitCastExpression != null)
            {
                return(this.ChangesAssignedExpression(currentExpression, (assignedValue as ExplicitCastExpression).get_Expression(), assignmentRecipient));
            }
            if (assignedValue as CanCastExpression == null)
            {
                return(false);
            }
            return(this.ChangesAssignedExpression(currentExpression, (assignedValue as CanCastExpression).get_Expression(), assignmentRecipient));
        }
コード例 #20
0
 private void ProcessTypeMembers(TypeDefinition type, MemberRenamingData memberRenamingData)
 {
     if (type.get_HasMethods())
     {
         V_0 = type.get_Methods().GetEnumerator();
         try
         {
             while (V_0.MoveNext())
             {
                 V_1 = V_0.get_Current();
                 this.RenameMember(V_1, memberRenamingData);
             }
         }
         finally
         {
             V_0.Dispose();
         }
     }
     if (type.get_HasProperties())
     {
         V_2 = type.get_Properties().GetEnumerator();
         try
         {
             while (V_2.MoveNext())
             {
                 V_3 = V_2.get_Current();
                 this.RenameMember(V_3, memberRenamingData);
             }
         }
         finally
         {
             V_2.Dispose();
         }
     }
     if (type.get_HasFields())
     {
         V_4 = type.get_Fields().GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5 = V_4.get_Current();
                 this.RenameMember(V_5, memberRenamingData);
             }
         }
         finally
         {
             V_4.Dispose();
         }
     }
     if (type.get_HasEvents())
     {
         V_6 = type.get_Events().GetEnumerator();
         try
         {
             while (V_6.MoveNext())
             {
                 V_7 = V_6.get_Current();
                 this.RenameMember(V_7, memberRenamingData);
             }
         }
         finally
         {
             V_6.Dispose();
         }
     }
     return;
 }
コード例 #21
0
        private LoopType DetermineLoopType(HashSet <ILogicalConstruct> loopBody, HashSet <ILogicalConstruct> latchingNodes, IntervalConstruct interval, DominatorTree dominatorTree, out ConditionLogicalConstruct loopCondition)
        {
            V_0       = interval.get_Entry() as ILogicalConstruct;
            V_1       = new HashSet <ILogicalConstruct>(latchingNodes);
            dummyVar0 = V_1.Add(V_0);
            V_2       = DFSTBuilder.BuildTree(V_0.get_Parent() as ILogicalConstruct);
            V_3       = new HashSet <ILogicalConstruct>();
            V_4       = loopBody.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_5 = V_4.get_Current();
                    V_6 = dominatorTree.GetDominanceFrontier(V_5).GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_7 = (ILogicalConstruct)V_6.get_Current();
                            if (!interval.get_Children().Contains(V_7) || loopBody.Contains(V_7))
                            {
                                continue;
                            }
                            dummyVar1 = V_3.Add(V_7);
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                }
            }
            finally
            {
                ((IDisposable)V_4).Dispose();
            }
            if (V_3.get_Count() == 0)
            {
                V_8 = V_2.get_ReversePostOrder().GetEnumerator();
                try
                {
                    while (V_8.MoveNext())
                    {
                        V_9 = V_8.get_Current().get_Construct() as ILogicalConstruct;
                        if (loopBody.Contains(V_9))
                        {
                            continue;
                        }
                        loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_9);
                        if (loopCondition == null)
                        {
                            continue;
                        }
                        this.ExpandLoopBody(interval, loopBody, V_9);
                        if (loopCondition != V_0)
                        {
                            V_10 = 2;
                            goto Label1;
                        }
                        else
                        {
                            V_10 = 1;
                            goto Label1;
                        }
                    }
                    goto Label0;
                }
                finally
                {
                    ((IDisposable)V_8).Dispose();
                }
Label1:
                return(V_10);
            }
            V_11 = V_2.get_ReversePostOrder().get_Count();
            V_4  = V_3.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_13 = V_4.get_Current();
                    V_14 = V_2.get_ConstructToNodeMap().get_Item(V_13).get_ReversePostOrderIndex();
                    if (V_14 >= V_11)
                    {
                        continue;
                    }
                    V_11 = V_14;
                }
            }
            finally
            {
                ((IDisposable)V_4).Dispose();
            }
            V_12          = V_2.get_ReversePostOrder().get_Item(V_11).get_Construct() as ILogicalConstruct;
            loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_12);
            this.ExpandLoopBody(interval, loopBody, V_12);
            if (loopCondition == null)
            {
                return(0);
            }
            if (loopCondition == V_0)
            {
                return(1);
            }
            return(2);

Label0:
            if (!this.CanBeLoopCondition(V_0, loopBody))
            {
                loopCondition = null;
                return(0);
            }
            loopCondition = V_0 as ConditionLogicalConstruct;
            return(1);
        }
コード例 #22
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);
        }
コード例 #23
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;
 }
コード例 #24
0
		internal static bool IsAnonymous(this TypeDefinition self)
		{
			if (self == null || String.op_Inequality(self.get_Namespace(), String.Empty) || !self.get_IsSealed() || !self.get_IsNotPublic() || String.op_Inequality(self.get_BaseType().get_FullName(), "System.Object") || !self.get_HasGenericParameters() || !self.HasCompilerGeneratedAttribute())
			{
				return false;
			}
			V_0 = 0;
			if (self.get_Interfaces().get_Count() > 1)
			{
				return false;
			}
			if (self.get_Interfaces().get_Count() == 1)
			{
				if (!String.op_Equality(self.get_Interfaces().get_Item(0).get_Name(), "IEquatable`1"))
				{
					return false;
				}
				V_0 = 1;
			}
			V_1 = self.get_Properties().get_Count();
			if (V_1 != self.get_GenericParameters().get_Count() || V_1 != self.get_Fields().get_Count())
			{
				return false;
			}
			V_2 = 0;
			V_4 = self.get_Properties().GetEnumerator();
			try
			{
				while (V_4.MoveNext())
				{
					V_5 = V_4.get_Current();
					if (V_5.get_GetMethod() != null)
					{
						stackVariable50 = V_2;
						if (V_5.get_SetMethod() != null)
						{
							stackVariable53 = 2;
						}
						else
						{
							stackVariable53 = 1;
						}
						V_2 = stackVariable50 + stackVariable53;
					}
					else
					{
						V_6 = false;
						goto Label1;
					}
				}
				goto Label0;
			}
			finally
			{
				V_4.Dispose();
			}
		Label1:
			return V_6;
		Label0:
			V_3 = self.get_Methods().get_Count();
			if (V_2 + V_0 >= V_3)
			{
				return false;
			}
			return V_3 <= V_2 + V_0 + 4;
		}