private void GetSummary() { _sheetDifferences.Clear(); for (int i = 0; i < leftWorkbook.sheetNames.Count; i++) { string sheetName = leftWorkbook.sheetNames[i]; if (rightWorkbook.sheetNames.Contains(sheetName)) { ExcelSheet leftExcelSheet = leftWorkbook.LoadSheet(sheetName); ExcelSheet rightExcelSheet = rightWorkbook.LoadSheet(sheetName); int columnCount = Math.Max(leftExcelSheet.columnCount, rightExcelSheet.columnCount); VSheet leftSheet = new VSheet(leftExcelSheet, columnCount); VSheet rightSheet = new VSheet(rightExcelSheet, columnCount); diff_match_patch comparer = new diff_match_patch(); string leftContent = leftSheet.GetContent(); string rightContent = rightSheet.GetContent(); List <Diff> diffs = comparer.diff_main(leftContent, rightContent, true); comparer.diff_cleanupSemanticLossless(diffs); bool isDifferent = false; for (int diffIndex = 0; diffIndex < diffs.Count; diffIndex++) { if (diffs[diffIndex].operation != Operation.EQUAL) { isDifferent = true; break; } } _sheetDifferences.Add(sheetName, isDifferent); } } }
private static IList <YXEditOperation> GetOperations(string a, string b) { diff_match_patch dmp = new diff_match_patch(); List <Diff> diffs = dmp.diff_main(a, b); dmp.diff_cleanupSemanticLossless(diffs); YXEditOperationDiffAdapter adapter = new YXEditOperationDiffAdapter(); return(adapter.Adapt(diffs)); }
private void button1_Click(object sender, EventArgs e) { diffs = DIFF.diff_main(RTB1.Text, RTB2.Text); DIFF.diff_cleanupSemanticLossless(diffs); // <--- see note ! chunklist1 = collectChunks(RTB1); chunklist2 = collectChunks(RTB2); paintChunks(RTB1, chunklist1); paintChunks(RTB2, chunklist2); RTB1.SelectionLength = 0; RTB2.SelectionLength = 0; }
void paintboxes() { diffs = DIFF.diff_main(RTB3.Text, RTB2.Text); DIFF.diff_cleanupSemanticLossless(diffs); chunklist1 = collectChunks(RTB3); chunklist2 = collectChunks(RTB2); paintChunks(RTB3, chunklist1); paintChunks(RTB2, chunklist2); RTB3.SelectionLength = 0; RTB2.SelectionLength = 0; }
private void DoDiff() { _diffList = _diff.diff_main(leftText.Text, rightText.Text); _diff.diff_cleanupSemanticLossless(_diffList); _chunklist1 = CollectChunks(leftText); _chunklist2 = CollectChunks(rightText); PaintChunks(leftText, _chunklist1); PaintChunks(rightText, _chunklist2); leftText.SelectionLength = 0; rightText.SelectionLength = 0; }
private void StartComparision_Click(object sender, RoutedEventArgs e) { RTB1 = fileComparisionForm.textboxAOutput; RTB2 = fileComparisionForm.textboxBOutput; MessageLabel.Visibility = Visibility.Hidden; if (string.IsNullOrEmpty(SelectFile1.Text) || string.IsNullOrEmpty(SelectFile2.Text)) { MessageLabel.Content = "Files path should not be empty!!"; MessageLabel.Visibility = Visibility.Visible; return; } try { string file1Text = File.ReadAllText(SelectFile1.Text, Encoding.UTF8); string file2Text = File.ReadAllText(SelectFile2.Text, Encoding.UTF8); diffs = DIFF.diff_main(file1Text, file2Text); DIFF.diff_cleanupSemanticLossless(diffs); // <--- see note ! chunklist1 = collectChunks(RTB1); chunklist2 = collectChunks(RTB2); paintChunks(RTB1, chunklist1); paintChunks(RTB2, chunklist2); RTB1.SelectionLength = 0; RTB2.SelectionLength = 0; } catch (Exception) { MessageLabel.Content = "Files are not valid!"; MessageLabel.Visibility = Visibility.Visible; return; } fileComparisionForm.Show(); }
public void Compare_temp() { List <Diff> diffs = new List <Diff>(); var diffList1 = new List <DocDiff>(); var diffList2 = new List <DocDiff>(); diff_match_patch DIFF = new diff_match_patch(); diffs = DIFF.diff_main(this._oldText, this._newText); DIFF.diff_cleanupSemanticLossless(diffs); // <--- see note ! // diffList1 = collectDiffs(this._oldText, this._newText, diffs); var finalText = collectDiffs(this._oldText, this._newText, diffs); this._html = finalText; // diffList2 = collectDiffs(RTB2); // paintChunks(RTB1, chunklist1); // paintChunks(RTB2, chunklist2); }