-
-
Notifications
You must be signed in to change notification settings - Fork 53
Scripting API Utilities
Namespace: SimplePatchToolCore
static VersionCode PatchUtils.GetVersion( string rootPath, string projectName )
: returns the current version of an app residing in rootPath. Here, projectName should match the Name element of the app's VersionInfo
static string PatchUtils.GetCurrentAppVersion( string projectName = null, string rootPath = null )
: finds the currently running app's version by searching its directory for any version holder (.sptv) files. If none found, returns null. If you know the Name of the project's VersionInfo, you should enter it to projectName. If you know the absolute path of this app's root path, you should enter it to rootPath
static bool PatchUtils.CheckWriteAccessToFolder( string path )
: returns whether or not we have permission to write to the specified folder. SimplePatchTool automatically calls this function before downloading any patch files
static string PatchUtils.GetCurrentExecutablePath()
: returns the path of the currently running executable (the application itself). Can be used to get the absolute path of the application directory or its value can be passed to the postSelfPatchExecutable parameter of the SimplePatchTool.ApplySelfPatch function to restart the app after self patching finishes
static string PatchUtils.GetDefaultSelfPatcherExecutablePath( string selfPatcherExecutableName = "SelfPatcher.exe" )
: returns a path that a self patcher executable with name selfPatcherExecutableName would be expected to be stored at. The returned path will be formed like this: {ROOT_PATH}\{PatchParameters.SELF_PATCHER_DIRECTORY}\{selfPatcherExecutableName}
static int PatchUtils.GetNumberOfRunningProcesses( string executablePath )
: returns the number of running instances of the specified executable. Can be used to check e.g. if another instance of this app is running or if the app/launcher that is to be updated is currently running. Before applying a patch, you should make sure that this is the only running instance of this app and any executables inside the application directory are not running
static void PatchUtils.AddIgnoredPath( this VersionInfo versionInfo, string ignoredPath )
: adds an ignored path to the specified VersionInfo at runtime. To fetch SimplePatchTool's VersionInfo at runtime, you need to register a SimplePatchTool.IListener object to it and wait for the VersionInfoFetched callback
In addition to these functions, there are some static variables and constants in the PatchParameters class that can be used to customize the default behaviour of SimplePatchTool. For example, hashes of files that are larger than PatchParameters.FileHashCheckSizeLimit are not calculated while checking whether or not they are genuine.