Ejemplo n.º 1
0
 public bool Match(string value, out CategoryItem item)
 {
     item = null;
     for (int i = 0; i < this.items.Count; i++)
     {
         Regex regex = new Regex(this.items[i].Pattern, Utility.REGEX_OPTIONS);
         if (regex.Match(value).Success)
         {
             item = this.items[i];
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        public static Category[] BuildCategories(IniSection[] sections)
        {
            List <Category> categories = new List <Category>(sections.Length);

            for (int i = 0; i < sections.Length; i++)
            {
                Category category = Category.FromFormat(sections[i].Name, sections[i].Count);
                for (int j = 0; j < sections[i].Count; j++)
                {
                    category.Add(CategoryItem.FromFormat(sections[i][j]));
                }
                categories.Add(category);
            }
            return(categories.ToArray());
        }
Ejemplo n.º 3
0
        public static TemplateProvider FromFile(string file)
        {
            TemplateProvider template = new TemplateProvider();

            IniSection[] sections = IniParser.Parse(file);

            for (int i = 0; i < sections.Length; i++)
            {
                Category category = Category.FromFormat(sections[i].Name);

                template.categories.Add(category);

                CategoryItem[] items = new CategoryItem[sections[i].Count];
                for (int j = 0; j < sections[i].Count; j++)
                {
                    items[j] = CategoryItem.FromFormat(sections[i][j]);
                }
                category.AddRange(items);
            }
            return(template);
        }
Ejemplo n.º 4
0
 public bool Contains(CategoryItem item)
 {
     return(items.Contains(item));
 }
Ejemplo n.º 5
0
 public void Add(CategoryItem item)
 {
     item.Parent = this;
     this.items.Add(item);
 }
Ejemplo n.º 6
0
 public bool Remove(CategoryItem categoryItem)
 {
     return(items.Remove(categoryItem));
 }