/// <summary>
        /// Builds graph with chunk root nodes
        /// </summary>
        /// <returns></returns>
        public NodeGraph BuildChunkRootsGraph()
        {
            List <LeafNodeDictionaryEntry> rootEntries = new List <LeafNodeDictionaryEntry>();
            Dictionary <LeafNodeDictionaryEntry, ContentChunk> EntryChunkDictionary = new Dictionary <LeafNodeDictionaryEntry, ContentChunk>();

            foreach (var chunk in items)
            {
                LeafNodeDictionaryEntry entry = null;
                if (chunk.RootNode != null)
                {
                    entry = new LeafNodeDictionaryEntry(chunk.RootNode);
                }
                else
                {
                    entry = new LeafNodeDictionaryEntry()
                    {
                        XPath = chunk.XPathRoot
                    };
                }

                EntryChunkDictionary.Add(entry, chunk);
                rootEntries.Add(entry);
            }

            NodeGraph graph = NodeGraph.Build(rootEntries);

            foreach (var pair in EntryChunkDictionary)
            {
                NodeGraph chunkChild = graph.GetChildAtPath <NodeGraph>(pair.Key.XPath);
                chunkChild.SetMetaData(pair.Value);
            }

            return(graph);
        }
Esempio n. 2
0
        }                                           // graph

        internal void RebuildIndex()
        {
            CachedIndex.Clear();
            foreach (var item in items)
            {
                CachedIndex.Add(item.XPath, item);
            }
            ;

            ContentGraph = NodeGraph.Build(items); // BuildGraph();
            if (ContentGraph != null)
            {
                var allChildren = ContentGraph.getAllChildren();

                foreach (graphWrapNode <LeafNodeDictionaryEntry> child in allChildren)
                {
                    if (!child.name.isNullOrEmpty())
                    {
                        String tag = child.name.Trim(ContentGraph.pathSeparator.ToCharArray());
                        var    m   = TagSelectorRegex.Match(tag);
                        if (m.Success)
                        {
                            tag = m.Groups[m.Groups.Count - 1].Value;
                        }
                        NodeTagCounter.Count(tag);
                    }
                }
            }

            foreach (var item in items)
            {
                TagCounter.Count(item.node.Name);
            }
        }