public IModuleFileNode FindNode(ModuleDef mod) { if (mod == null) { return(null); } foreach (var n in TopNodes.OfType <IAssemblyFileNode>()) { n.TreeNode.EnsureChildrenLoaded(); foreach (var m in n.TreeNode.DataChildren.OfType <IModuleFileNode>()) { if (m.DnSpyFile.ModuleDef == mod) { return(m); } } } // Check for netmodules foreach (var n in TopNodes.OfType <IModuleFileNode>()) { if (n.DnSpyFile.ModuleDef == mod) { return(n); } } return(null); }
public override void ShiftNodes(int offset) { foreach (var node in TopNodes.Union(BottomNodes)) { node.Row += 1; } }
public override void BuildAtomicRITEs() { _contractRITEs = new HashSet <ContractAtomicRITE>(); HashSet <AtomicRITE> currentRITESet = new HashSet <AtomicRITE>(); foreach (CoverNode coverNode in TopNodes.OfType <CoverNode>()) { _contractRITEs.UnionWith(RecursiveGetAtomicRITEs(coverNode, currentRITESet).Cast <ContractAtomicRITE>()); } }
IDnSpyFileNode[] GetNewSortedNodes() { var origOrder = TopNodes.ToArray(); var files = origOrder.Select((a, i) => Tuple.Create(a, i)).ToList(); files.Sort(DnSpyFileNodeComparer.Instance); var sorted = files.Select(a => a.Item1).ToArray(); if (Equals(sorted, origOrder)) { return(null); } return(sorted); }
protected override void RemoveANode(rMindBaseNode node) { var outMax = m_parent.VLines.Where(x => x != this).Max(x => x.TopNodes.Count); if (TopNodes.Count > outMax) { /* Если количество занимаемых колонок больше, чем у остальных строк * Нужно удалять колонку грида и сдвинуть все узлы. Кроме своих. */ var nodes = m_parent.VLines.Where(x => x != this).Select(x => x as rMindLine) .Union(m_parent.HLines.Select(x => x as rMindLine)) .Select(x => x.NodesA.Union(x.NodesB)); foreach (var arr in nodes) { foreach (var n in arr) { n.Row--; } } // Среди своих узлов удаляем только те, что правее var offsetNodes = TopNodes.Union(BottomNodes).Where(x => x.Row > node.Row); foreach (var n in offsetNodes) { n.Row--; } if (m_parent.Template.RowDefinitions.Count > 1) { m_parent.Template.RowDefinitions.Remove( m_parent.Template.RowDefinitions.Last() ); } } else { var offsetNodes = TopNodes.Where(x => x.Row < node.Row); foreach (var n in offsetNodes) { n.Row++; } } TopNodes.Remove(node); m_parent.UpdateBase(); m_parent.RemoveNode(node); }
public IAssemblyFileNode FindNode(AssemblyDef asm) { if (asm == null) { return(null); } foreach (var n in TopNodes.OfType <IAssemblyFileNode>()) { if (n.DnSpyFile.AssemblyDef == asm) { return(n); } } return(null); }
public AssemblyDocumentNode FindNode(AssemblyDef asm) { if (asm == null) { return(null); } foreach (var n in TopNodes.OfType <AssemblyDocumentNode>()) { if (n.Document.AssemblyDef == asm) { return(n); } } return(null); }
public rMindBaseNode AddTopNode() { int currentCount = m_parent.VLines.Max(line => line.TopNodes.Count); if (TopNodes.Count + 1 > currentCount) { /* * если количество верхних узлов равно максимальному количеству по линиям * добавляем новую строку. */ m_parent.Template.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto, MinHeight = 24 }); foreach (var line in m_parent.VLines) { line.ShiftNodes(1); } foreach (var line in m_parent.HLines) { foreach (var n in line.LeftNodes.Union(line.RightNodes)) { n.Row += 1; } } } var node = m_parent.CreateNode(); int idx = currentCount - TopNodes.Count - 1; //if (idx == 0) // ShiftNodes(1); node.SetCell(m_parent.GetLineIndex(this), idx > 0 ? idx : 0); node.NodeOrientation = rMindNodeOriantation.Top; TopNodes.Add(node); m_parent.UpdateBase(); return(node); }
void AddUpperGrowth(Node[,] grid, Texture2D tex) { for (int i = TopNodes.Count - 1; i > -1; i--) { Node top = TopNodes[i]; if (!top.Solid) { TopNodes.RemoveAt(i); continue; } if (top.Position.y < height - 1) { Node upper = grid[top.Position.x, top.Position.y + 1]; if (upper.Solid) { TopNodes.RemoveAt(i); continue; } } int growth = GetUpperGrowthSize(top, grid, 1); AddUpperGrowth(top, grid, growth, tex); } }
Node[,] SetGrid(Node[,] oldGrid, NoiseData[] noiseData) { //Profiler.BeginSample("SetGrid"); for (int x = 0; x < width; x++) { bool lastSolid = true; for (int y = 0; y < height; y++) { Vector2Int pos = new Vector2Int(x, y); bool added = false; for (int i = Layers - 1; i > -1; i--) { if (y < noiseData[i].Data[x]) { if (noiseData[i].Solid) { oldGrid[x, y] = new Node(true, pos); if (y == 0) { lastSolid = true; } else if (!lastSolid) { BottomNodes.Add(oldGrid[x, y]); } lastSolid = true; added = true; break; } else { oldGrid[x, y] = new Node(false, pos); if (y == 0) { lastSolid = false; } else if (lastSolid && y - 1 >= 0) { Node top = oldGrid[x, y - 1]; if (top && top.Solid) { TopNodes.Add(top); } } lastSolid = false; added = true; break; } } } if (oldGrid[x, y] == null && !added) { oldGrid[x, y] = new Node(false, pos); if (lastSolid && y - 1 >= 0) { Node top = oldGrid[x, y - 1]; if (top && top.Solid) { TopNodes.Add(top); } } lastSolid = false; added = true; } } } // Profiler.EndSample(); return(oldGrid); }
private void GenerateMeshNodes(int LElements, int HElements) { Nodes.Clear(); LeftNodes.Clear(); RightNodes.Clear(); int indexCur = 0; double xCur = 0; double yCur = _shape.H / 2; if (HElements % 2 == 1) { HElements++; } int HNodes = HElements + 1; int LNodes = LElements + 1; double xStep = _shape.L / Convert.ToDouble(LElements); double yStep = _shape.H / Convert.ToDouble(HElements); int HNodesdiv2 = HNodes / 2; for (int i = 0; i < HNodesdiv2; i++) { if (i == 0) { TopNodes.Clear(); } for (int j = 0; j < LNodes; j++) { Node node = new Node(); node.Index = indexCur; node.X = xCur; node.Y = yCur; Nodes.Add(node); if (j == 0) { LeftNodes.Add(node); } if (j == (LNodes - 1)) { RightNodes.Add(node); } indexCur++; xCur += xStep; if (i == 0) { TopNodes.Add(node); } } yCur -= yStep; xCur = 0; } xCur = 0; yCur = 0; MiddleNodes.Clear(); for (int j = 0; j < LNodes; j++) { Node node = new Node(); node.Index = indexCur; node.X = xCur; node.Y = yCur; Nodes.Add(node); MiddleNodes.Add(node); if (j == 0) { LeftNodes.Add(node); } if (j == (LNodes - 1)) { RightNodes.Add(node); } indexCur++; xCur += xStep; } xCur = 0; yCur -= yStep; for (int i = 0; i < HNodesdiv2; i++) { if (i == (HNodesdiv2 - 1)) { BottomNodes.Clear(); } for (int j = 0; j < LNodes; j++) { Node node = new Node(); node.Index = indexCur; node.X = xCur; node.Y = yCur; Nodes.Add(node); if (j == 0) { LeftNodes.Add(node); } if (j == (LNodes - 1)) { RightNodes.Add(node); } if (i == (HNodesdiv2 - 1)) { BottomNodes.Add(node); } indexCur++; xCur += xStep; } yCur -= yStep; xCur = 0; } }