-
-
Notifications
You must be signed in to change notification settings - Fork 52
Project: Generating Patch
To create a patch for e.g. version 1.1.0 of your app, you should create a new subdirectory inside the project's Versions directory named 1.1.0
and copy/move your app's files and folders inside this subdirectory.
If you'd like to customize how your patch will be created, now is the time to edit your project's Settings.xml:
- CreateRepairPatch: sets whether or not a repair patch should be generated
- CreateInstallerPatch: sets whether or not an installer patch should be generated
- CreateIncrementalPatch: sets whether or not an incremental patch should be generated. If there are only one versions in the Versions directory, then no incremental patch will be generated regardless of this setting
-
CreateIncrementalPatchesFromEachPreviousVersionToNewVersion: assume there are 3 versions in the Versions directory:
0.8
,0.9
and1.0
. If this value is set to true, then incremental patches for both0.8->1.0
and0.9->1.0
will be generated. Otherwise, only the0.9->1.0
incremental patch will be generated. Please note that if CreateIncrementalPatch is set to false, then no incremental patches will be generated regardless of this setting - BinaryDiffQuality: as this value increases, produced incremental patches will be smaller but it will take more time to calculate the binary diff files. Note that increasing this value will have no effect after some point (usually, higher values than the default value will produce the same binary diff file)
- CompressionFormatRepairPatch: the compression algorithm used to compress the repair patch files (LZMA, GZIP or NONE)
- CompressionFormatInstallerPatch: the compression algorithm used to compress the installer patch files (LZMA, GZIP or NONE)
- CompressionFormatIncrementalPatch: the compression algorithm used to compress the incremental patch files (LZMA, GZIP or NONE)
-
BaseDownloadURL: automatically sets the
<BaseDownloadURL>
of the generated VersionInfo. For more information, please see Updating Download Links in VersionInfo -
MaintenanceCheckURL: automatically sets the
<MaintenanceCheckURL>
of the generated VersionInfo. For more information, please see Checking For Maintenance - IgnoredPaths: the paths that SimplePatchTool will ignore
-
IsSelfPatchingApp: if set to true, contents of the project's SelfPatcher directory will automatically be copied to the latest version's subdirectory before generating the patch. So, if your app is a self patching app, you can copy the self patcher executable with any of its dependencies inside the SelfPatcher directory and it will automatically be copied to your versions. Then, at runtime, you can fetch the path of that self patcher executable via
PatchUtils.GetDefaultSelfPatcherExecutablePath("SelfPatcher.exe")
. If the SelfPatcher directory is empty, then this setting will have no effect - Name: a unique name for your SimplePatchTool project. This name is used in several key locations, so give it a meaningful name with low collision chance and try not to change it after releasing the first version of your app. Name can contain only English letters and numbers
You can now generate the patch using one of the following methods. Note that after generating a patch, the patch files (including VersionInfo.info) will be located inside the project's Output directory.
Use the Patcher project_generate_patch
command. It takes the following arguments:
- projectRoot: path of the project's directory
- silent: (optional)(flag) progress will not be logged to the console
Example: Patcher project_generate_patch -projectRoot="C:\MyProject"
Namespace: SimplePatchToolCore
public ProjectManager( string projectRoot )
: creates a new ProjectManager instance. It takes the path of the project directory as parameter
ProjectManager SilentMode( bool silent )
: sets whether or not ProjectManager should log anything
bool GeneratePatch()
: starts generating the patch asynchronously in a separate thread. This function will return false, if ProjectManager is already running
There are two ways to fetch ProjectManager's progress:
- 1. Calling the following methods and properties manually from time to time
string FetchLog()
: fetches the next log that ProjectManager has generated. Returns null, if there is no log in the queue
void Cancel()
: cancels the operation
bool IsRunning { get; }
: returns true if ProjectManager is currently running
- 2. Using a ProjectManager.IListener object
You can register a listener to ProjectManager using the SetListener
function. This listener will receive the following callbacks:
void LogReceived( string log );
void Finished(); // ProjectManager finished running
Be aware that any expensive operations performed in these callbacks will block the ProjectManager's thread.
PatchResult Result { get; }
: returns PatchResult.Success if patch is created successfully, PatchResult.Failed otherwise. Its value should be checked after IsRunning returns false
Example code: SimplePatchToolConsoleApp.Program.ProjectGeneratePatch
Simply open the Window-Simple Patch Tool window, enter the project directory's path and click Generate Patch.