Example #1
0
        public static List <string> LoadCommandList()
        {
            string program  = QuickCutsUI.Properties.Settings.Default.CommandListProgram;
            var    progArgs = ProgramAndArgs.Parse(program);

            if (progArgs == null)
            {
                throw new Exception(String.Format("Could not parse command and args from '{0}'.", program));
            }

            return
                (Process.Execute(progArgs.Program, progArgs.Args)
                 .Select(ParseCommand)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .ToList());
        }
Example #2
0
        public static void ExecuteCommandProcess(string commandName, string userArgs)
        {
            string program  = QuickCutsUI.Properties.Settings.Default.CommandExecuteProgram;
            var    progArgs = ProgramAndArgs.Parse(program);

            if (progArgs == null)
            {
                throw new Exception(String.Format("Could not parse command and args from '{0}'.", program));
            }

            var argList =
                new string[] { progArgs.Args, commandName, userArgs }
            .Select(s => s.Trim())
            .Where(s => !String.IsNullOrEmpty(s));

            var args = String.Join(" ", argList);

            Process.Execute(progArgs.Program, args);
        }