private static ILineWriter CreateWriter(Options options) { var writer = new ConsoleLineWriter(); if (options.EnableColorSchema) { EnableColorSchema(writer, options); } else { writer.AutoDetectColorSchema = false; } return writer; }
private static ILineWriter CreateWriter(Options options) { var writer = new ConsoleLineWriter(); if (options.EnableColorSchema) { EnableColorSchema(writer, options); } else { writer.AutoDetectColorSchema = false; } return(writer); }
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)); } } }