public void Rename(string newName) { if (newName == Name) { return; } var oldPath = FilePath; var newPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(FilePath), newName); RaisePreviewRenamed(new PreviewNodeRenamedEventArgs(oldPath, newPath)); _io.Move(FilePath, newPath); FilePath = newPath; RaiseRenamed(new NodeRenamedEventArgs(oldPath, FilePath)); }
public void Rename(string newName) { if (newName == Name) { return; } var oldpath = _dirpath; var rpath = RenamePath(newName); RaisePreviewRenamed(new PreviewNodeRenamedEventArgs(oldpath, rpath)); _io.Move(_dirpath, rpath); _dirpath = rpath; foreach (var child in _children) { TakeOwnership(child); } RaiseRenamed(new NodeRenamedEventArgs(oldpath, _dirpath)); }