private static void onAppUninstall(Version version) { try { using (var mgr = new Squirrel.UpdateManager(null, "OutlookGoogleCalendarSync")) { log.Info("Removing shortcuts."); mgr.RemoveShortcutsForExecutable(Path.GetFileName(System.Windows.Forms.Application.ExecutablePath), Squirrel.ShortcutLocation.Desktop | Squirrel.ShortcutLocation.StartMenu); String startMenuFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Paul Woolcock"); Directory.Delete(startMenuFolder); log.Debug("Removing registry uninstall keys."); mgr.RemoveUninstallerRegistryEntry(); } if (MessageBox.Show("Sorry to see you go!\nCould you spare 30 seconds for some feedback?", "Uninstalling OGCS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { log.Debug("User opted to give feedback."); System.Diagnostics.Process.Start("https://docs.google.com/forms/d/e/1FAIpQLSfRWYFdgyfbFJBMQ0dz14patu195KSKxdLj8lpWvLtZn-GArw/viewform"); } else { log.Debug("User opted not to give feedback."); } log.Info("Deleting directory " + Path.GetDirectoryName(Program.SettingsFile)); try { log.Logger.Repository.Shutdown(); log4net.LogManager.Shutdown(); Directory.Delete(Path.GetDirectoryName(Program.SettingsFile), true); } catch (System.Exception ex) { try { log.Error(ex.Message); } catch { } } } catch (System.Exception ex) { log.Error("Problem encountered on app uninstall."); OGCSexception.Analyse(ex, true); } }
public async Task CallingMethodTwiceShouldUpdateInstaller() { string remotePkgPath; string path; using (Utility.WithTempDirectory(out path)) { using (Utility.WithTempDirectory(out remotePkgPath)) using (var mgr = new UpdateManager(remotePkgPath, "theApp", path)) { IntegrationTestHelper.CreateFakeInstalledApp("1.0.0.1", remotePkgPath); await mgr.FullInstall(); } using (var mgr = new UpdateManager("http://lol", "theApp", path)) { await mgr.CreateUninstallerRegistryEntry(); var regKey = await mgr.CreateUninstallerRegistryEntry(); Assert.False(String.IsNullOrWhiteSpace((string)regKey.GetValue("DisplayName"))); mgr.RemoveUninstallerRegistryEntry(); } // NB: Squirrel-Aware first-run might still be running, slow // our roll before blowing away the temp path Thread.Sleep(1000); } var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default) .OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall"); using (key) { Assert.False(key.GetSubKeyNames().Contains("theApp")); } }
/// <summary> /// Execute when app is uninstalling /// </summary> /// <param name="version"><see cref="Version"/> version</param> private static void OnAppUninstall(Version version) { using (var manager = new UpdateManager(Constants.UpdateServerUrl)) { manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.Desktop); manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.StartMenu); manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.AppRoot); manager.RemoveUninstallerRegistryEntry(); } }
public async Task Uninstall(string appName = null) { this.Log().Info("Starting uninstall for app: " + appName); appName = appName ?? getAppNameFromDirectory(); using (var mgr = new UpdateManager("", appName)) { await mgr.FullUninstall(); mgr.RemoveUninstallerRegistryEntry(); } }
public async Task Uninstall(string appName = null) { this.Log().Info("Starting uninstall for app: " + appName); // NB: Always basing the rootAppDirectory relative to ours allows us to create Portable // Applications var ourDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ".."); appName = appName ?? getAppNameFromDirectory(); using (var mgr = new UpdateManager("", appName, FrameworkVersion.Net45, ourDir)) { await mgr.FullUninstall(); mgr.RemoveUninstallerRegistryEntry(); } }
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(); } }