Beispiel #1
0
        private static ILineWriter CreateWriter(Options options)
        {
            var writer = new ConsoleLineWriter();

            if (options.EnableColorSchema)
            {
                EnableColorSchema(writer, options);
            }
            else
            {
                writer.AutoDetectColorSchema = false;
            }

            return writer;
        }
Beispiel #2
0
        private static ILineWriter CreateWriter(Options options)
        {
            var writer = new ConsoleLineWriter();

            if (options.EnableColorSchema)
            {
                EnableColorSchema(writer, options);
            }
            else
            {
                writer.AutoDetectColorSchema = false;
            }

            return(writer);
        }
Beispiel #3
0
        private static void EnableColorSchema(ConsoleLineWriter writer, Options options)
        {
            var colorSchemas = LoadColorSchemas();

            if (colorSchemas == null)
            {
                throw new ApplicationException("No color schema file found");
            }
            if (options.ColorSchemaName == null)
            {
                writer.AutoDetectColorSchema = true;
                writer.ColorSchemas          = colorSchemas;
            }
            else
            {
                writer.AutoDetectColorSchema = false;
                writer.ColorSchema           = colorSchemas.Find(cs => cs.Name == options.ColorSchemaName);
                if (writer.ColorSchema == null)
                {
                    throw new ApplicationException(string.Format("Color schema {0} was not found.", options.ColorSchemaName));
                }
            }
        }
Beispiel #4
0
 private static void EnableColorSchema(ConsoleLineWriter writer, Options options)
 {
     var colorSchemas = LoadColorSchemas();
     if (colorSchemas == null)
     {
         throw new ApplicationException("No color schema file found");
     }
     if (options.ColorSchemaName == null)
     {
         writer.AutoDetectColorSchema = true;
         writer.ColorSchemas = colorSchemas;
     }
     else
     {
         writer.AutoDetectColorSchema = false;
         writer.ColorSchema = colorSchemas.Find(cs => cs.Name == options.ColorSchemaName);
         if (writer.ColorSchema == null)
         {
             throw new ApplicationException(string.Format("Color schema {0} was not found.", options.ColorSchemaName));
         }
     }
 }