private static LauncherErrorCode Uninstall() { try { // Kill all running processes var path = new UFile(Assembly.GetEntryAssembly().Location).GetFullDirectory().ToWindowsPath(); if (!UninstallHelper.CloseProcessesInPath(DisplayMessage, "Stride", path)) { return(LauncherErrorCode.UninstallCancelled); // User cancelled } // Uninstall packages (they might have uninstall actions) var store = new NugetStore(path); foreach (var package in store.MainPackageIds.SelectMany(store.GetLocalPackages).FilterStrideMainPackages().ToList()) { store.UninstallPackage(package, null).Wait(); } foreach (var remainingFiles in Directory.GetFiles(path, "*.lock").Concat(Directory.GetFiles(path, "*.old"))) { try { File.Delete(remainingFiles); } catch (Exception e) { e.Ignore(); } } PrivacyPolicyHelper.RevokeAllPrivacyPolicy(); return(LauncherErrorCode.Success); } catch (Exception) { return(LauncherErrorCode.ErrorWhileUninstalling); } }