private void UpdateResults() { if (!CloneDetectiveManager.IsCloneReportAvailable) { CloseResults(); } else { for (int i = documentContainer.Documents.Length - 1; i >= 0; i--) { DockControl dockControl = documentContainer.Documents[i]; CloneResultPageControl pageControl = (CloneResultPageControl)dockControl.Controls[0]; CloneClass newCloneClass = CloneDetectiveManager.CloneDetectiveResult.FindCloneClass(pageControl.CloneClass.Fingerprint); if (newCloneClass == null) { documentContainer.RemoveDocument(dockControl); } else { pageControl.CloneClass = newCloneClass; } } } }
public static void FindClones(CloneClass cloneClass) { CloneResultsControl cloneResultsControl = VSPackage.Instance.GetToolWindowUserControl <CloneResultsToolWindow, CloneResultsControl>(); cloneResultsControl.Add(cloneClass); VSPackage.Instance.ShowToolWindow <CloneResultsToolWindow>(); }
private void FixedUpdate() { if (Input.GetKey(KeyCode.Escape)) { if (canvas.enabled && !CloneClass.CloneClassViewEnabled && closeCooldown == 0 && packageNameHolder.text == this.packageName && packageViewEnabled) { canvas.enabled = false; packageViewEnabled = false; PackageEdge.EdgeViewEnabled = false; packageNameHolder.text = ""; userTracker.moveToStart(); CloneClass.removeClones(); } else if (canvas.enabled && !CloneClass.CloneClassViewEnabled && closeCooldown == 0 && PackageEdge.EdgeViewEnabled) { canvas.enabled = false; packageViewEnabled = false; PackageEdge.EdgeViewEnabled = false; packageNameHolder.text = ""; edgepack1.text = ""; edgepack2.text = ""; } } if (closeCooldown > 0) { closeCooldown--; } }
private void cmdDuplicateAll_Click(object sender, RoutedEventArgs e) { if (gCodeObject.gCodeList.Count < 1) { return; } double distXDir = HelperClass.ShowInputBox("Distance between Macros in X Direction"); int numXDir = Convert.ToInt32(HelperClass.ShowInputBox("Number of Macros in X Direction")); double distYDir = HelperClass.ShowInputBox("Distance between Macros in Y Direction"); int numYDir = Convert.ToInt32(HelperClass.ShowInputBox("Number of Macros in Y Direction")); List <Gcode> DuplicatedList = new List <Gcode>(); foreach (Gcode item in gCodeObject.gCodeList) { Gcode gcodeToCopy = CloneClass.CloneObject <Gcode>(item); DuplicatedList.Add(gcodeToCopy); double distX = item.xStart; double distY = item.yStart; double distYDirFixed = distYDir; for (int x = 0; x <= numXDir; x++) { for (int y = 1; y < numYDir; y++) { distY += distYDirFixed; Gcode copyY = CloneClass.CloneObject <Gcode>(gcodeToCopy); copyY.xStart = distX; copyY.yStart = distY; DuplicatedList.Add(copyY); } distYDirFixed *= -1; distX += distXDir; if (x >= numXDir - 1) { break; } Gcode copyX = CloneClass.CloneObject <Gcode>(gcodeToCopy); copyX.xStart = distX; copyX.yStart = distY; DuplicatedList.Add(copyX); } } gCodeObject.gCodeList = DuplicatedList; gCodeObject.DrawObjects(ref MainCanvas, ref MainCanvasScale, ref GCodeView, ref Arrow, xMeasure, yMeasure); }
public void CloneObjectTest() { // Arrange EditorModel Model = new EditorModel(); // Act EditorModel Cloned = CloneClass.CloneObject <EditorModel>(Model); // Assert Assert.AreNotEqual(Model, Cloned); }
public void Add(CloneClass cloneClass) { CloneResultPageControl pageControl = new CloneResultPageControl(); pageControl.CloneClass = cloneClass; string resultName = FormattingHelper.FormatCloneClassName(cloneClass); DockControl dockControl = new DockControl(pageControl, resultName); documentContainer.AddDocument(dockControl); documentContainer.ActiveDocument = dockControl; }
public GUI_TestCase(TestCase testCase) { InitializeComponent(); initialTestCase = testCase; Documentation.Text = initialTestCase.Documentation; TestName.Text = initialTestCase.Name; ExpectedResult.Text = initialTestCase.ExpectedResult; var stepsCounter = 0; foreach (string step in initialTestCase.TestSteps) { FormControls.AddTestCaseField(this, stepsCounter, step, new Point(20, 170 + stepsCounter * 20), new EventHandler(AddStep), new EventHandler(RemoveStep)); stepsCounter++; } _currentTestCase = CloneClass.Clone(initialTestCase); }
private void DuplicateGcode(double distXDir, int numXDir, double distYDir, int numYDir, int index) { Gcode gcodeToCopy = CloneClass.CloneObject <Gcode>(gCodeObject.gCodeList[index]); double distX = gCodeObject.gCodeList[index].xStart; double distY = gCodeObject.gCodeList[index].yStart; for (int x = 0; x <= numXDir; x++) { for (int y = 1; y < numYDir; y++) { distY += distYDir; Gcode copyY = CloneClass.CloneObject <Gcode>(gcodeToCopy); copyY.xStart = distX; copyY.yStart = distY; gCodeObject.gCodeList.Add(copyY); } distYDir *= -1; distX += distXDir; if (x >= numXDir - 1) { break; } Gcode copyX = CloneClass.CloneObject <Gcode>(gcodeToCopy); copyX.xStart = distX; copyX.yStart = distY; gCodeObject.gCodeList.Add(copyX); } gCodeObject.DrawObjects(ref MainCanvas, ref MainCanvasScale, ref GCodeView, ref Arrow, xMeasure, yMeasure); }
private void UpdateContextMenu(ContextMenuStrip contextMenu, CloneIntersectedItem cloneIntersectedItem) { contextMenu.Items.Clear(); if (cloneIntersectedItem == null) { return; } List <CloneIntersection> clones = new List <CloneIntersection>(cloneIntersectedItem.Clones); clones.Sort(delegate(CloneIntersection x, CloneIntersection y) { int result = x.Clone.StartLine.CompareTo(y.Clone.StartLine); if (result == 0) { result = x.Clone.LineCount.CompareTo(y.Clone.LineCount); } return(result); }); Dictionary <CloneClass, Bitmap> cloneClassBitmaps = new Dictionary <CloneClass, Bitmap>(); foreach (CloneIntersection cloneIntersection in clones) { CloneClass cloneClass = cloneIntersection.Clone.CloneClass; Bitmap cloneClassBitmap; if (!cloneClassBitmaps.TryGetValue(cloneClass, out cloneClassBitmap)) { cloneClassBitmap = new Bitmap(16, 16, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(cloneClassBitmap)) { int height = GetBoxHeight() - 1; int width = cloneClassBitmap.Width - 1; int top = (int)Math.Floor(cloneClassBitmap.Height / 2.0 - height / 2.0); Rectangle rectangle = new Rectangle(0, top, width, height); Brush brush = GetCloneIntersectonBrush(cloneIntersection); g.FillRectangle(brush, rectangle); g.DrawRectangle(Pens.Black, rectangle); } cloneClassBitmaps.Add(cloneClass, cloneClassBitmap); } ToolStripMenuItem cloneItem = new ToolStripMenuItem(); cloneItem.Text = FormattingHelper.FormatCloneForMenu(cloneIntersection.Clone); cloneItem.Image = cloneClassBitmap; contextMenu.Items.Add(cloneItem); ToolStripMenuItem openInEditorItem = new ToolStripMenuItem(); openInEditorItem.Text = Res.MenuOpenInEditor; openInEditorItem.Tag = cloneIntersection.Clone; openInEditorItem.Click += openInEditorToolStripItem_Click; cloneItem.DropDownItems.Add(openInEditorItem); ToolStripMenuItem findAllOccurencesItem = new ToolStripMenuItem(); findAllOccurencesItem.Text = Res.MenuFindAllOccurrences; findAllOccurencesItem.Tag = cloneIntersection.Clone; findAllOccurencesItem.Click += findAllOccurencesToolStripItem_Click; cloneItem.DropDownItems.Add(findAllOccurencesItem); } }
public void show(CloneClass cc) { removeSpawns(); current = cc; height = 0; // Set name className.text = "Clone Class #" + cc.id; Debug.Log(cc.packagelocs.Count); // return; // content.sizeDelta = new Vector2(0, cc.packagelocs.Count*height); int i; int start = offset * 100; int end = Mathf.Min(cc.packagelocs.Count, start + 100); pageNumbers.text = "(" + start + "-" + end + ") out of " + cc.packagelocs.Count; // add locations for (i = start; i < end; i++) { // Spawn at spawnpoint... Height = previousHeight Vector3 pos = new Vector3(Spawnpoint.anchoredPosition.x, Spawnpoint.anchoredPosition.y, Spawnpoint.position.z); GameObject cloneView = Instantiate(PPL_prefab, pos, Spawnpoint.rotation); RectTransform rt = cloneView.GetComponent <RectTransform>(); // Change the height + set previousHeight spawns.Add(cloneView); textHolder th = cloneView.GetComponent <textHolder>(); string package = cc.packagelocs[i].Item1; string location = cc.packagelocs[i].Item2; string before = cc.packagelocs[i].Item3; string code = cc.packagelocs[i].Item4; string after = cc.packagelocs[i].Item5; string[] seperators = new string[] { "\\r\\n" }; string[] beforelines = before.Split(seperators, System.StringSplitOptions.None); string[] codelines = code.Split(seperators, System.StringSplitOptions.None); string[] afterlines = after.Split(seperators, System.StringSplitOptions.None); int lines = beforelines.Length + codelines.Length + afterlines.Length + 6; rt.sizeDelta = new Vector2(rt.sizeDelta.x, lines * 16); // cloneView.transform.position += new Vector3(0, ,0); string printBefore = getPrintLine(beforelines); string printCode = getPrintLine(codelines); string printAfter = getPrintLine(afterlines); if (i == start) { cloneView.transform.position = new Vector3(Spawnpoint.anchoredPosition.x, Spawnpoint.anchoredPosition.y - height + 30 - (rt.sizeDelta.y / 2.5f), Spawnpoint.position.z); height += 30; } else { cloneView.transform.position = new Vector3(Spawnpoint.anchoredPosition.x, Spawnpoint.anchoredPosition.y - height + 30 - (rt.sizeDelta.y / 2), Spawnpoint.position.z); } if (cc.id == 96) { Debug.Log(height); Debug.Log(code); } cloneView.transform.SetParent(Spawnpoint, false); height += (int)rt.sizeDelta.y; printBefore = printBefore.Replace("\\t", "\t"); printCode = printCode.Replace("\\t", "\t"); printAfter = printAfter.Replace("\\t", "\t"); th.input.text = "Package::" + package + "\nLocation::" + location + "\nCode::" + printBefore + "\nSTART OF CLONE" + printCode + "\nEND OF CLONE" + printAfter; } content.sizeDelta = new Vector2(0, height); height = 0; }
public static string FormatCloneClassName(CloneClass cloneClass) { return(String.Format(CultureInfo.CurrentCulture, Res.CloneClassName, cloneClass.Id)); }