Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Usage();
                return;
            }
            for (int i = 0; i < args.Length; i++)
            {
                string arg = args[i];
                switch (arg)
                {
                case "-c":
                case "--current":
                    PrintTable();
                    return;

                case "-e":
                case "--errors":
                    reportErrors = true;
                    break;

                case "-q":
                case "--quiet":
                    quietMode = true;
                    break;

                case "-d":
                case "--defaults":
                    setDefaults   = true;
                    setProperties = false;
                    break;

                case "-b":
                case "--both":
                    setDefaults   = true;
                    setProperties = true;
                    break;

                case "-?":
                case "--help":
                    Usage();
                    return;

                case "-v":
                case "--version":
                    Version();
                    return;

                case "-x":
                case "--xterm":
                    setUnixStyle  = true;
                    setProperties = true;
                    break;

                case "-o":
                case "--output":
                    if (i + 1 < args.Length)
                    {
                        ExportCurrentAsIni(args[i + 1]);
                    }
                    else
                    {
                        OutputUsage();
                    }
                    return;

                case "-s":
                case "--schemes":
                    PrintSchemes();
                    return;

                default:
                    break;
                }
            }

            string schemeName = args[args.Length - 1];

            ColorScheme colorScheme = GetScheme(schemeName, reportErrors);

            if (colorScheme == null)
            {
                Console.WriteLine(string.Format(Resources.SchemeNotFound, schemeName));
                return;
            }

            if (setDefaults)
            {
                SetDefaults(colorScheme);
            }
            if (setProperties)
            {
                if (setUnixStyle)
                {
                    SetPropertiesWithVt(colorScheme);
                }
                else
                {
                    SetProperties(colorScheme);
                }
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Usage();
                return;
            }
            for (int i = 0; i < args.Length; i++)
            {
                string arg = args[i];
                switch (arg)
                {
                case "-c":
                case "--current":
                    ColorTable.PrintTable();
                    return;

                case "-e":
                case "--errors":
                    reportErrors = true;
                    break;

                case "-q":
                case "--quiet":
                    quietMode = true;
                    break;

                case "-d":
                case "--defaults":
                    setDefaults   = true;
                    setProperties = false;
                    break;

                case "-b":
                case "--both":
                    setDefaults   = true;
                    setProperties = true;
                    break;

                case "-?":
                case "--help":
                    Usage();
                    return;

                case "-v":
                case "--version":
                    Version();
                    return;

                case "-l":
                case "--location":
                    SchemeManager.PrintSchemesDirectory();
                    return;

                case "-x":
                case "--xterm":
                    setUnixStyle  = true;
                    setProperties = true;
                    break;

                case "-t":
                case "--terminal":
                    setTerminalStyle = true;
                    setProperties    = true;
                    break;

                case "-o":
                case "--output":
                    if (i + 1 < args.Length)
                    {
                        new IniSchemeWriter().ExportCurrentAsIni(args[i + 1]);
                    }
                    else
                    {
                        OutputUsage();
                    }
                    return;

                case "-s":
                case "--schemes":
                    SchemeManager.PrintSchemes();
                    return;

                default:
                    break;
                }
            }

            string schemeName = args[args.Length - 1];

            ColorScheme colorScheme = SchemeManager.GetScheme(schemeName, reportErrors);

            if (colorScheme == null)
            {
                Console.WriteLine(string.Format(Resources.SchemeNotFound, schemeName));
                return;
            }

            foreach (var target in GetConsoleTargets())
            {
                target.ApplyColorScheme(colorScheme, quietMode);
            }
        }