예제 #1
0
        public static string GetFilePath(RestCommand command, int iD)
        {
            FilePath filePath = FilePaths.GetFilePath(command.LoginUser, iD);

            if (filePath.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(filePath.GetXml("FilePath", true));
        }
예제 #2
0
 public virtual Task <bool> DeleteFileAsync(FileDescriptor file)
 {
     return(DeleteAsync(FilePaths.GetFilePath(file)));
 }
예제 #3
0
 public virtual async Task <bool> DownloadAsync(FileDescriptor fileDescriptor, string targetPath)
 {
     using var fileStream = System.IO.File.OpenWrite(targetPath);
     // Use await instead of returning the task to make sure the filestream gets disposed only after the method finishes.
     return(await DownloadAsync(fileStream, FilePaths.GetFilePath(fileDescriptor)).ConfigureAwait(false));
 }