private static void parseCommand(String command)
        {
            ArgumentsHandler argumentsHandler = new ArgumentsHandler(command);

            if (argumentsHandler.ParseArguments())
                runCommand(argumentsHandler);
        }
Esempio n. 2
0
        private static void parseCommand(String command)
        {
            ArgumentsHandler argumentsHandler = new ArgumentsHandler(command);

            if (argumentsHandler.ParseArguments())
            {
                runCommand(argumentsHandler);
            }
        }
        private static void runCommand(ArgumentsHandler argumentsHandler)
        {
            ProcessStartInfo psInfo = new ProcessStartInfo();
            psInfo.FileName = argumentsHandler.Program;
            psInfo.Arguments = argumentsHandler.Arguments;

            psInfo.UseShellExecute = false;
            psInfo.RedirectStandardOutput = true;
            psInfo.RedirectStandardError = true;

            try
            {
                Process process = Process.Start(psInfo);
                outputFile.Write(process.StandardOutput.ReadToEnd());
                outputFile.Write(process.StandardError.ReadToEnd());
                process.WaitForExit();
            }
            catch (Win32Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 4
0
        private static void runCommand(ArgumentsHandler argumentsHandler)
        {
            ProcessStartInfo psInfo = new ProcessStartInfo();

            psInfo.FileName  = argumentsHandler.Program;
            psInfo.Arguments = argumentsHandler.Arguments;

            psInfo.UseShellExecute        = false;
            psInfo.RedirectStandardOutput = true;
            psInfo.RedirectStandardError  = true;

            try
            {
                Process process = Process.Start(psInfo);
                outputFile.Write(process.StandardOutput.ReadToEnd());
                outputFile.Write(process.StandardError.ReadToEnd());
                process.WaitForExit();
            }
            catch (Win32Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }