private static void RunExternalCommands(string commands, LoadingDialog.LoadingDialogInterface controller) { var lines = commands.SplitNewlines(StringSplitOptions.RemoveEmptyEntries); controller.SetMaximum(lines.Length); for (var i = 0; i < lines.Length; i++) { controller.SetProgress(i); var line = lines[i]; try { var filename = ProcessTools.SeparateArgsFromCommand(line); filename.FileName = Path.GetFullPath(filename.FileName); if (!File.Exists(filename.FileName)) { throw new IOException(Localisable.Error_FileNotFound); } filename.ToProcessStartInfo().StartAndWait(); } catch (Exception ex) { MessageBox.Show(string.Format(Localisable.MessageBoxes_ExternalCommandFailed_Message, line) + Localisable.MessageBoxes_Error_details + ex.Message, Localisable.MessageBoxes_ExternalCommandFailed_Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ListRefreshThread(LoadingDialog.LoadingDialogInterface dialogInterface) { dialogInterface.SetMaximum(1); dialogInterface.SetProgress(0); var detectedUninstallers = new List <ApplicationUninstallerEntry>(ApplicationUninstallerManager.GetUninstallerList(x => { if (x.CurrentCount == 1) { dialogInterface.SetMaximum(x.TotalCount * 2); } dialogInterface.SetProgress(x.CurrentCount); })); detectedUninstallers.AddRange( ApplicationUninstallerManager.GetApplicationsFromDrive(detectedUninstallers, x => { dialogInterface.SetProgress(x.TotalCount + x.CurrentCount); if (x.CurrentCount == 1) { dialogInterface.SetMaximum(x.TotalCount * 2); } })); if (Program.IsInstalled) { detectedUninstallers.RemoveAll(entry => entry.RegistryKeyName.IsNotEmpty() && entry.RegistryKeyName.Equals(Program.InstalledRegistryKeyName, StringComparison.InvariantCultureIgnoreCase)); } if (_settings.Settings.QuietAutomatization && Program.Net4IsAvailable) { QuietUninstallTools.GenerateQuietCommands(detectedUninstallers, _settings.Settings.QuietAutomatizationKillStuck); } try { detectedUninstallers.AddRange(ApplicationUninstallerManager.GetWindowsFeaturesList()); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } AllUninstallers = detectedUninstallers; dialogInterface.SetProgress(1); dialogInterface.SetMaximum(1); try { _iconGetter.UpdateIconList(detectedUninstallers); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } try { ReassignStartupEntries(false); } catch (Exception ex) { PremadeDialogs.GenericError(ex); } }