Exemplo n.º 1
0
        /// <summary>
        /// Resolve all of information of child node and append to the global tree of catalogs
        /// </summary>
        /// <param name="catalogNode">parent node</param>
        /// <param name="parent">the index of parent node in global catalogs tree</param>
        private void ParseSingleCatalog(XmlNode catalogNode, int parent = -1)
        {
            XmlNode       node   = null;
            CatalogEntity entity = null;

            // Creating a new catalog
            BookmarkCatalog bookmarkCatalog = new BookmarkCatalog(((XmlElement)catalogNode).GetAttribute("name"));

            // A new catalog entity
            entity         = new CatalogEntity();
            entity.Parent  = parent;
            entity.Catalog = bookmarkCatalog;
            // Append to the global tree
            catalogList.Add(entity);

            // Resolve all of child node and rules
            for (int i = 0, count = catalogNode.ChildNodes.Count; i < count; i++)
            {
                node = catalogNode.ChildNodes[i];

                if (!node.HasChildNodes)
                {
                    continue;
                }

                switch (node.Name)
                {
                case "catalog":
                    ParseSingleCatalog(node, catalogList.IndexOf(entity));
                    break;

                case "rule":
                    bookmarkCatalog.addRules(ParseRules(node));
                    break;

                default: break;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Resolve all of information of child node and append to the global tree of catalogs
        /// </summary>
        /// <param name="catalogNode">parent node</param>
        /// <param name="parent">the index of parent node in global catalogs tree</param>
        private void ParseSingleCatalog(XmlNode catalogNode, int parent = -1)
        {
            XmlNode node = null;
            CatalogEntity entity = null;

            // Creating a new catalog
            BookmarkCatalog bookmarkCatalog = new BookmarkCatalog(((XmlElement)catalogNode).GetAttribute("name"));
            // A new catalog entity
            entity = new CatalogEntity();
            entity.Parent = parent;
            entity.Catalog = bookmarkCatalog;
            // Append to the global tree
            catalogList.Add(entity);

            // Resolve all of child node and rules
            for (int i = 0, count = catalogNode.ChildNodes.Count; i < count; i++)
            {
                node = catalogNode.ChildNodes[i];

                if (!node.HasChildNodes)
                {
                    continue;
                }

                switch(node.Name)
                {
                    case "catalog":
                        ParseSingleCatalog(node, catalogList.IndexOf(entity));
                        break;
                    case "rule":
                        bookmarkCatalog.addRules( ParseRules(node) );
                        break;
                    default: break;
                }
            }
        }