public static PatcherWaitForFinishHandle CheckForUpdatesCoroutine(this SimplePatchTool patcher, bool checkVersionOnly = true) { if (patcher == null) { return(null); } if (!patcher.IsRunning && !patcher.CheckForUpdates(checkVersionOnly)) { return(null); } return(new PatcherWaitForFinishHandle(patcher)); }
private static void CheckForUpdates() { bool silent = HasArgument("silent"); string versionInfoKeyPath = GetArgument("versionInfoKey"); SimplePatchTool patcher = new SimplePatchTool(GetArgument("root"), GetArgument("versionURL")).SilentMode(silent); if (versionInfoKeyPath != null) { string publicKey = File.ReadAllText(versionInfoKeyPath); patcher.UseVersionInfoVerifier(( ref string xml ) => XMLSigner.VerifyXMLContents(xml, publicKey)); } bool hasStarted = patcher.CheckForUpdates(HasArgument("checkVersionOnly")); if (hasStarted) { while (patcher.IsRunning) { Thread.Sleep(100); string log = patcher.FetchLog(); while (log != null) { LogToConsole(log); log = patcher.FetchLog(); } } if (patcher.Result == PatchResult.Failed) { Console.WriteLine("\nOperation failed: " + patcher.FailReason + " " + (patcher.FailDetails ?? "")); } else if (patcher.Result == PatchResult.AlreadyUpToDate) { Console.WriteLine("\nAlready up-to-date!"); } else { Console.WriteLine("\nThere is an update!"); } } else { Console.WriteLine("\nCould not check for updates; maybe an operation is already running?"); } }
private IEnumerator CheckForUpdates(bool checkVersionOnly) { patchButton.interactable = false; playButton.interactable = true; patcher.LogProgress(false); // = checkVersionOnly = // true (default): only version number (e.g. 1.0) is compared against VersionInfo to see if there is an update // false: hashes and sizes of the local files are compared against VersionInfo (if there are any different/missing files, we'll patch the app) if (patcher.CheckForUpdates(checkVersionOnly)) { Debug.Log("Checking for updates..."); while (patcher.IsRunning) { FetchLogsFromPatcher(); yield return(null); } FetchLogsFromPatcher(); if (patcher.Result == PatchResult.AlreadyUpToDate) { // If launcher is already up-to-date, check if there is an update for the main app if (isPatchingLauncher) { StartMainAppPatch(true); } } else if (patcher.Result == PatchResult.Success) { // There is an update, enable the Patch button patchButton.interactable = true; } else { // An error occurred, user can click the Patch button to try again patchButton.interactable = true; } } else { Debug.LogWarning("Operation could not be started; maybe it is already executing?"); } }
private void CheckForUpdates(bool checkVersionOnly) { // = checkVersionOnly = // true (default): only version number (e.g. 1.0) is compared against VersionInfo to see if there is an update // false: hashes and sizes of the local files are compared against VersionInfo (if there are any different/missing files, we'll patch the app) if (patcher.CheckForUpdates(checkVersionOnly)) { Debug.Log("Checking for updates..."); patchButton.interactable = false; playButton.interactable = true; } else { Debug.LogWarning("Operation could not be started; maybe it is already executing?"); } }
// = checkVersionOnly = // true (default): only version number (e.g. 1.0) is compared against VersionInfo to see if there is an update // false: hashes and sizes of the local files are compared against VersionInfo (if there are any different/missing files, we'll patch the app) private void CheckForUpdates(bool checkVersionOnly) { StartThread(() => { ButtonSetEnabled(patchButton, false); ButtonSetEnabled(playButton, true); patcher.LogProgress(false); if (patcher.CheckForUpdates(checkVersionOnly)) { while (patcher.IsRunning) { FetchLogsFromPatcher(); Thread.Sleep(500); } FetchLogsFromPatcher(); if (patcher.Result == PatchResult.AlreadyUpToDate) { // If launcher is already up-to-date, check if there is an update for the main app if (isPatchingLauncher) { StartMainAppPatch(true); } } else if (patcher.Result == PatchResult.Success) { // There is an update, enable the Patch button ButtonSetEnabled(patchButton, true); } else { // An error occurred, user can click the Patch button to try again ButtonSetEnabled(patchButton, true); } } }); }