示例#1
0
 public override void Update()
 {
     using (var old = new SaveConsoleState())
     {
         Console.SetCursorPosition(X, Y);
         Console.ForegroundColor = color;
         if (Message.Length > MaxBufferWidth)
         {
             Console.Write(Message.Substring(0, MaxBufferWidth - 3) + "...");
         }
         else
         {
             Console.Write(Message.PadRight(MaxBufferWidth));
         }
     }
 }
示例#2
0
        public override void Update()
        {
            using (var old = new SaveConsoleState())
            {
                Console.SetCursorPosition(X, Y);
                //Console.ForegroundColor = ConsoleColor.White;
                //Console.Write("[");
                int percent = (int)((Current / (float)(Max)) * barWidth);
                Console.BackgroundColor = color;
                Console.Write(new String(' ', Util.Clamp(percent, 0, barWidth)));
                Console.BackgroundColor = ConsoleColor.DarkGray;
                Console.Write(new String(' ', Util.Clamp(barWidth - percent, 0, barWidth)));
                Console.BackgroundColor = old.colorB;
                Console.Write(" " + Current + "/" + Max);

                //Console.Write("]");
            }
        }