Exemple #1
0
    static Program()
    {
        var factory = new LoggerFactory();

        _logger = factory.CreateLogger <Program>();
        var classifications = new[]
        {
            new RegexClassification
            {
                ClassificationName = "URL",
                IgnoreCase         = false,
                RegexPattern       = @"(http|https|ftp|)\://|[a-zA-Z0-9\-\.]+\.[a-zA-Z](:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*[^\.\,\)\(\s]",
                Color = ConsoleColor.Magenta
            },
            new RegexClassification
            {
                ClassificationName = "SQL",
                IgnoreCase         = true,
                RegexPattern       = @"\""Select (Distinct )?(Top \d+ )?(\*|[a-zA-Z]+(,[a-zA-Z]+)?) From [a-zA-Z]+\""",
                Color = ConsoleColor.Yellow
            },
            new RegexClassification
            {
                ClassificationName = "DateTime",
                RegexPattern       = @"\d{1,2}\/\d{2}\/\d{4} \d{1,2}:\d{2}:\d{2} [paPA][Mm]",
                Color = ConsoleColor.Green
            }
        };

        factory.AddColorizedConsole(classifications);
    }