Пример #1
0
 public static void WriteLine <T>(System.ConsoleColor fgCol, System.ConsoleColor bgCol, T s)
 {
     System.Console.ForegroundColor = fgCol;
     System.Console.BackgroundColor = bgCol;
     System.Console.WriteLine(s);
     System.Console.ResetColor();
 }
Пример #2
0
 public static void WriteAt <T>(int x, int y, System.ConsoleColor fgCol, T s)
 {
     System.Console.SetCursorPosition(x, y);
     System.Console.ForegroundColor = fgCol;
     System.Console.Write(s);
     System.Console.ResetColor();
 }
Пример #3
0
 public void Say(bool delay)
 {
     System.ConsoleColor temp = System.Console.ForegroundColor;
     System.Console.ForegroundColor = _color;
     _messange.Say(delay);
     System.Console.ForegroundColor = temp;
 }
 /// <summary>
 /// Change the forgroud color of the specified widget for 200 ms
 /// </summary>
 /// <param name="color">the color to flash to</param>
 public void Flash(System.ConsoleColor color)
 {
     flashColor           = forColor;
     forColor             = color;
     eventDelay.Enabled   = true;
     eventDelay.Elapsed  += Delayed_Flash;
     eventDelay.AutoReset = false;
 }
Пример #5
0
 public static void Render(char value, int x, int y, System.ConsoleColor color)
 {
     System.Console.CursorVisible = false;
     System.Console.SetCursorPosition(x, y);
     System.Console.ForegroundColor = color;
     System.Console.Write(value);
     System.Console.ResetColor();
 }
Пример #6
0
        private static void WriteColor(string message, System.ConsoleColor color)
        {
            var cc = System.Console.ForegroundColor;

            System.Console.ForegroundColor = color;
            System.Console.WriteLine(message);
            System.Console.ForegroundColor = cc;
        }
Пример #7
0
    public static void WriteLine(string message, System.ConsoleColor color)
    {
        var fcolor = System.Console.ForegroundColor;

        System.Console.ForegroundColor = color;
        System.Console.WriteLine(message);
        System.Console.ForegroundColor = fcolor;
        System.Console.WriteLine("Check log for more details");
    }
Пример #8
0
        public static void WriteBlueLine(string value)
        {
            System.ConsoleColor currentColor = CLRConsole.ForegroundColor;

            CLRConsole.ForegroundColor = System.ConsoleColor.Blue;
            CLRConsole.WriteLine(value);

            CLRConsole.ForegroundColor = currentColor;
        }
Пример #9
0
 static public void Log(string msg, System.ConsoleColor?color = null)
 {
     System.ConsoleColor _defaultColor = System.Console.ForegroundColor;
     if (color != null)
     {
         System.Console.ForegroundColor = (System.ConsoleColor)color;
     }
     System.Console.Write(msg);
     System.Console.ForegroundColor = _defaultColor;
 }
Пример #10
0
        public bool PutStringCenteredColor(string str, int y, System.ConsoleColor col)
        {
            if (str.Length > this.width - 1)
            {
                return(false);
            }

            int x = this.width / 2 - str.Length / 2;

            return(PutStringColor(str, x, y, col));
        }
Пример #11
0
        public static Color FromColor(System.ConsoleColor c)
        {
            int cInt = (int)c;

            int brightnessCoefficient = ((cInt & 8) > 0) ? 2 : 1;
            int r = ((cInt & 4) > 0) ? 64 * brightnessCoefficient : 0;
            int g = ((cInt & 2) > 0) ? 64 * brightnessCoefficient : 0;
            int b = ((cInt & 1) > 0) ? 64 * brightnessCoefficient : 0;

            return(new Color(r, g, b));
        }
