private static async void Update(Task<string> result) { if (result.Result == null || result.Result != "1") return; try { using (var mgr = new UpdateManager(@"https://releases.noelpush.com/", "NoelPush")) { var updates = await mgr.CheckForUpdate(); if (updates.ReleasesToApply.Any()) { var lastVersion = updates.ReleasesToApply.OrderBy(x => x.Version).Last(); await mgr.DownloadReleases(updates.ReleasesToApply); await mgr.ApplyReleases(updates); var latestExe = Path.Combine(mgr.RootAppDirectory, string.Concat("app-", lastVersion.Version), "NoelPush.exe"); mgr.Dispose(); RestartAppEvent(); UpdateManager.RestartApp(latestExe); } mgr.Dispose(); } } catch (Exception e) { LogManager.GetCurrentClassLogger().Error(e.Message); } }
private async void Callback(object state) { Squirrel.UpdateManager manager = null; try { if (_settings.UpdatePreference == UpdatePreference.Developer) { manager = await Squirrel.UpdateManager.GitHubUpdateManager(GithubProjectUrl, null, null, null, true); } else { manager = await Squirrel.UpdateManager.GitHubUpdateManager(GithubProjectUrl); } //workaround since update manager apparently sucks await manager.UpdateApp().ConfigureAwait(false); } catch (Exception e) { _log.FatalException("Failed to update app " + e.Message, e); } finally { if (manager != null) { manager.Dispose(); } } }
public static void InstallEvent() { var exePath = Assembly.GetEntryAssembly().Location; var appName = Path.GetFileName(exePath); using (var mgr = new UpdateManager(@"https://releases.noelpush.com/", "NoelPush")) { mgr.CreateShortcutsForExecutable(appName, ShortcutLocation.StartMenu | ShortcutLocation.Startup, false); mgr.CreateUninstallerRegistryEntry(); mgr.Dispose(); } }
public static void UninstallEvent() { using (var mgr = new UpdateManager(@"https://releases.noelpush.com/", "NoelPush")) { mgr.RemoveShortcutsForExecutable("NoelPush.exe", ShortcutLocation.StartMenu); mgr.RemoveShortcutsForExecutable("NoelPush.exe", ShortcutLocation.Startup); mgr.RemoveUninstallerRegistryEntry(); mgr.Dispose(); } }
public static void UpdateEvent() { using (var mgr = new UpdateManager(@"https://releases.noelpush.com/", "NoelPush")) { mgr.CreateShortcutsForExecutable("NoelPush.exe", ShortcutLocation.StartMenu | ShortcutLocation.Startup, false); mgr.Dispose(); } }