private void ProcessSquirrelStartup() { #if !DEBUG using (var mgr = new Squirrel.UpdateManager(string.Empty)) { // Note, in most of these scenarios, the app exits after this method // completes! SquirrelAwareApp.HandleEvents( onInitialInstall: v => { mgr.CreateShortcutForThisExe(); UriProtocolManager.RegisterUrlProtocol(); Environment.Exit(0); }, onAppUpdate: v => { mgr.CreateShortcutForThisExe(); Environment.Exit(0); }, onAppUninstall: v => { mgr.RemoveShortcutForThisExe(); UriProtocolManager.UnregisterUrlProtocol(); AppContracts contracts = new AppContracts(); var settingsPersistor = new JsonPersister <AppSettings>(Path.Combine(contracts.SettingsLocation, contracts.SettingsFilename)); string dir = Path.Combine(string.IsNullOrEmpty(settingsPersistor.Instance.CacheFolder) ? contracts.SettingsLocation : settingsPersistor.Instance.CacheFolder, CoverService.CacheDirName); var log = new ProductionLogger(); log.Fatal("Uninstalling Minipie. Removing CoverCache from ->" + dir); try { if (Directory.Exists(dir)) { Directory.Delete(dir, true); } } catch (Exception e) { log.FatalException(e.Message, e); } Environment.Exit(0); }, onFirstRun: () => { }); } #endif }
static void Main(string[] args) { foreach (var arg in args) { if (arg == "registerUri") { UriProtocolManager.RegisterUrlProtocol(); } else if (arg == "unregisterUri") { UriProtocolManager.UnregisterUrlProtocol(); } } }