Пример #12
0
 public bool CheckForKey(System.ConsoleColor color)
 {
     foreach (var key in playerInventory)
     {
         if (color == key.Color)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #13
0
        public bool PutCharColor(char c, int x, int y, System.ConsoleColor col)
        {
            if (x >= this.width || x < 0 || y >= this.height || y < 0)
            {
                return(false);
            }

            this.buffer[y, x]    = c;
            this.colorMask[y, x] = col;
            return(true);
        }
Пример #14
0
        public void ClearMask(System.ConsoleColor color)
        {
            for (int j = 0; j < this.height; j++)
            {
                for (int i = 0; i < this.width; i++)
                {
                    this.colorMask[j, i] = color;
                }
            }

            return;
        }
Пример #15
0
        private static Key[] CreateTrials()
        {
            const int count  = 101;
            var       result = new Key[count * 2];

            for (int i = 0; i != count; ++i)
            {
                int value = 83 * i % count;
                result[2 * i]     = (Key)value;
                result[2 * i + 1] = (Key) ~value;
            }

            return(result);
        }
Пример #16
0
 public static void Render(char[,] value, int xLenth, int yLenth, System.ConsoleColor color)
 {
     System.Console.CursorVisible = false;
     System.Console.SetCursorPosition(0, 0);
     for (int i = 0; i < xLenth; i++)
     {
         for (int j = 0; j < yLenth; j++)
         {
             System.Console.ForegroundColor = color;
             System.Console.Write(value[i, j]);
         }
         System.Console.WriteLine();
     }
     System.Console.ResetColor();
 }
Пример #17
0
        public static void Send(LogLevel Level, System.ConsoleColor Color, string Id, string Svc, string Msg)
        {
            System.Console.ForegroundColor = System.ConsoleColor.Gray;
            System.Console.Write(System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString());
            System.Console.ForegroundColor = Color;
            System.Console.Write(" " + Id + " ");
            System.Console.ForegroundColor = System.ConsoleColor.White;
            System.Console.Write(Svc + ": ");
            System.Console.ForegroundColor = Color;
            System.Console.WriteLine(Msg);
            System.Console.ForegroundColor = System.ConsoleColor.Gray;
            string FileLog = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString();

            FileLog += " " + Id + " " + Svc + ": " + Msg;
        }
Пример #18
0
        public bool PutStringColor(string str, int x, int y, System.ConsoleColor col)
        {
            if (y < 0 || y >= this.height ||
                x < 0 || x + str.Length - 1 >= this.width)
            {
                return(false);
            }

            foreach (char c in str)
            {
                this.buffer[y, x]    = c;
                this.colorMask[y, x] = col;
                x++;
            }

            return(true);
        }
Пример #19
0
 private static void Print(System.ConsoleColor color, LogType type, string logs)
 {
     if (Enabled)
     {
         //System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
         //System.Diagnostics.StackFrame[] sfs = st.GetFrames();
         //string[] methodName = new string[sfs.Length];
         //for (int i = 0; i < sfs.Length; i++)
         //{
         //    methodName[i] = sfs[i].GetFileName() + sfs[i].GetType().Name + sfs[i].GetFileLineNumber() + sfs[i].GetMethod().Name;
         //}
         //LogList.Add(new Log(1, logs, string.Join("\n", methodName), type));
         System.Console.ForegroundColor = color;
         System.Console.WriteLine(System.DateTime.Now.TimeOfDay + " >>> " + logs);
         System.Console.ForegroundColor = System.ConsoleColor.White;
     }
 }
Пример #20
0
 private static void Log(object data, System.ConsoleColor foregroundColor)
 {
     if (System.Environment.UserInteractive)
     {
         lock (App.Lock)
             try
             {
                 var oldFgColor = System.Console.ForegroundColor;
                 System.Console.ForegroundColor = System.ConsoleColor.Cyan;
                 System.Console.Write("{0:HH:hh:ss} ", System.DateTime.Now);
                 System.Console.ForegroundColor = foregroundColor;
                 System.Console.WriteLine(data);
                 System.Console.ForegroundColor = oldFgColor;
             }
             catch (System.Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine(ex);
             }
     }
 }
Пример #21
0
    private static void internalWriteLine(string str, List <System.ConsoleColor> charColors)
    {
        // number of returns to print
        int returnCount = str.Count(ch => ch == '\n');

        // create extra returns at bottom of screen and moves cursor to starting place
        System.Console.ResetColor();
        System.ConsoleColor currentColor = System.Console.ForegroundColor;
        for (int i = 0; i < str.Length; i++)
        {
            if (currentColor != charColors[i])
            {
                currentColor = charColors[i];
                System.Console.ForegroundColor = charColors[i];
            }
            System.Console.Write(str[i]);
        }

        System.Console.ResetColor();
        System.Console.Write("\n");
    }
Пример #22
0
        public Tetromino(bool block = false, int color = 0)
        {
            B = block;
            switch (color)
            {
            case 1:
                Color = Cyan;
                break;

            case 2:
                Color = Yellow;
                break;

            case 3:
                Color = DarkMagenta;
                break;

            case 4:
                Color = Red;
                break;

            case 5:
                Color = DarkGreen;
                break;

            case 6:
                Color = DarkCyan;
                break;

            case 7:
                Color = Blue;
                break;

            default:
                Color = DarkGray;
                break;
            }
        }
Пример #23
0
 public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, System.ConsoleColor sourceForeColor, System.ConsoleColor sourceBackColor)
 {
 }
Пример #24
0
 /// <summary>
 /// Sends a raw log message to the game console.
 /// </summary>
 /// <param name="message">The message to be sent.</param>
 /// <param name="color">The <see cref="System.ConsoleColor"/> of the message.</param>
 public static void SendRaw(string message, System.ConsoleColor color) => ServerConsole.AddLog(message, color);
Пример #25
0
 /// <summary>
 /// Sends a log message to the game console.
 /// </summary>
 /// <param name="message">The message to be sent.</param>
 /// <param name="level">The message level of importance.</param>
 /// <param name="color">The message color.</param>
 public static void Send(string message, LogLevel level, System.ConsoleColor color = System.ConsoleColor.Gray)
 {
     SendRaw($"[{level.ToString().ToUpper()}] {message}", color);
 }
Пример #26
0
 /// <summary>
 /// Sends a raw log message to the game console.
 /// </summary>
 /// <param name="message">The message to be sent.</param>
 /// <param name="color">The <see cref="System.ConsoleColor"/> of the message.</param>
 public static void SendRaw(object message, System.ConsoleColor color) => ServerConsole.AddLog(message.ToString(), color);
Пример #27
0
        private static void internalWriteLine(string str, System.ConsoleColor foregroundColor)
        {
            List <System.ConsoleColor> charColors = Enumerable.Repeat(foregroundColor, str.Length).ToList();

            internalWriteLine(str, charColors);
        }
Пример #28
0
 public HtmlOutputWriter()
 {
     this.m_backupForeground = System.Console.ForegroundColor;
     this.m_backupBackground = System.Console.BackgroundColor;
 }
Пример #29
0
 public ConsoleForeground(System.ConsoleColor color)
 {
     this.oldColor = System.Console.ForegroundColor;
     System.Console.ForegroundColor = color;
 }
Пример #30
0
 public static void ShowText(string HelpLine, System.ConsoleColor Foreground, System.ConsoleColor Background, string LogPathFileName)
 {
     ShowTextOnConsole(HelpLine, Foreground, Background, true, LogPathFileName);
 }
Пример #31
0
 public ForgeColorDecorateIMessange(IMessange messanger, System.ConsoleColor color)
 {
     _messange = messanger;
     _color    = color;
 }