Пример #1
0
        protected override bool TryParse(string a_line)
        {
            if (!base.TryParse(a_line))
            {
                return(false);
            }

            if (-1 == a_line.IndexOf('|'))
            {
                return(false);
            }

            var strParts = a_line.Substring(a_line.IndexOf(':') + 1).Split('|');

            foreach (var strPart in strParts)
            {
                var tempLine = "100000:" + strPart.Trim();
                var part     = RuleSequence.Create(tempLine, System);
                if (null == part)
                {
                    return(false);
                }
                m_rules.Add(part);
            }

            return(true);
        }
Пример #2
0
        public bool TryAddRule(string a_line)
        {
            Rule rule = RuleCheckChar.Create(a_line, this);

            if (null == rule)
            {
                rule = RuleSequence.Create(a_line, this);
            }
            if (null == rule)
            {
                rule = RuleOr.Create(a_line, this);
            }
            if (null == rule)
            {
                return(false);
            }

            if (m_rules.ContainsKey(rule.Number))
            {
                m_rules.Remove(rule.Number);
            }
            m_rules.Add(rule.Number, rule);
            return(true);
        }