private void RemoveTransitiveEdges() { V_0 = this.GenerateNodeToIndex(); V_1 = this.GeenrateAdjacencyMatrix(V_0); this.WarsawTransitiveClosure(V_1); V_2 = this.inferenceGraph.GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); V_4 = this.inferenceGraph.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_6 = this.inferenceGraph.GetEnumerator(); try { while (V_6.MoveNext()) { V_7 = V_6.get_Current(); V_8 = V_0.get_Item(V_3); V_9 = V_0.get_Item(V_5); V_10 = V_0.get_Item(V_7); if (!V_1[V_8, V_9] || !V_1[V_9, V_10] || V_3.get_IsHardNode() && V_7.get_IsHardNode() || !V_3.get_SubTypes().Contains(V_7)) { continue; } this.RemoveSubtype(V_3, V_7); } } finally { if (V_6 != null) { V_6.Dispose(); } } } } finally { if (V_4 != null) { V_4.Dispose(); } } } } finally { if (V_2 != null) { V_2.Dispose(); } } return; }
public List <FileViewModel> GetFilesWithContent(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__29_0; if (stackVariable18 == null) { dummyVar0 = stackVariable18; stackVariable18 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetFilesWithContentu003eb__29_0); FileRepository.u003cu003ec.u003cu003e9__29_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 = V_5.OpenText(); try { V_7 = new FileViewModel(); V_7.set_FolderName(V_3); stackVariable33 = new string[2]; stackVariable33[0] = fullPath; stackVariable33[1] = V_3; V_7.set_FileFolder(CommonHelper.GetFullPath(stackVariable33)); V_7.set_Filename(V_5.get_Name().Substring(0, V_5.get_Name().LastIndexOf('.'))); V_7.set_Extension(V_5.get_Extension()); V_7.set_Content(V_6.ReadToEnd()); V_0.Add(V_7); } finally { if (V_6 != null) { ((IDisposable)V_6).Dispose(); } } } } finally { if (V_4 != null) { V_4.Dispose(); } } V_2 = V_2 + 1; } return(V_0); }
public void InferTypes() { V_0 = (new GreedyTypeInferer(this.context, this.offsetToExpression)).InferTypes(); V_1 = new ClassHierarchyBuilder(this.offsetToExpression, this.context.get_MethodContext().get_ControlFlowGraph().get_OffsetToInstruction(), this.context); this.inferenceGraph = V_1.BuildHierarchy(V_0); this.MergeConnectedComponents(); this.RemoveTransitiveEdges(); this.ProcessSingleConstraints(); V_2 = null; V_4 = this.inferenceGraph.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (!V_5.get_IsHardNode() || !String.op_Equality(V_5.get_NodeType().get_FullName(), "System.Object")) { continue; } V_2 = V_5; goto Label0; } } finally { if (V_4 != null) { V_4.Dispose(); } } Label0: V_3 = new List <ClassHierarchyNode>(); V_3.Add(V_2); V_4 = this.inferenceGraph.GetEnumerator(); try { while (V_4.MoveNext()) { V_6 = V_4.get_Current(); if (V_6.get_IsHardNode()) { continue; } V_3.Add(V_6); } } finally { if (V_4 != null) { V_4.Dispose(); } } this.MergeNodes(V_3); this.InferIntegerTypes(V_0); this.AddCasts(); return; }
private void CreateGraph(IEnumerable <IntervalConstruct> intervals) { V_0 = intervals.GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = V_0.get_Current(); V_2 = V_1.get_Children().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = (ILogicalConstruct)V_2.get_Current(); V_4 = this.GetNodeSuccessors(V_3).GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (!this.nodeToInterval.ContainsKey(V_5) || this.nodeToInterval.get_Item(V_5) == V_1) { continue; } V_6 = this.nodeToInterval.get_Item(V_5); if (V_1.get_SameParentSuccessors().Contains(V_6)) { continue; } dummyVar0 = V_1.get_SameParentSuccessors().Add(V_6); dummyVar1 = V_6.get_SameParentPredecessors().Add(V_1); } } finally { if (V_4 != null) { V_4.Dispose(); } } } } finally { ((IDisposable)V_2).Dispose(); } } } finally { if (V_0 != null) { V_0.Dispose(); } } return; }
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; }
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); }
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); }
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; }
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; }
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)); }
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()); }
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; }