예제 #1
0
        public void UpdateRename(RenamedTask renamedTask)
        {
            List <FileSystemItem> path = null;

            RWLock.EnterWriteLock();
            try {
                path = GetFileSystemItemPathCore(renamedTask.OldFullName);
                if (path != null)
                {
                    int position = renamedTask.Name.LastIndexOf(Path.DirectorySeparatorChar);
                    var newName  = renamedTask.Name.Substring(position + 1);
                    if (path.Count == 1)
                    {
                        path[0].RenameAsRoot(newName);
                    }
                    else
                    {
                        path[path.Count - 2].RenameInner(path[path.Count - 1], newName);
                    }
                }
            }
            finally {
                RWLock.ExitWriteLock();
            }
            if (path != null)
            {
                RaiseOnRenamedFileSystemItem(renamedTask.OldFullName, renamedTask.FullName);
            }
        }
예제 #2
0
 void IUpdateTaskVisitor.Visit(RenamedTask renamedTask)
 {
     DirectoryModel?.UpdateRename(renamedTask);
 }