public bool Move(DiskOprationInfo moveInfo) { //if (moveInfo.DestinationPath[0] != '~') // moveInfo.DestinationPath = moveInfo.DestinationPath[0] == '/' ? "~" + moveInfo.DestinationPath : "~/" + moveInfo.DestinationPath; //if (moveInfo.SourcePath[0] != '~') // moveInfo.SourcePath = moveInfo.SourcePath[0] == '/' ? "~" + moveInfo.SourcePath : "~/" + moveInfo.SourcePath; var rootPath = HostingEnvironment.ApplicationHost.GetPhysicalPath(); var tempPath = _fileSystemManager.RelativeToAbsolutePath(Config.ThumbnailPath); if (tempPath == null) { throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.PathNotFound, Config.ThumbnailPath)); } var thumbnailRootPath = tempPath.ToLower(); var destinationPath = AuthorizeManager.AuthorizeActionOnPath(moveInfo.DestinationPath, ActionKey.WriteToDisk); var sourcePath = AuthorizeManager.AuthorizeActionOnPath(moveInfo.SourcePath, ActionKey.ReadFromDisk); Parallel.ForEach(moveInfo.Files, file => { var source = _fileSystemManager.RelativeToAbsolutePath(sourcePath + "/" + file); var dist = _fileSystemManager.RelativeToAbsolutePath(destinationPath + "/" + file); if (source == null) { throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.PathNotFound, "source")); } if (dist == null) { throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.PathNotFound, "dist")); } _fileSystemManager.MoveFile(source, dist); var thumbnailSourcePath = source.Substring(rootPath.Length); var thumbnailDistPath = dist.Substring(rootPath.Length); if (_fileSystemManager.FileExist(thumbnailRootPath + thumbnailSourcePath)) { _fileSystemManager.MoveFile(thumbnailRootPath + thumbnailSourcePath, thumbnailRootPath + thumbnailDistPath); } }); Parallel.ForEach(moveInfo.Folders, folder => { var source = _fileSystemManager.RelativeToAbsolutePath(sourcePath + "/" + folder); var dist = _fileSystemManager.RelativeToAbsolutePath(destinationPath + "/" + folder); if (source == null) { throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.PathNotFound, "source")); } if (dist == null) { throw new KhodkarInvalidException(LanguageManager.ToAsErrorMessage(ExceptionKey.PathNotFound, "dist")); } _fileSystemManager.MoveDirectory(source, dist); var thumbnailSourcePath = source.Substring(rootPath.Length); var thumbnailDistPath = dist.Substring(rootPath.Length); if (_fileSystemManager.DirectoryExists(thumbnailRootPath + thumbnailSourcePath)) { _fileSystemManager.MoveDirectory(thumbnailRootPath + thumbnailSourcePath, thumbnailRootPath + thumbnailDistPath); } }); return(true); }