public virtual Task CopyFileAsync(FileCopyOrMoveDto input) { string fileSystemPath = GetFileSystemPath(input.Path); var fileFullName = Path.Combine(fileSystemPath, input.Name); if (!File.Exists(fileFullName)) { throw new UserFriendlyException(L["FilePathNotFound"]); } var copyToFilePath = GetFileSystemPath(input.ToPath); var copyToFileFullName = Path.Combine(copyToFilePath, input.ToName ?? input.Name); if (File.Exists(copyToFileFullName)) { throw new UserFriendlyException(L["FilePathAlreadyExists"]); } File.Copy(fileFullName, copyToFileFullName); return(Task.CompletedTask); }
public virtual Task MoveFileAsync(FileCopyOrMoveDto input) { string fileSystemPath = GetFileSystemPath(input.Path); fileSystemPath = Path.Combine(fileSystemPath, input.Name); if (!File.Exists(fileSystemPath)) { throw new UserFriendlyException(L["FilePathNotFound"]); } var moveToFilePath = GetFileSystemPath(input.ToPath); moveToFilePath = Path.Combine(moveToFilePath, input.ToName ?? input.Name); if (File.Exists(moveToFilePath)) { throw new UserFriendlyException(L["FilePathAlreadyExists"]); } File.Move(fileSystemPath, moveToFilePath); return(Task.CompletedTask); }
public virtual async Task CopyFileAsync(FileCopyOrMoveDto input) { await FileSystemAppService.CopyFileAsync(input); }