public DiffResult SimpleDiff(string left, string right) { // Considering if both strings are null they are equal. if (left == null && right == null) { return(DiffResult.Equal()); } if (left == null || right == null) { return(DiffResult.SizeDoesNotMatch()); } if (left.Length != right.Length) { return(DiffResult.SizeDoesNotMatch()); } // Left and right have equal size. Calculating diff. var diffs = CalculateSimpleDiff(left, right); return(diffs.Count == 0 ? DiffResult.Equal() : DiffResult.Diff(diffs)); }
private void TestWordOnClick(object sender, EventArgs e) { diffMode = DIffMode.Word; result.ListSource = DiffResult.Diff(textA.Text.Split(' '), textB.Text.Split(' ')); }
private void TestCharOnClick(object sender, EventArgs e) { diffMode = DIffMode.Char; result.ListSource = DiffResult.Diff(textA.Text, textB.Text, false); }