Example #1
0
        /// <summary>
        /// 执行宏删除指令
        /// </summary>
        /// <exception cref="MacroFormatException"></exception>
        /// <exception cref="AFile.StartupItemNotFoundException"></exception>
        /// <exception cref="UnauthorizedAccessException"></exception>
        private void ExecuteMacroDel()
        {
            // MacroDeleteType - Const Instruction
            if ((Instruction.IndexOf("(") < Instruction.IndexOf(")")) && Instruction.IndexOf(")") != -1 && Instruction.IndexOf(")") == Instruction.Length - 1)
            {
                try { AConstInstruction.Delete(AInstruction_Const.GetConstInstructionFromMacroInstruction(Instruction)); return; }
                catch (Exception exception) { throw exception; }
            }

            List <string> macroInstructionParametersRaw = GetMacroInstructionParametersList();

            if (macroInstructionParametersRaw.Count < 1)
            {
                throw new MacroFormatException();
            }
            foreach (string delItemString in macroInstructionParametersRaw)
            {
                switch (GetMacroDelType(delItemString))
                {
                case MacroDelType.STARTUP: AFile.Delete(delItemString); break;

                case MacroDelType.CONST_QUOTE: ExecuteMacroDelConstQuote(delItemString); break;
                }
            }
        }