public static string GetText(ConsoleBuffer buffer) { var output = new StringBuilder(); while (true) { var c = buffer.Read(); if (c == null) { break; } output.Append(c.Char); } var data = output.ToString().TrimEnd(); return(data); }