Exemple #1
0
        public static XTermColor AsXTermColor(this DOSColor color)
        {
            if (color == DOSColor.DarkGray)
            {
                return(XTermColor.Grey);
            }
            if (color == DOSColor.DarkYellow)
            {
                return(XTermColor.Yellow);
            }
            if (color == DOSColor.Yellow)
            {
                return(XTermColor.LightYellow);
            }
            if (color == DOSColor.Gray)
            {
                return(XTermColor.LightSlateGrey);
            }

            if (Enum.TryParse(color.ToString(), out XTermColor col))
            {
                return(col);
            }
            return(XTermColor.DarkSlateGray);
        }
Exemple #2
0
        public static void Log24Bit(DOSColor color,
                                    bool newline,
                                    TextWriter writer,
                                    string category,
                                    string message,
                                    params object[] arg)
        {
            if (!Enabled)
            {
                return;
            }
            if (!ConsoleSwatch.EnableVT())
            {
                Log4Bit(color.AsConsoleColor(), newline, writer, category, message, arg);
                return;
            }

            Log24Bit(color.AsXTermColor()
                     .ToForeground(),
                     null,
                     newline,
                     writer,
                     category,
                     message,
                     arg);
        }
Exemple #3
0
 private static void Log24Bit(DOSColor color,
                              string category,
                              string message,
                              params object[] arg)
 {
     Log24Bit(color, true, Console.Out, category, message, arg);
 }
Exemple #4
0
 private static void Log24Bit(DOSColor color, string category, string message, params object[] arg)
 {
     if (!Enabled)
     {
         return;
     }
     if (!EnableVT())
     {
         Log4Bit(color.AsConsoleColor(), true, category, message, arg);
         return;
     }
     Log24Bit(color.AsXTermColor().ToForeground(), null, true, category, message, arg);
 }
Exemple #5
0
        public static XTermColor AsXTermColor(this DOSColor color)
        {
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (color)
            {
            case DOSColor.DarkGray:
                return(XTermColor.Grey);

            case DOSColor.DarkYellow:
                return(XTermColor.Yellow);

            case DOSColor.Yellow:
                return(XTermColor.LightYellow);

            case DOSColor.Gray:
                return(XTermColor.LightSlateGrey);

            default:
                return(Enum.TryParse(color.ToString(), out XTermColor col) ? col : XTermColor.DarkSlateGray);
            }
        }
Exemple #6
0
 public static ConsoleColor AsConsoleColor(this DOSColor color)
 {
     return((ConsoleColor)color);
 }