public void EnqueueOption(option o)
        {
            string last_Log = string.Empty;

            foreach (action _a in o.action)
            {
                Console.WriteLine("Executing '{0}' action from '{3}' option in '{4}' cleaner, command with '{1}' search parameter in '{2}' path", _a.command, _a.search, _a.path, _a.parent_option.label, _a.parent_option.parent_cleaner.label);

                COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command);

                iActions axn = null;

                switch (cmd)
                {
                    case COMMANDS.delete:
                        axn = new CommandLogic_Delete();
                        break;

                    #region // special commands
                    case COMMANDS.sqlite_vacuum:
                        axn = new CommandLogic_SQLiteVacuum();
                        break;
                    case COMMANDS.truncate:
                        break;
                    case COMMANDS.winreg:
                        axn = new CommandLogic_Winreg();
                        break;
                    #endregion

                    #region // other special commands
                    case COMMANDS.json:
                        axn = new CommandLogic_JSON();
                        break;
                    case COMMANDS.ini:
                        axn = new CommandLogic_Ini();
                        break;
                    #endregion

                    #region // special commands for Google Chrome
                    case COMMANDS.chrome_autofill:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_database_db:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_favicons:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_history:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_keywords:
                        axn = new CommandLogic_Chrome();
                        break;
                    #endregion

                    #region // ClamWin commands
                    case COMMANDS.clamscan:
                        axn = new CommandLogic_Clam();
                        break;
                    #endregion

                    #region // little registry commands
                    case COMMANDS.littleregistry:
                        axn = new CommandLogic_LittleRegistryCleaner();
                        break;
                    #endregion

                    case COMMANDS.clipboard:
                        axn = new CommandLogic_Clipboard();
                        break;

                    case COMMANDS.dupchecker:
                        axn = new CommandLogic_DuplicateChecker();
                        break;
                }

                if (axn != null)
                {
                    axn.Action = _a;
                    axn.Enqueue(); // execute for queueing 
                }
            }
        }
예제 #2
0
        public void EnqueueOption(option o)
        {
            string last_Log = string.Empty;

            foreach (action _a in o.action)
            {
                if (!Worker.I.Preview) // check only when not in preview mode
                {
                    // if not in custom, check for cleaning level
                    if (!this.CleanOption_Custom)
                    {
                        #region // check cleaning level
                        int level = 3; // let it be the default
                        int curlevel = Settings.Default.CleanOption;

                        if (_a.parent_option.level == 0)
                        {
                            level = 3;
                        }
                        else
                        {
                            level = _a.parent_option.level;
                        }

                        if (level > curlevel)
                        {
                            // do not execute the cleaner when the level set is greater than
                            // what is in current setting.

                            string level_name = "Aggressive";
                            if (level == 1) level_name = "Safe";
                            else if (level == 2) level_name = "Moderate";

                            string text = string.Format("\"{0}\" cleaner skipped because it is set for {1} cleaning level", _a.parent_option.label, level_name);

                            if (last_Log != text)
                            {
                                last_Log = text;

                                this.TextLog += text;
                            }

                            continue;
                        }
                        #endregion
                    }
                }

                Console.WriteLine("Executing '{0}' action from '{3}' option in '{4}' cleaner, command with '{1}' search parameter in '{2}' path", _a.command, _a.search, _a.path, _a.parent_option.label, _a.parent_option.parent_cleaner.label);

                COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command);

                iActions axn = null;

                switch (cmd)
                {
                    case COMMANDS.delete:
                        axn = new CommandLogic_Delete();
                        break;

                    #region // special commands
                    case COMMANDS.sqlite_vacuum:
                        axn = new CommandLogic_SQLiteVacuum();
                        break;
                    case COMMANDS.truncate:
                        break;
                    case COMMANDS.winreg:
                        axn = new CommandLogic_Winreg();
                        break;
                    #endregion

                    #region // other special commands
                    case COMMANDS.json:
                        axn = new CommandLogic_JSON();
                        break;
                    case COMMANDS.ini:
                        axn = new CommandLogic_Ini();
                        break;
                    #endregion

                    #region // special commands for Google Chrome
                    case COMMANDS.chrome_autofill:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_database_db:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_favicons:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_history:
                        axn = new CommandLogic_Chrome();
                        break;
                    case COMMANDS.chrome_keywords:
                        axn = new CommandLogic_Chrome();
                        break;
                    #endregion

                    #region // ClamWin commands
                    case COMMANDS.clamscan:
                        axn = new CommandLogic_Clam();
                        break;
                    #endregion

                    #region // little registry commands
                    case COMMANDS.littleregistry:
                        axn = new CommandLogic_LittleRegistryCleaner();
                        break;
                    #endregion

                    case COMMANDS.clipboard:
                        axn = new CommandLogic_Clipboard();
                        break;

                    case COMMANDS.dupchecker:
                        axn = new CommandLogic_DuplicateChecker();
                        break;
                }

                if (axn != null)
                {
                    axn.Action = _a;
                    axn.Enqueue(); // execute for queueing 
                }
            }
        }