示例#1
0
    static void LSColors(string key, string value)
    {
        var items = value.Split(':');

        Console.Write(String.Format("{0," + EnvVarWidth + "}", key));

        Separator();

        ColorConsole.SetForeground(0xe0, 0xe0, 0xe0);

        bool first = true;

        foreach (var item in items)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                Console.Write(new string(' ', EnvVarWidth + 2));
            }

            Console.Write($"{item,-20}");
            Console.Write(" ");
            var idx = item.IndexOf('=');
            if (idx > 0)
            {
                var itemKey = item.Substring(0, idx);
                var itemVal = item.Substring(idx + 1);
                var parts   = itemVal.Split(';');
                foreach (var part in parts)
                {
                    ColorConsole.SetCode(part);
                }

                Console.Write("(Color)");

                ColorConsole.SetDefaults();
                if (LSKeys.TryGetValue(itemKey, out string desc))
                {
                    Console.Write(" ");
                    Console.Write(desc);
                }
            }

            Console.WriteLine();
        }

        ColorConsole.SetDefaults();
    }