ReadWriteFileSystemProvider.Rename Method
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.9119)
Rename(NodeBase, String)
Override this method to implement renaming a DirectoryNode/FileNode.
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 Rename(NodeBase node, string newName)
Parameters
Type | Name | Description |
---|---|---|
NodeBase | node | A DirectoryNode or FileNode to be renamed. |
String | newName | New |
Returns
Type | Description |
---|---|
NodeBase | Up-to-date instance of FileNode or DirectoryNode which represents the renamed
Returned instance should have the Name property set to |
Examples
protected override NodeBase Rename(NodeBase node, string newName)
{
var oldPath = getFullPath(node.Path);
var newPath = getFullPath(node.Path.ParentPath.AddPathPart(newName));
if (node.IsDirectory)
{
Directory.Move(oldPath, newPath);
return new DirectoryNode(newName, node.Parent);
}
File.Move(oldPath, newPath);
return new FileNode(newName, node.Parent);
}