/// <summary> /// Saves the current text of the resolved editor. /// </summary> protected virtual void SaveEdits() { // You can't save if there are conflicts. if (currentDiffInfo.ConflictRanges.Count > 0) { MessageBox.Show(this, "You cannot save if there are conflicts remaining to merge.", "Cannot save", MessageBoxButtons.OK); return; } StringBuilder sb = new StringBuilder(); foreach (DocumentLine line in editorResolved.Document.Lines) { if (line.BackColor != VirtualLineColour) { sb.AppendLine(line.Text); } } fileInformation.MergedFile = new TextFile(sb.ToString()); fileInformation.PerformDiff(); HasUnsavedChanges = false; TriggerMergedFileSavedEvent(); Reset(); }
public void SetupAndPerformDiff(string user, string prevGen, string newGen) { tfi = new TextFileInformation(); tfi.UserFile = string.IsNullOrEmpty(user) ? TextFile.Blank : new TextFile(user); tfi.NewGenFile = string.IsNullOrEmpty(newGen) ? TextFile.Blank : new TextFile(newGen); tfi.PrevGenFile = string.IsNullOrEmpty(prevGen) ? TextFile.Blank : new TextFile(prevGen); tfi.PerformDiff(); }
private void selectMatchToolStripMenuItem_Click(object sender, EventArgs e) { FormSelectMatch form = new FormSelectMatch(fileInformation, treeListObjects.SelectedNode.Tag as CodeRootMapNode); form.SetSyntaxLanguage(Utility.GetSyntaxLanguageForFileInformation(fileInformation)); form.ShowDialog(); fileInformation.PerformDiff(); FireFileUpdatedEvent(); PopulateGrid(); }
protected void SetupAndPerformDiffWithMD5s(string user, string prevGen, string newGen) { tfi = new TextFileInformation(); tfi.UserFile = string.IsNullOrEmpty(user) ? TextFile.Blank : new TextFile(user); tfi.NewGenFile = string.IsNullOrEmpty(newGen) ? TextFile.Blank : new TextFile(newGen); tfi.PrevGenFile = string.IsNullOrEmpty(prevGen) ? TextFile.Blank : new TextFile(prevGen); tfi.SetPreviousVersionMD5s(Utility.GetCheckSumOfString(prevGen), Utility.GetCheckSumOfString(newGen), Utility.GetCheckSumOfString(user)); tfi.RelativeFilePath = "Class.cs"; tfi.PerformDiff(); }
public CodeTestForm() { InitializeComponent(); if (DesignMode == false) { TextFileInformation tfi = new TextFileInformation(); tfi.PrevGenFile = new TextFile("namespace Test{\npublic class TestClass {\npublic int i;\npublic void FunctionName() {\ni = 0;\n}\n}\n}"); tfi.NewGenFile = new TextFile("namespace Test{\npublic class TestClass {\npublic int i;\npublic int j;\npublic void FunctionName() {\ni = 0;\nj = 0;\n}\n}\n}"); tfi.UserFile = new TextFile("namespace Test{\npublic class TestClass {\npublic int i;\npublic int j;\npublic void FunctionName() {\nk = 0;\ni = 0;\n}\n}\n}"); tfi.RelativeFilePath = "Test.cs"; tfi.IntelliMerge = IntelliMergeType.CSharp; tfi.PerformDiff(); ucCodeMergeEditor codeMergeEditor = new ucCodeMergeEditor(tfi); codeMergeEditor.Dock = DockStyle.Fill; this.Controls.Add(codeMergeEditor); } }
public void TestInvalidDiff_NoFiles() { TextFileInformation tfi = new TextFileInformation(); tfi.PerformDiff(); }