ReadOnlyFileSystemProvider.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 Directoryparent
and
value of their property NodenodeType
.
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 |
---|---|---|
Directory |
parent | Parent Directory |
Node |
nodeType | Required type(s) of the returned children. |
Returns
Type | Description |
---|---|
IEnumerable<Node |
A collection of Directory |
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;
}