private void UpdateClassifiers()
        {
            var settings = Settings.Load();
            var patterns = settings.Patterns ?? new RegExClassification[0];

            var classifiers = patterns.Select(
                pattern => new
            {
                classificationType = pattern.ClassificationType.ToString(),
                test = RegExClassification.RegExFactory(pattern)
            })
                              .Select(temp => new Classifier
            {
                Type = temp.classificationType,
                Test = text => temp.test.IsMatch(text)
            })
                              .ToList();

            classifiers.Add(new Classifier
            {
                Type = ClassificationTypeDefinitions.BuildText,
                Test = t => true
            });

            _classifiers = classifiers;
        }
 public static Regex RegExFactory(RegExClassification pattern)
 {
     return(new Regex(
                pattern.RegExPattern,
                pattern.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None,
                TimeSpan.FromMilliseconds(250)));
 }
 public static Regex RegExFactory(RegExClassification pattern)
 {
     return new Regex(
         pattern.RegExPattern, 
         pattern.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None, 
         TimeSpan.FromMilliseconds(250));
 }
 public void ToStringFormat()
 {
     var rc = new RegExClassification
     {
         RegExPattern = "/d",
         ClassificationType = ClassificationTypes.BuildText,
         IgnoreCase = true
     };
     rc.ToString().Should().Be("\"/d\",BuildText,True");
 }
        private void UpdateClassifiers()
        {
            var settings = Settings.Load();
            var patterns = settings.Patterns ?? Array.Empty <RegExClassification>();

            _classifiers = patterns.Select(
                pattern => new Classifier
            {
                Type = pattern.ClassificationType.ToString(),
                Test = RegExClassification.RegExFactory(pattern).IsMatch
            })
                           .Append(new Classifier
            {
                Type = ClassificationTypeDefinitions.BuildText,
                Test = t => true
            })
                           .ToList();
        }