Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public virtual async Task CopyFileAsync(FileCopyOrMoveDto input)
 {
     await FileSystemAppService.CopyFileAsync(input);
 }