C# Class NGit.Patch.Patch

A parsed collection of FileHeader s from a unified diff patch file
Show file Open project: red-gate/ngit Class Usage Examples

Public Methods

Method Description
AddError ( NGit.Patch.FormatError err ) : void

Add a formatting error to this patch script.

Add a formatting error to this patch script.

AddFile ( NGit.Patch.FileHeader fh ) : void

Add a single file to this patch.

Add a single file to this patch.

Typically files should be added by parsing the text through one of this class's parse methods.

GetErrors ( ) : IList
GetFiles ( ) : IList
Parse ( InputStream @is ) : void

Parse a patch received from an InputStream.

Parse a patch received from an InputStream.

Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).

Parse ( byte buf, int ptr, int end ) : void

Parse a patch stored in a byte[].

Parse a patch stored in a byte[].

Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).

Patch ( ) : System.Collections.Generic

Create an empty patch.

Create an empty patch.

Private Methods

Method Description
Error ( byte buf, int ptr, string msg ) : void
MatchAny ( byte buf, int c, byte srcs ) : bool
ParseDiffCombined ( byte hdr, byte buf, int start, int end ) : int
ParseDiffGit ( byte buf, int start, int end ) : int
ParseFile ( byte buf, int c, int end ) : int
ParseGitBinary ( NGit.Patch.FileHeader fh, int c, int end ) : int
ParseHunks ( NGit.Patch.FileHeader fh, int c, int end ) : int
ParseTraditionalPatch ( byte buf, int start, int end ) : int
ReadFully ( InputStream @is ) : byte[]
SkipFile ( byte buf, int ptr ) : int
Warn ( byte buf, int ptr, string msg ) : void

Method Details

AddError() public method

Add a formatting error to this patch script.
Add a formatting error to this patch script.
public AddError ( NGit.Patch.FormatError err ) : void
err NGit.Patch.FormatError the error description.
return void

AddFile() public method

Add a single file to this patch.
Add a single file to this patch.

Typically files should be added by parsing the text through one of this class's parse methods.

public AddFile ( NGit.Patch.FileHeader fh ) : void
fh NGit.Patch.FileHeader the header of the file.
return void

GetErrors() public method

public GetErrors ( ) : IList
return IList

GetFiles() public method

public GetFiles ( ) : IList
return IList

Parse() public method

Parse a patch received from an InputStream.
Parse a patch received from an InputStream.

Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).

there was an error reading from the input stream. ///
public Parse ( InputStream @is ) : void
@is Sharpen.InputStream
return void

Parse() public method

Parse a patch stored in a byte[].
Parse a patch stored in a byte[].

Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).

public Parse ( byte buf, int ptr, int end ) : void
buf byte the buffer to parse.
ptr int starting position to parse from.
end int /// 1 past the last position to end parsing. The total length to /// be parsed is end - ptr. ///
return void

Patch() public method

Create an empty patch.
Create an empty patch.
public Patch ( ) : System.Collections.Generic
return System.Collections.Generic