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); } } }
private LibraryNode FindNode(LibraryNode hNode, string targetname) { for (int i = 0; i < hNode.Children.Count; i++) { LibraryNode ch = hNode.GetChild(i); if (ch.Name == targetname) { return(ch); } } return(null); }