Пример #1
0
    //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();
            }
        }
Пример #2
0
 //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);
     }
Пример #3
0
 /// <summary>
 /// Sets the console colors
 /// </summary>
 public static void Color(ConsoleColors colors) {
     if (colors != null) {
         Color(colors.fore, colors.back);
     }
 }
Пример #4
0
 /// <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();
     }
 }
Пример #5
0
 /// <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);
 }
Пример #6
0
        /// <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);
        }