public void addRule(Rule rule)
 {
     if(rule is SimpleRule)
     {
         simpleRuleList.Add((SimpleRule) rule);
     }else if(rule is UrlRule)
     {
         urlRuleList.Add((UrlRule) rule);
     }else
     {
         commonRuleList.Add(rule);
     }
 }
Exemple #2
0
        private List<BookmarkInfo> MatchBoth(List<BookmarkInfo> bookmarkList, Rule rule)
        {
            List<BookmarkInfo> matchList = new List<BookmarkInfo>();

            for (int i = bookmarkList.Count - 1; i >= 0; i--)
            {
                if (Regex.IsMatch(bookmarkList[i].Url, Regex.Escape(rule.Pattern), RegexOptions.IgnoreCase) ||
                    Regex.IsMatch(bookmarkList[i].Title, Regex.Escape(rule.Pattern), RegexOptions.IgnoreCase))
                {
                    matchList.Add(bookmarkList[i]);

                    addRemoveIndex(i);
                }
            }

            return matchList;
        }
Exemple #3
0
        private Rule ParseSingleRule(XmlNode item)
        {
            Rule rule = null;
            // Creating a new object for the rule with different type
            switch (item.ParentNode.Name)
            {
                case "url":
                    rule = new UrlRule(item.InnerText);
                    break;
                case "simple":
                    rule = new SimpleRule(item.InnerText);
                    break;
                case "rule":
                    rule = new Rule(item.InnerText);
                    break;
                default: break;
            }

            return rule;
        }