Ejemplo n.º 1
0
        private static (IDictionary <string, Rule>, List <string>) Parse(List <string> lines)
        {
            var rules    = new Dictionary <string, Rule>();
            var messages = new List <string>();

            foreach (var line in lines)
            {
                if (OrRule.MatchesRuleDescription(line))
                {
                    var rule = OrRule.Parse(line);
                    rules.Add(rule.Id, rule);
                }
                else if (MatchRule.MatchesRuleDescription(line))
                {
                    MatchRule matchRule = MatchRule.Parse(line);
                    rules.Add(matchRule.Id, matchRule);
                }
                else if (SequenceRule.MatchesRuleDescription(line))
                {
                    SequenceRule sequenceRule = SequenceRule.Parse(line);
                    rules.Add(sequenceRule.Id, sequenceRule);
                }
                else if (!string.IsNullOrEmpty(line))
                {
                    messages.Add(line);
                }
            }
            return(rules, messages);
        }