From f57b3569826b7426cbe83b59206c9ee0a3fc0d16 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Tue, 16 Jan 2024 17:06:44 +0000 Subject: [PATCH] Revert some update manager method name changes --- src/Velopack/UpdateExe.cs | 2 +- src/Velopack/UpdateManager.cs | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Velopack/UpdateExe.cs b/src/Velopack/UpdateExe.cs index 80defab8..28ada599 100644 --- a/src/Velopack/UpdateExe.cs +++ b/src/Velopack/UpdateExe.cs @@ -12,7 +12,7 @@ namespace Velopack /// /// A static helper class to assist in running Update.exe CLI commands. You probably should not invoke this directly, /// instead you should use the relevant methods on . For example: - /// , or . + /// , or . /// public static class UpdateExe { diff --git a/src/Velopack/UpdateManager.cs b/src/Velopack/UpdateManager.cs index a5012c29..f0222848 100644 --- a/src/Velopack/UpdateManager.cs +++ b/src/Velopack/UpdateManager.cs @@ -26,7 +26,7 @@ namespace Velopack /// True if this application is currently installed, and is able to download/check for updates. public virtual bool IsInstalled => Locator.CurrentlyInstalledVersion != null; - /// True if there is a local update prepared that requires a call to to be applied. + /// True if there is a local update prepared that requires a call to to be applied. public virtual bool IsUpdatePendingRestart { get { var latestLocal = Locator.GetLatestLocalFullPackage(); @@ -292,11 +292,22 @@ namespace Velopack /// The user may be prompted during the update, if the update requires additional frameworks to be installed etc. /// You can check if there are pending updates by checking . /// - /// Whether Velopack should restart the app after the updates have been applied. /// The arguments to pass to the application when it is restarted. - public void ApplyPendingUpdate(bool restart = true, string[]? restartArgs = null) + public void ApplyUpdatesAndRestart(string[]? restartArgs = null) { - WaitExitThenApplyPendingUpdate(restart, restartArgs); + WaitExitThenApplyUpdate(true, restartArgs); + Environment.Exit(0); + } + + /// + /// This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified + /// restart arguments. If you need to save state or clean up, you should do that before calling this method. + /// The user may be prompted during the update, if the update requires additional frameworks to be installed etc. + /// You can check if there are pending updates by checking . + /// + public void ApplyUpdatesAndExit() + { + WaitExitThenApplyUpdate(false, null); Environment.Exit(0); } @@ -308,7 +319,7 @@ namespace Velopack /// /// Whether Velopack should restart the app after the updates have been applied. /// The arguments to pass to the application when it is restarted. - public void WaitExitThenApplyPendingUpdate(bool restart = true, string[]? restartArgs = null) + public void WaitExitThenApplyUpdate(bool restart = true, string[]? restartArgs = null) { UpdateExe.Apply(Locator, false, restart, restartArgs, Log); }