public void Execute(IList <string> parameters) { if (parameters.Count > 0) { Information selectedInformation; IList <Information> infos = Informations.GetInformations(parameters[0]).ToList(); if (infos.Count > 0) { if (infos.Count == 1) { selectedInformation = infos[0]; } else { selectedInformation = InformationsUtils.SelectInformation(infos); } if (selectedInformation != null) { Console.WriteLine(string.Format("Running \"{0}\" uninstaller...", selectedInformation.DisplayName)); selectedInformation.Uninstall(); } } else { Console.WriteLine("Not found"); } } }
public void Execute(IList <string> parameters) { if (parameters.Count > 0) { Information selectedInformation; IList <Information> infos = Informations.GetInformations(parameters[0]).ToList(); if (infos.Count > 0) { bool sureToRemove; if (infos.Count == 1) { selectedInformation = infos[0]; sureToRemove = false; } else { selectedInformation = InformationsUtils.SelectInformation(infos); sureToRemove = true; } if (selectedInformation != null) { if (!sureToRemove) { Console.WriteLine("Are you sure to remove the installer of \"{0}\"\r\nfrom the uninstall list, without removing \"{0}\" ? (y/n)", selectedInformation.DisplayName); var answer = Console.ReadKey(true).KeyChar; sureToRemove = answer == 'y'; } if (sureToRemove) { Console.WriteLine(string.Format("\"{0}\" removed from uninstall list.", selectedInformation.DisplayName)); selectedInformation.RemoveFromRegistry(); } } } else { Console.WriteLine("Not found"); } } }