public void Traverse(NTree <T> node, TreeVisitor <T> visitor) { visitor(node.data); foreach (NTree <T> kid in node.children) { Traverse(kid, visitor); } }
private void RebuildFolders() { var RootNode = new NTree <VirtualDirectory>(new VirtualDirectory { Name = "\\", Type = NodeType.Directory }); AddSubFolders("\\", RootNode); TreeFolders = RootNode; }
private NTree <VirtualDirectory> FindNode(NTree <VirtualDirectory> ParentNode, string Text) { //TreeNode Result = null; //TreeNodeCollection nodes; //if (ParentNode == null) // nodes = treeFolders.Nodes; //else // nodes = ParentNode.Nodes; //string lText = Text.ToLower(); //for (int i = 0; i < nodes.Count - 1; i++) //{ // if (nodes[i].Text.ToLower().Equals(lText)) // { // Result = nodes[i]; // break; // } //} //return Result; throw new NotImplementedException(); }
private void AddSubFolders(string BasePath, NTree <VirtualDirectory> BaseNode) { NTree <VirtualDirectory> CurrentNode = null; SolFS.StorageSearch SearchStruct = new SolFS.StorageSearch(); String mask = ""; if (BasePath.Equals("\\")) { mask = "\\*"; } else { mask = BasePath + "\\*"; } bool b = Storage.FindFirst(mask, SolFSFileAttribute.attrAnyFile, ref SearchStruct); if (b == true) { while (b == true) { if ((SearchStruct.Attributes & SolFSFileAttribute.attrDirectory) == SolFSFileAttribute.attrDirectory) { BaseNode.AddNode(new VirtualDirectory() { Name = SearchStruct.FileName, Type = NodeType.Directory });; CurrentNode = BaseNode; AddSubFolders(SearchStruct.FullName, CurrentNode); } b = Storage.FindNext(ref SearchStruct); } Storage.FindClose(ref SearchStruct); } }