internal static async Task <int> MainAsync(CommandLineArguments cmd) { var updater = new ApplicationUpdater("https://api.github.com/repos/DavidMoore/ElvUI.Updater/releases"); switch (cmd.Command) { case Command.None: break; case Command.Cleanup: var cleanupArgs = new CleanupArgs(); cleanupArgs.Target = cmd.Target; await updater.CleanupAsync(cleanupArgs); break; case Command.Install: await updater.InstallAsync(); break; case Command.Update: // Check, download and launch an update, then return immediately so the update can run. var updateArgs = new UpdateCheckArgs(); updateArgs.AllowPreRelease = true; await updater.UpdateAsync(updateArgs); return(0); case Command.ApplyUpdate: // We enter here when a downloaded update is running so it can overwrite the old exe var applyUpdateArgs = new ApplyUpdateArgs(); applyUpdateArgs.Launch = cmd.Launch; await updater.ApplyUpdateAsync(applyUpdateArgs); break; case Command.Uninstall: var uninstallArgs = new UninstallArgs(); uninstallArgs.Silent = cmd.Silent; await updater.UninstallAsync(uninstallArgs); return(0); case Command.Service: break; default: throw new ArgumentOutOfRangeException(); } return(1); }