Exemplo n.º 1
0
        private static void runProcess(ProcessStartInfo processStartInfo)
        {
            var runner = new ProcessRunner();

            var start = Console.ForegroundColor;

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            ConsoleWriter.PrintHorizontalLine();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("{0} {1}", processStartInfo.FileName, processStartInfo.Arguments);
            ConsoleWriter.PrintHorizontalLine();

            var returnValue = runner.Run(processStartInfo, new TimeSpan(0, 1, 0), text => { });
            var color = returnValue.ExitCode == 0 ? ConsoleColor.Gray : ConsoleColor.Red;

            Console.ForegroundColor = color;

            Console.WriteLine(returnValue.OutputText);
            Console.WriteLine("ExitCode:  " + returnValue.ExitCode);

            ConsoleWriter.PrintHorizontalLine();

            Console.ForegroundColor = start;
        }
Exemplo n.º 2
0
        public bool Run(string command, params object[] parameters)
        {
            var runner = new ProcessRunner();
            var start = Console.ForegroundColor;
            var processStartInfo = Info(command, parameters);

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            ConsoleWriter.PrintHorizontalLine();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("{0} {1}", processStartInfo.FileName, processStartInfo.Arguments);
            ConsoleWriter.PrintHorizontalLine();

            var returnValue = runner.Run(processStartInfo, new TimeSpan(0, 1, 0), text => { });
            var color = returnValue.ExitCode == 0 ? ConsoleColor.Gray : ConsoleColor.Red;

            Console.ForegroundColor = color;

            Console.WriteLine(returnValue.OutputText);
            Console.WriteLine("ExitCode:  " + returnValue.ExitCode);

            ConsoleWriter.PrintHorizontalLine();

            Console.ForegroundColor = start;

            return returnValue.ExitCode == 0;
        }