Ejemplo n.º 1
0
 public void Traverse(NTree <T> node, TreeVisitor <T> visitor)
 {
     visitor(node.data);
     foreach (NTree <T> kid in node.children)
     {
         Traverse(kid, visitor);
     }
 }
Ejemplo n.º 2
0
        private void RebuildFolders()
        {
            var RootNode = new NTree <VirtualDirectory>(new VirtualDirectory {
                Name = "\\", Type = NodeType.Directory
            });

            AddSubFolders("\\", RootNode);

            TreeFolders = RootNode;
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
            }
        }