コード例 #1
0
 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);
     }
 }
コード例 #2
0
ファイル: RuleMatcher.cs プロジェクト: soxfmr/BookmarkerRe
        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;
        }
コード例 #3
0
ファイル: CatalogLoader.cs プロジェクト: soxfmr/BookmarkerRe
        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;
        }