Esempio n. 1
0
        /// <summary>
        /// Load a list silently from filename
        /// </summary>
        /// <param name="filename">Filename of the list</param>
        public void LoadUninstallList(string filename)
        {
            var result = UninstallList.ReadFromFile(filename);

            CurrentListFilename = filename;
            uninstallListEditor1.CurrentList = result;
        }
Esempio n. 2
0
 private void openFileDialog_FileOk(object sender, CancelEventArgs e)
 {
     try
     {
         CurrentList.AddItems(UninstallList.ReadFromFile(openFileDialog.FileName).Filters);
         PopulateList();
     }
     catch (Exception ex)
     {
         PremadeDialogs.GenericError(ex);
         e.Cancel = true;
     }
 }
        /// <summary>
        /// Load a list silently from filename
        /// </summary>
        /// <param name="fileName">Filename of the list</param>
        public void LoadUninstallList(string fileName)
        {
            try
            {
                var result = UninstallList.ReadFromFile(fileName);

                CurrentListFileName = fileName;
                uninstallListEditor1.CurrentList = result;
                UnsavedChanges = false;
            }
            catch (Exception ex)
            {
                PremadeDialogs.GenericError(ex);
            }
        }
        /// <summary>
        /// Load a list silently from filename
        /// </summary>
        /// <param name="fileName">Filename of the list</param>
        public void LoadUninstallList(string fileName)
        {
            try
            {
                var result = UninstallList.ReadFromFile(fileName);

                CurrentListFileName = fileName;
                uninstallListEditor1.CurrentList = result;
                UnsavedChanges = false;
            }
            catch (SecurityException ex)
            {
                PremadeDialogs.GenericError(ex);
            }
            catch (Exception ex)
            {
                PremadeDialogs.GenericError("File is not an uninstall list or it can't be opened",
                                            "Please note that uninstall lists are saved in the \"Advanced filtering\" view, not by exporting. Lists should have the .bcul extension.\n\nError message: " + ex.Message);
            }
        }
Esempio n. 5
0
        private static int ProcessUninstallCommand(string[] args)
        {
            if (args.Length < 1)
            {
                return(ShowInvalidSyntaxError("Missing path argument"));
            }

            if (!File.Exists(args[0]))
            {
                return(ShowInvalidSyntaxError("Invalid path or missing list file"));
            }

            UninstallList list;

            try
            {
                list = UninstallList.ReadFromFile(args[0]);
                if (list == null || list.Filters.Count == 0)
                {
                    throw new IOException("List is empty");
                }
            }
            catch (SystemException ex)
            {
                return(ShowInvalidSyntaxError(
                           $"Invalid or damaged uninstall list file - \"{args[0]}\"\nError: {ex.Message}\n"));
            }

            var isVerbose    = args.Any(x => x.Equals("/V", StringComparison.OrdinalIgnoreCase));
            var isQuiet      = args.Any(x => x.Equals("/Q", StringComparison.OrdinalIgnoreCase));
            var isUnattended = args.Any(x => x.Equals("/U", StringComparison.OrdinalIgnoreCase));

            if (isUnattended)
            {
                Console.WriteLine("WARNING: Running in unattended mode. To abort press Ctrl+C or close the window.");
            }

            return(RunUninstall(list, isQuiet, isUnattended, isVerbose));
        }