Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Project: Generating Patch

Süleyman Yasir KULA edited this page May 15, 2020 · 11 revisions

To create a patch for e.g. version 1.1.0 of your app, you should create a new subdirectory named 1.1.0 inside the project's Versions folder and copy/move your app's files there. Then, you can then generate the patch using one of the following methods (generated patch files will be located inside the project's Output folder):

Click here to show/hide

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"

Via Scripting API

Click here to show/hide

Namespace: SimplePatchToolCore

Creating ProjectManager

public ProjectManager( string projectRoot ): creates a new ProjectManager instance. It takes the path of the project directory as parameter

Configuring ProjectManager

ProjectManager SilentMode( bool silent ): sets whether or not ProjectManager should log anything

Executing ProjectManager

bool GeneratePatch(): starts generating the patch asynchronously in a separate thread. This function will return false, if ProjectManager is already running

Fetching ProjectManager's progress

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.

Fetching the result of the operation

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

Click here to show/hide

unity-create-tab

Simply open the Window-Simple Patch Tool window, enter the project directory's path and click Generate Patch.

Clone this wiki locally