public void WriteFailed(TimeSpan?time = null, Result res = null, bool lineAfter = false) { string elapsed = time.HasValue ? " - " + time.Value.TotalSeconds.ToString("F4") + "s" : ""; using (ColorSetter.Set(ConsoleColor.Red)) { Console.Write("FAILED" + elapsed); if (res != null) { Console.WriteLine(res.Message); Console.WriteLine(res.ExceptionMessage); } } if (res?.StackTrace != null) { using (ColorSetter.Set(ConsoleColor.DarkRed)) { foreach (var f in res.StackTrace) { Console.WriteLine(f); } } } if (lineAfter) { Console.WriteLine(); } }
public void WriteWarning(string content) { using (ColorSetter.Set(ConsoleColor.Yellow)) { Console.WriteLine(content); } }
public void WriteColored(string text, ConsoleColor color) { using (ColorSetter.Set(color)) { Console.Write(text); } }
public Process GetCommandProcess(string folder, string command, string arguments, bool useShell = false) { ProcessStartInfo inf = new ProcessStartInfo { WorkingDirectory = folder, FileName = command, UseShellExecute = useShell }; if (arguments != null) { inf.Arguments = arguments; } Console.WriteLine(); using (ColorSetter.Set(ConsoleColor.Cyan)) { Console.Write("Executing : "); } Console.WriteLine($"{command} {arguments}"); var p = new Process(); p.StartInfo = inf; return(p); }
public void WriteSuccess(TimeSpan?time = null, int column = 0) { column = column == 0 ? SuccessCol : column; string elapsed = time.HasValue ? " " + time.Value.TotalSeconds.ToString("F4") + "s" : ""; using (ColorSetter.Set(ConsoleColor.Green)) { GotoColumn(column); Console.Write("SUCCESS" + elapsed); } }
public void WriteException(string message, string type, string[] stack) { using (ColorSetter.Set(ConsoleColor.Red)) { Console.WriteLine(); Console.WriteLine("Exception Type :\t" + type); Console.WriteLine("Exception Message :\t" + message); } Console.WriteLine(); if (stack != null) { using (ColorSetter.Set(ConsoleColor.DarkRed)) { foreach (string st in stack) { Console.WriteLine(st.Trim()); } } Console.WriteLine(); } }