ReadOnlyFileSystemProvider.GetChildren Method
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.9083)
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.
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 |
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;
}