ReplicaNet and RNLobby  1
Public Member Functions | List of all members
Patcher Class Reference

#include <Patcher.h>

Public Member Functions

int GeneratePatch (const char *sourcePath, const char *newPath, const char *patchPath, const size_t level=5)
 
bool PatchFile (const char *sourcePath, const char *patchPath, const char *destinationPath)
 
virtual bool CallbackScanning (const size_t filePos, const size_t fileMax)
 

Detailed Description

This class generates minimal patches for binary files and also patches files to produce new versions of those files. No checking of file integrity is carried out before a patch is applied because this is a file version problem which is the domain of another set of support classes.

Member Function Documentation

virtual bool CallbackScanning ( const size_t  filePos,
const size_t  fileMax 
)
virtual

A virtual callback that is triggered when the scanning status is updated.

Returns
True allows the scan to continue. False terminates the scan as quickly as possible.
int GeneratePatch ( const char *  sourcePath,
const char *  newPath,
const char *  patchPath,
const size_t  level = 5 
)

Generates a patch from sourcePath compared with newPath and stores the result in patchPath.

Parameters
sourcePathThe original file path.
newPathThe new file path.
patchPathThe destination file path for the patch file.
levelThe compression level to use. 10 gives the best compression but is slow and uses more memory. 1 is fast, uses less memory but does not compress as well. The default is 5 giving reasonable performance.
Returns
The length of the generated patch file. This can be zero and indicates the two files are identical. A negative value indicates an error occurred.
bool PatchFile ( const char *  sourcePath,
const char *  patchPath,
const char *  destinationPath 
)

Combines a file from sourcePath with a patch file from patchPath and stores the resultant file in destinationPath.

Parameters
sourcePathThe original file path.
patchPathThe patch file path.
destinationPathThe destination file path for the combined file.
Returns
Success returns true. False indicates an error occurred.