示例#1
0
        /// <summary>
        /// Execute a command on the Tcc API.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="commandText"></param>
        /// <returns></returns>
        public uint ExecuteCmd(TccCommandName name, string commandArgs)
        {
            TccCommand cmd;

            try
            {
                cmd = TccCommandRepo.Get(name);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(1);
            }

            return(ExecuteCmd(cmd, ParseArgs(cmd, commandArgs)));
        }
示例#2
0
        /// <summary>
        /// Process and rewrite a command line with path mapping, etc, but call back with commandLineArgs object
        /// for further modification
        /// </summary>
        /// <param name="name"></param>
        /// <param name="commandArgs"></param>
        /// <param name="commandLineArgs"></param>
        /// <returns></returns>
        public uint ProcessCmd(TccCommandName name, StringBuilder commandArgs, Action <CommandLineArgs> commandLine)
        {
            try
            {
                var cmd             = TccCommandRepo.Get(name);
                var commandLineArgs = ParseArgs(cmd, commandArgs.ToString());
                if (commandLine != null)
                {
                    commandLine(commandLineArgs);
                }

                commandArgs.Replace(" " + commandLineArgs.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(1);
            }

            return(TccLib.RETURN_DEFER);
        }