Diff : Algorithm.Diff Namespace
UnifiedDiff

A utility class for generating diffs in the unified diff format.

public class UnifiedDiff


Remarks
This class has several static members for outputting Algorithm.Diff.Diffs in the unified diff format.
Members

See Also: Inherited members from object.

Methods
static WriteUnifiedDiff (Diff, System.IO.TextWriter)
Writes a diff in unified diff format to a TextWriter.
static WriteUnifiedDiff (Diff, System.IO.TextWriter, string, string, int)
Writes a diff in unified diff format to a TextWriter with the give file names and context.
static WriteUnifiedDiff (string, string, System.IO.TextWriter, int, bool, bool)
Writes out a line-by-line diff in unified diff format for the two files, specifying whether the comparison is case-sensitive and whitespace-sensitive.
static WriteUnifiedDiff (string[], string, string[], string, System.IO.TextWriter, int, bool, bool)
Writes out a line-by-line diff in unified diff format for the two documents, specifying whether the comparison is case-sensitive and whitespace-sensitive and the number of context lines.
Member Details
WriteUnifiedDiff
public static void WriteUnifiedDiff (string[] leftLines, string leftName, string[] rightLines, string rightName, System.IO.TextWriter writer, int context, bool caseSensitive, bool compareWhitespace)

Writes out a line-by-line diff in unified diff format for the two documents, specifying whether the comparison is case-sensitive and whitespace-sensitive and the number of context lines.

Parameters
leftLines
The lines of the left document.
leftName
The name of the left document.
rightLines
The lines of the right document.
rightName
The name of the right document.
writer
The output TextWriter.
context
The number of context lines to include.
caseSensitive
Whether the comparisons are case-sensitive.
compareWhitespace
Whether the comparison should be aware of changes in whitespace.
Remarks
None.

WriteUnifiedDiff
public static void WriteUnifiedDiff (string leftFile, string rightFile, System.IO.TextWriter writer, int context, bool caseSensitive, bool compareWhitespace)

Writes out a line-by-line diff in unified diff format for the two files, specifying whether the comparison is case-sensitive and whitespace-sensitive.

Parameters
leftFile
The file name for the left document.
rightFile
The file name for the right document.
writer
The output TextWriter.
context
The number of lines of context to include.
caseSensitive
Whether the comparisons are case-sensitive.
compareWhitespace
Whether the comparison should be aware of changes in whitespace.
Remarks
None.

WriteUnifiedDiff
public static void WriteUnifiedDiff (Diff diff, System.IO.TextWriter writer)

Writes a diff in unified diff format to a TextWriter.

Parameters
diff
A Diff object that already has the differences between two documents.
writer
The output TextWriter.
Remarks
The default number of lines of context is used.

WriteUnifiedDiff
public static void WriteUnifiedDiff (Diff diff, System.IO.TextWriter writer, string fromfile, string tofile, int context)

Writes a diff in unified diff format to a TextWriter with the give file names and context.

Parameters
diff
A Diff object that already has the differences between two documents.
writer
The output TextWriter.
fromfile
The name of the left document.
tofile
The name of the right document.
context
The number of lines of context to include.
Remarks
None.