public void WriteLine(string text, ConsoleColor?color = null) { var colorBefore = Console.ForegroundColor; if (color.HasValue) { Console.ForegroundColor = color.Value; } var lines = text.Split("\n"); foreach (var line in lines) { longestLine = Math.Max(longestLine, line.Length); BetterConsole.WriteAtLine(line, _currentLine + StartingLine, longestLine); _currentLine++; if (_currentLine >= Lines) { _currentLine = 0; } } if (color.HasValue) { Console.ForegroundColor = colorBefore; } }
public void SetTitle(int day, string title, int part) { Console.ForegroundColor = ConsoleManager.Skin.FramesColor; var line = new String('═', BetterConsole.Width - 2); var titleText = $" Day {day}: {title} - Part {part}".PadRight(BetterConsole.Width - 2); Console.ForegroundColor = ConsoleManager.Skin.FramesColor; BetterConsole.WriteAtLine($"╔{line}╗", 0); BetterConsole.WriteAtLine("║", 1); BetterConsole.WriteAt("║", BetterConsole.Width - 1, 1); BetterConsole.WriteAtLine($"╚{line}╝", 2); Console.ForegroundColor = ConsoleManager.Skin.DayTitleColor; BetterConsole.WriteAt(titleText, 1, 1); Console.ResetColor(); }
public void ReserveLines(int reserveLines) { CurrentHeaderPointer = new Point(0, ReservedLineStart); if (reserveLines == 0) { _reservedLines = 4; BetterConsole.Position = new Point(0, ReservedLineStart + reserveLines); } else { _reservedLines = reserveLines + 5; BetterConsole.Position = new Point(0, ReservedLineStart + reserveLines + 1); var line = new String('═', BetterConsole.Width); Console.ForegroundColor = ConsoleManager.Skin.FramesColor; BetterConsole.WriteAtLine(line, ReservedLineStart + reserveLines); Console.ResetColor(); } }
public static void WriteLineAt(string text, int line) => BetterConsole.WriteAtLine(text, line);