public void ShowDifferences(ShowDiffArgs e) { string textA = e.A; string textB = e.B; DiffType diffType = e.DiffType; IList <string> a, b; int leadingCharactersToIgnore = 0; bool fileNames = diffType == DiffType.File; if (fileNames) { GetFileLines(textA, textB, out a, out b, out leadingCharactersToIgnore); } else { GetTextLines(textA, textB, out a, out b); } bool isBinaryCompare = leadingCharactersToIgnore > 0; bool ignoreCase = isBinaryCompare ? false : Options.IgnoreCase; bool ignoreTextWhitespace = isBinaryCompare ? false : Options.IgnoreTextWhitespace; TextDiff diff = new TextDiff(Options.HashType, ignoreCase, ignoreTextWhitespace, leadingCharactersToIgnore, !Options.ShowChangeAsDeleteInsert); EditScript script = diff.Execute(a, b); string captionA = string.Empty; string captionB = string.Empty; if (fileNames) { captionA = textA; captionB = textB; this.Text = string.Format("{0} : {1}", Path.GetFileName(textA), Path.GetFileName(textB)); } else { this.Text = "Text Comparison"; } // Apply options first since SetData needs to know things // like SpacesPerTab and ShowWhitespace up front, so it // can build display lines, determine scroll bounds, etc. this.ApplyOptions(); this.DiffCtrl.SetData(a, b, script, captionA, captionB, ignoreCase, ignoreTextWhitespace, isBinaryCompare); if (Options.LineDiffHeight != 0) { this.DiffCtrl.LineDiffHeight = Options.LineDiffHeight; } this.Show(); this.currentDiffArgs = e; }
public void ShowDifferences(ShowDiffArgs e) { DirectoryDiff diff = new DirectoryDiff( Options.ShowOnlyInA, Options.ShowOnlyInB, Options.ShowDifferent, Options.ShowSame, Options.Recursive, Options.IgnoreDirectoryComparison, Options.FileFilter); DirectoryDiffResults results = diff.Execute(e.A, e.B); this.DiffCtrl.SetData(results); this.Text = string.Format("{0} : {1}", results.DirectoryA.Name, results.DirectoryB.Name); this.Show(); this.lastDiffArgs = e; }