//constructors /// <summary> /// Creates a new console dot object with the specified parameters /// </summary> public ConsoleDots(int interval, ConsoleColor? fore = null, ConsoleColor? back = null, char dot = '.', CT start = null, CT finish = null, bool autostart = true) { this.dot = dot; dotColor = new ConsoleColors(fore, back); this.start = start; this.finish = finish; timer = new Timer(interval); timer.Elapsed += Dot; if (autostart) { Start(); } }
//constructor /// <summary> /// Constructor to just assigns values. /// </summary> public CT(string text, ConsoleColor? fore = null, ConsoleColor? back = null) { _text = text; _colors = new ConsoleColors(fore, back); }
/// <summary> /// Sets the console colors /// </summary> public static void Color(ConsoleColors colors) { if (colors != null) { Color(colors.fore, colors.back); } }
/// <summary> /// reads a line of text from the console with the specified text colors /// </summary> public static string ReadLine(ConsoleColors colors = null) { using (new ColorConsole(colors)) { return Console.ReadLine(); } }
/// <summary> /// changes the console colors and then writes text to the console /// </summary> public static void Write(ConsoleColors colors, string str, params object[] objects) { Color(colors); Console.Write(str, objects); }
/// <summary> /// save current console color and set it to the provided values if they are provided /// </summary> public ColorConsole(ConsoleColors colors = null) { old = ConsoleColors.current; Konsole.Color(colors); }