Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

ReadWriteFileSystemProvider.GetChildren Method

Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.9147)

GetChildren(DirectoryNode, NodeType)

Override this method to implement getting a collection of DirectoryNode and/or FileNode objects that are located in the parent and value of their property NodeType is contained in the nodeType.

When the virtual file system is used in the FileServer component, the server session, which contains information about the user and the active connection, can be accessed using Current property.

Inherited from ReadOnlyFileSystemProvider.
Declaration
protected abstract IEnumerable<NodeBase> GetChildren(DirectoryNode parent, NodeType nodeType)
Parameters
Type Name Description
DirectoryNode parent

Parent DirectoryNode of the requested children.

NodeType nodeType

Required type(s) of the returned children.

Returns
Type Description
IEnumerable<NodeBase>

A collection of DirectoryNode and/or FileNode objects that are contained in the parent and value of their property NodeType is contained in the flag nodeType, or empty IEnumerable<T> if the parent does not have children.

Examples
protected override IEnumerable <NodeBase> GetChildren(DirectoryNode parent, NodeType nodeType)
{
 var parentPath = getFullPath(parent.Path);
 var retChildren = Enumerable.Empty<NodeBase>();

 if ((nodeType & NodeType.Directory) == NodeType.Directory)
 {
   retChildren = retChildren.Union(Directory.EnumerateDirectories(parentPath)
     .Select(dirPath => new DirectoryNode(getNodeName(dirPath), parent)));
 }

 if ((nodeType & NodeType.File) == NodeType.File)
 {
   retChildren = retChildren.Union(Directory.GetFiles(parentPath)
     .Select(filePath => new FileNode(getNodeName(filePath), parent)));
 }

 return retChildren;
}
In This Article
  • GetChildren(DirectoryNode, NodeType)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies