public static DiffReport Create(string a, string b, params char[] separators) { DiffReport report = new DiffReport(); Diff.Item[] f = Diff.DiffText(a, b, true, true, false, separators); string[] aLines = a.Split(separators); string[] bLines = b.Split(separators); int n = 1; for (int fdx = 0; fdx < f.Length; fdx++) { Diff.Item aItem = f[fdx]; // write unchanged lines while ((n - 1 < aItem.StartB) && (n - 1 < bLines.Length)) { report.AddLine <DiffReportToken>(n, bLines[n - 1]); n++; } // while // write deleted lines for (int m = 0; m < aItem.deletedA; m++) { report.AddLine <DeletedDiffReportToken>(-1, aLines[aItem.StartA + m]); } // for // write inserted lines while (n - 1 < aItem.StartB + aItem.insertedB) { report.AddLine <InsertedDiffReportToken>(n, bLines[n - 1]); n++; } // while } // while // write rest of unchanged lines while (n - 1 < bLines.Length) { report.AddLine <DiffReportToken>(n, bLines[n - 1]); n++; } // while return(report); }
public DiffReportFormatter(DiffReport diffReport) { this.DiffReport = diffReport; }
public HtmlTableDiffReportFormatter(DiffReport report) : base(report) { }