ReadWriteFileSystemProvider.SetTimeInfo Method
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.9083)
SetTimeInfo(NodeBase, NodeTimeInfo)
Override this method to implement time info updating functionality for FileNode and DirectoryNode.
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 NodeBase SetTimeInfo(NodeBase node, NodeTimeInfo newTimeInfo)
Parameters
Type | Name | Description |
---|---|---|
NodeBase | node | To be updated a FileNode or DirectoryNode. |
NodeTimeInfo | newTimeInfo | Updated NodeTimeInfo for the |
Returns
Type | Description |
---|---|
NodeBase | Up-to-date instance of DirectoryNode or FileNode which represents the updated |
Examples
protected override NodeBase SetTimeInfo(NodeBase node, NodeTimeInfo newTimeInfo)
{
var fullNodePath = getFullPath(node.Path);
var retNode = node;
if (node.IsFile)
{
File.SetCreationTimeUtc(fullNodePath, newTimeInfo.CreationTime);
File.SetLastAccessTimeUtc(fullNodePath, newTimeInfo.LastAccessTime);
File.SetLastWriteTimeUtc(fullNodePath, newTimeInfo.LastWriteTime);
retNode = new FileNode(node.Name, node.Parent, newTimeInfo, node.Attributes);
}
if (node.IsDirectory)
{
Directory.SetCreationTimeUtc(fullNodePath, newTimeInfo.CreationTime);
Directory.SetLastAccessTimeUtc(fullNodePath, newTimeInfo.LastAccessTime);
Directory.SetLastWriteTimeUtc(fullNodePath, newTimeInfo.LastWriteTime);
retNode = new DirectoryNode(node.Name, node.Parent, newTimeInfo, node.Attributes);
}
return retNode;
}