public void StartUninstallMonitoring() { logger.Info("Starting uninstall monitoring of Uplay app " + id); Dispose(); cancelToken = new CancellationTokenSource(); var gameInstalled = library.GetInstalledGames().FirstOrDefault(a => a.ProviderId == id) != null; Task.Factory.StartNew(() => { // Uplay is currently 32bit only, but this will future proof this feature var root32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); var root64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); while (!cancelToken.Token.IsCancellationRequested) { var installsKey32 = root32.OpenSubKey(@"SOFTWARE\ubisoft\Launcher\Installs\"); if (installsKey32 != null) { var gameKey = installsKey32.OpenSubKey(id); if (gameKey == null) { logger.Info($"Uplay app {id} has been uninstalled."); GameUninstalled?.Invoke(this, null); return; } } if (Environment.Is64BitOperatingSystem) { var installsKey64 = root64.OpenSubKey(@"SOFTWARE\ubisoft\Launcher\Installs\"); if (installsKey64 != null) { var gameKey = installsKey64.OpenSubKey(id); if (gameKey == null) { logger.Info($"Uplay app {id} has been uninstalled."); GameUninstalled?.Invoke(this, null); return; } } } Thread.Sleep(5000); } }, cancelToken.Token); }
public void StartUninstallMonitoring() { logger.Info("Starting uninstall monitoring of BattleNet app " + app.ProductId); Dispose(); cancelToken = new CancellationTokenSource(); Task.Factory.StartNew(() => { while (!cancelToken.Token.IsCancellationRequested) { var entry = BattleNetLibrary.GetUninstallEntry(app); if (entry == null) { logger.Info($"BattleNet app {app.ProductId} has been uninstalled."); GameUninstalled?.Invoke(this, null); return; } Thread.Sleep(5000); } }, cancelToken.Token); }
private void Watcher_Deleted(object sender, FileSystemEventArgs e) { logger.Info("Steam app {0} uninstalled.", id); GameUninstalled?.Invoke(this, null); }