ReadOnlyFileSystemProvider.GetLength Method
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.8944)
GetLength(NodeBase)
Override this method to implement retrieval of the length of the content for the node
.
By default, this method is only called for files (instances of the class FileNode). To enable this method for directories (instances of DirectoryNode), add a new instance of FileSystemProviderSettings (with the property EnableGetLengthMethodForDirectories set to true) to the ReadOnlyFileSystemProvider(FileSystemProviderSettings) constructor.
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 long GetLength(NodeBase node)
Parameters
Type | Name | Description |
---|---|---|
NodeBase | node | Processed node. |
Returns
Type | Description |
---|---|
Int64 | Length of the content for the |
Examples
protected override long GetLength(NodeBase node)
{
var fullPath = getFullPath(node.Path);
return new FileInfo(fullPath).Length;
}