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 = temp.test.IsMatch
            })
                              .ToList();

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

            _classifiers = classifiers;
        }
Exemple #2
0
        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();
        }