예제 #1
0
        private void MergeNodeTree(List <LibraryNode> lst, LibraryNode hNode, LibraryNode fileNode)
        {
            // compare each level of hNode and fileNode
            // combine the children of nodes that have same name

            LibraryNode hn = FindNode(hNode, fileNode.Name);

            if (hn == null)
            {
                hn = fileNode.ShallowClone();
                hNode.AddNode(hn);
            }
            uint refs = hn.AddRef();

            lst.Add(hn);
            int chcnt = fileNode.Children.Count;

            if (chcnt != 0)
            {
                for (int i = 0; i < chcnt; i++)
                {
                    LibraryNode ch = fileNode.GetChild(i);
                    MergeNodeTree(lst, hn, ch);
                }
            }
        }
예제 #2
0
        private void SearchNodePartialKey(string searchstr, string parentstr, LibraryNode source, ref LibraryNode results)
        {
            // recursively search node
            if (string.Compare(parentstr, "") != 0)
            {
                parentstr += ".";
            }

            foreach (LibraryNode child in source.Children)
            {
                SearchNodePartialKey(searchstr, parentstr + source.Name, child, ref results);
            }

            if (source.Name.IndexOf(searchstr, StringComparison.OrdinalIgnoreCase) >= 0)
            {
                // modify node name for search presentation only
                LibraryNode placeholder = new LibraryNode(source);
                placeholder.Name = parentstr + placeholder.Name;
                results.AddNode(placeholder);
            }
        }