Class
OfficeUnifiedDiff
OfficeIMO.Diff
Writes line diffs in the unified format read by patch and git apply.
Inheritance
- object
- OfficeUnifiedDiff
Methods
public static string Create(string? oldText, string? newText, string oldName = "a", string newName = "b", int contextLines = 3, OfficeDiffOptions? options = null, CancellationToken cancellationToken = default) #Compares two texts line by line and writes a unified diff. Returns an empty string when the texts are equal.
Parameters
- oldText string?
- Old text.
- newText string?
- New text.
- oldName string = "a"
- Name on the --- header line.
- newName string = "b"
- Name on the +++ header line.
- contextLines int = 3
- Unchanged lines shown around each change.
- options OfficeIMO.Diff.OfficeDiffOptions? = null
- Diff settings.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the alignment.
Returns
stringpublic static string Format(OfficeDiffResult<OfficeTextToken> lineDiff, string oldName = "a", string newName = "b", int contextLines = 3) #Writes a unified diff for a line diff produced by OfficeDiff.CompareLines.
Parameters
- lineDiff OfficeIMO.Diff.OfficeDiffResult<OfficeIMO.Diff.OfficeTextToken>
- oldName string = "a"
- newName string = "b"
- contextLines int = 3
Returns
string