Example #1
0
        public async Task TestImportFromProjectOnlineByTokenCredentials()
        {
            var fileName       = "NewProductDev.mpp";
            var getFileRequest = new DownloadFileRequest
            {
                Path = fileName
            };
            var importFileRequest = new PutImportProjectFromProjectOnlineRequest
            {
                Name    = fileName,
                Guid    = Guid.Parse("E6426C44-D6CB-4B9C-AF16-48910ACE0F54"),
                Token   = "SOMESECRETTOKEN",
                SiteUrl = "http://project_server_instance.local/sites/pwa",
                Format  = ProjectFileFormat.Xml
            };
            Stream binaryResponse = null;

            var exception = Assert.ThrowsAsync <ApiException>(async() => binaryResponse = await TasksApi.DownloadFileAsync(getFileRequest));

            Assert.AreEqual(HttpStatusCode.NotFound, exception.HttpStatusCode);

            var response = await TasksApi.PutImportProjectFromProjectOnlineAsync(importFileRequest);

            Assert.AreEqual(HttpStatusCode.OK.ToString(), (string)response.Status);

            Assert.DoesNotThrowAsync(async() => binaryResponse = await TasksApi.DownloadFileAsync(getFileRequest));
            Assert.That(binaryResponse, Is.Not.Null);

            binaryResponse.Dispose();
            await TasksApi.DeleteFileAsync((new DeleteRequest(fileName)));
        }
        /// <summary>
        /// Download file
        /// </summary>
        /// <param name="request">Request. <see cref="DownloadFileRequest" /></param>
        /// <returns><see cref="System.IO.Stream"/></returns>
        public System.IO.Stream DownloadFile(DownloadFileRequest request)
        {
            // verify the required parameter 'path' is set
            if (request.Path == null)
            {
                throw new ApiException(400, "Missing required parameter 'path' when calling DownloadFile");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/assembly/storage/file/{path}";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.Path);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.StorageName);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "versionId", request.VersionId);

            return(this.apiInvoker.InvokeBinaryApi(
                       resourcePath,
                       "GET",
                       null,
                       null,
                       null));
        }
        /// <summary>
        /// Interfejs służy do pobierania załącznika/dokumentu z repozytorium plików
        /// </summary>
        /// <param name="fileId">Identyfikator pliku/załącznika</param>
        public virtual DownloadFileResponse DownloadFile(
            string fileId,
            string podmiot,
            out FaultModel fault
            )
        {
            // validation
            if (string.IsNullOrEmpty(fileId))
            {
                throw new ArgumentNullException("fileId");
            }

            //string queryString = new System.Uri(fileId).Query;
            //var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);

            var request = new DownloadFileRequest()
            {
                //mozna podac caly link
                //FileId = queryDictionary["fileId"],
                FileId  = fileId,
                Subject = podmiot
            };

            // call ePUAP service and parse the response
            var response = WSSecurityRequest <DownloadFileRequest, DownloadFileResponse, DownloadFileResponseHandler>(
                this.ServiceUri,
                request,
                out fault);

            // parsed response
            return(response);
        }
        private void DownloadSegment(Stream progressStream, Endpoint p, int part)
        {
            DownloadFileRequest request = new DownloadFileRequest();

            request.Api      = this.downloadAPI;
            request.Checksum = createChecksum();
            request.Part     = part;
            if (this.password != null)
            {
                request.Password = this.password;
            }

            using (Stream objStream = connection.CallServer(p, request))
            {
                using (StreamReader objReader = new StreamReader(objStream))
                {
                    byte[] tmp = new byte[BUFFER_SIZE];
                    int    l;

                    while ((l = objStream.Read(tmp, 0, BUFFER_SIZE)) != 0)
                    {
                        progressStream.Write(tmp, 0, l);
                    }
                }
            }
        }
Example #5
0
    public byte[] DownloadFile(string url)
    {
        DownloadFileRequest  request  = new DownloadFileRequest(url);
        DownloadFileResponse response = this.DownloadFile(request);

        return(response.DownloadFileResult);
    }
        public async Task <IActionResult> Post(string id, DownloadFileRequest request, bool?overwriteExisting)
        {
            var download = await _downloads.GetByIdAsync(id);

            if (download == null)
            {
                return(NotFound("The download does not exist."));
            }

            var result = await _authorizationService.AuthorizeAsync(User, download, new UpdateOperationAuthorizationRequirement());

            if (!result.Succeeded)
            {
                return(Forbid(new ErrorResponse("Not authorized to upload file.")));
            }

            var existingFiles = download.Files.Where(f => f.Filename == request.Filename);

            if (existingFiles.Any() && (overwriteExisting ?? false))
            {
                foreach (var existingFile in existingFiles)
                {
                    await _files.DeleteAsync(existingFile.Id);
                }
            }

            var file = await _files.AddAsync(id, request.Filename, request.File.OpenReadStream());

            return(Created($"{Url.Action(nameof(Get))}/{file.Id}", file));
        }
Example #7
0
        public IActionResult Download(DownloadFileRequest request)
        {
            string filePath = $"wwwroot{request.Uri}";

            byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
            return(File(fileBytes, "application/vnd.android.package-archive", request.Title));
        }
Example #8
0
        public async Task <IActionResult> Produce(DownloadFileRequest request)
        {
            var validatorActionResult = await _validationArrangement.Validate(request);

            var actionResult = await _operationArrangement.Process(request, validatorActionResult);

            return(actionResult);
        }
        public async Task <IActionResult> Download([FromRoute] DownloadFileFromRoute route,
                                                   [FromQuery] DownloadFileFromQuery query)
        {
            var request = new DownloadFileRequest(route, query);
            var result  = await _apiResult.Produce(request);

            return(result);
        }
        public void TestDownloadFile()
        {
            // Arrange
            var testFile = TestFiles.Docx;
            var request = new DownloadFileRequest { path = testFile.FullName };

            // Act & Assert
            var response = FileApi.DownloadFile(request);
            Assert.Greater(response.Length, 0);
        }
Example #11
0
        public async Task <ActionResult <string> > DownloadFile()
        {
            var assetClient = _mindSphereSdkService.GetAssetManagementClient();
            var request     = new DownloadFileRequest()
            {
                Id = "d50316fdc608471c97cbe9a92a7ac4fc"
            };
            string fileContent = await assetClient.DownloadFileAsync(request);

            return(StatusCode(200, fileContent));
        }
Example #12
0
 void MoveFile(DownloadFileRequest req, string info, byte[] bytes, int length)
 {
     if (req.fileType == DownloadFileType.TypeText)
     {
         FileManager.CreateFileWithString(req.filePath, info);
     }
     else if (req.fileType == DownloadFileType.TypeAssetBundle)
     {
         FileManager.CreateFileWithBytes(req.filePath, bytes, length);
     }
 }
Example #13
0
    private DownloadFileResponse DownloadFile(DownloadFileRequest request)
    {
        CFInvokeInfo info = new CFInvokeInfo();

        info.Action            = "http://tempuri.org/IUpdater/DownloadFile";
        info.RequestIsWrapped  = true;
        info.ReplyAction       = "http://tempuri.org/IUpdater/DownloadFileResponse";
        info.ResponseIsWrapped = true;
        DownloadFileResponse retVal = base.Invoke <DownloadFileRequest, DownloadFileResponse>(info, request);

        return(retVal);
    }
        static void TranslateDocument(Configuration conf)
        {
            // request parameters for translation
            string     name      = "test.docx";
            string     folder    = "";
            string     pair      = "en-fr";
            string     format    = "docx";
            string     outformat = "";
            string     storage   = "First Storage";
            string     saveFile  = "translated_d.docx";
            string     savePath  = "";
            bool       masters   = false;
            List <int> elements  = new List <int>();

            // local paths to upload and download files
            string uploadPath   = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + "/" + name;
            string downloadPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + "/" + saveFile;

            TranslationApi api     = new TranslationApi(conf);
            FileApi        fileApi = new FileApi(conf);


            Stream stream = File.Open(uploadPath, FileMode.Open);

            UploadFileRequest uploadRequest = new UploadFileRequest {
                File = stream, path = name, storageName = storage
            };
            FilesUploadResult uploadResult = fileApi.UploadFile(uploadRequest);

            Console.WriteLine("Files uploaded: " + uploadResult.Uploaded.Count);

            TranslateDocumentRequest request  = api.CreateDocumentRequest(name, folder, pair, format, outformat, storage, saveFile, savePath, masters, elements);
            TranslationResponse      response = api.RunTranslationTask(request);

            Console.WriteLine(response.Message);
            foreach (var key in response.Details.Keys)
            {
                Console.WriteLine(key + ": " + response.Details[key]);
            }

            DownloadFileRequest downloadRequest = new DownloadFileRequest {
                storageName = storage, path = saveFile
            };
            Stream result = fileApi.DownloadFile(downloadRequest);

            Console.WriteLine("Translated file downloaded");

            using (FileStream file = new FileStream(downloadPath, FileMode.Create, FileAccess.Write))
            {
                result.CopyTo(file);
            }
            Console.WriteLine("Translated file saved");
        }
        public void StorageDownloadFile()
        {
            // Arrange
            var testFile = TestFiles.PdfStorage.FirstOrDefault(x => x.Name.Equals("01_pages.pdf"));
            var request  = new DownloadFileRequest {
                path = testFile.Path
            };

            // Act & Assert
            var response = FileApi.DownloadFile(request);

            Assert.Greater(response.Length, 0);
        }
Example #16
0
        public DownloadFile(DownloadFileRequest request)
        {
            ConnectNetDrive();
            _targetPath = request.TargetContainer +
                          (string.IsNullOrEmpty(request.TargetContainer)
                                        ? ""
                                        : @"\") + request.TargetFileName;

            FileInfo fi = new FileInfo(request.TargetFileName);

            _targetPath = Path.Combine(DefaultNetDrive, _targetPath);
            _fileName   = request.TargetFileName;
        }
        internal void DownloadFile(string path)
        {
            var requestDownload = new DownloadFileRequest {
                path = path
            };
            var    responseDownload = FileApi.DownloadFile(requestDownload);
            string fileName         = Path.GetFileName(path);
            string newFilePath      = Path.Combine(DownloadFolder, fileName);

            using (FileStream file = new FileStream(newFilePath, FileMode.Create))
            {
                responseDownload.CopyTo(file);
            }
        }
Example #18
0
        public XDocument DownloadIso20022(string fileReference, string softwareId)
        {
            DownloadFileRequest downloadFileRequest = new DownloadFileRequest();

            downloadFileRequest.ApplicationRequest = GetDownloadFileApplicationRequest(fileReference, softwareId);
            downloadFileRequest.RequestHeader      = GetRequestHeader();

            DownloadFileResponse downloadFileResponse = _client.downloadFile(downloadFileRequest);

            VerifyHeadersAfterResponse(downloadFileRequest.RequestHeader, downloadFileResponse.ResponseHeader);

            XDocument file = DecryptAndUncompressDownloadFileResponse(downloadFileResponse.ApplicationResponse);

            return(file);
        }
Example #19
0
        private static ITaskExecutor ToDownloadFileExecutor(DownloadFileRequest request)
        {
            if (ConnectionsStorage.Instanse.Contains(request.SessionId))
            {
                var query = new DownloadFileQuery(request.ResponseEndPoint)
                {
                    Id           = request.Id,
                    FileFullName = request.FileFullName
                };

                return(new DownloadFileExecutor(query));
            }

            return(null);
        }
        public DownloadFileResponse DownloadFile(string jobId, string fileReferenceId)
        {
            using (var scope = new OperationContextScope(this.InnerChannel))
            {
                var httpRequest = _Wrapper.CreateRequestMessageProperty("downloadFile");
                OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                var downloadFileRequest = new DownloadFileRequest();
                downloadFileRequest.fileReferenceId = fileReferenceId;
                downloadFileRequest.taskReferenceId = jobId;

                var rez = base.downloadFile(downloadFileRequest);
                return(rez);
            }
        }
Example #21
0
    public void Download(string url, string targetPath, DownloadFileType fileType,
                         OnScriptDownloadFinishedEvent downloadedEvent = null, bool isSaved = false)
    {
        var file = new DownloadFileRequest();

        file.Id                 = DateTime.Now.Millisecond;
        file.fileUrl            = url;
        file.filePath           = targetPath;
        file.fileType           = fileType;
        file.onScriptDownloaded = downloadedEvent;
        file.isSaved            = isSaved;
        _downloadFileList.Add(file);

        StartDownloadFile();
    }
Example #22
0
        public DownloadFileResponse DownloadFile(DownloadFileRequest request)
        {
            DownloadFileResponse response = new DownloadFileResponse();

            try
            {
                response = FileManagerService.RemoteFileCommand(request).Action();
            }
            catch (Exception ex)
            {
                response.Code    = "0001";
                response.Message = ex.Message;
            }

            return(response);
        }
        public static void Run()
        {
            var apiInstance = new FileApi(Constants.GetConfig());

            try
            {
                var request = new DownloadFileRequest("one-page.docx", Constants.MyStorage);

                var response = apiInstance.DownloadFile(request);
                Console.WriteLine("Expected response type is Stream: " + response.Length);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling FileApi: " + e.Message);
            }
        }
        public void TestDownloadFile()
        {
            string remoteFileName = "TestDownloadFile.docx";

            this.UploadFileToStorage(
                remoteDataFolder + "/" + remoteFileName,
                null,
                null,
                File.ReadAllBytes(LocalTestDataFolder + localFile)
                );

            var request = new DownloadFileRequest(
                path: remoteDataFolder + "/" + remoteFileName
                );
            var actual = this.WordsApi.DownloadFile(request);
        }
Example #25
0
        public override Task <DownloadFileResponse> DownloadFile(DownloadFileRequest request, ServerCallContext context)
        {
            try
            {
                var bubu = _testGoogleDrive.DownloadFile(request.FileId);


                return(Task.FromResult(new DownloadFileResponse
                {
                    Content = ByteString.CopyFrom(bubu.ToArray())
                }));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #26
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new FileApi(configuration);

            try
            {
                var request = new DownloadFileRequest("conversions/one-page.docx", Common.MyStorage);

                var response = apiInstance.DownloadFile(request);
                Console.WriteLine("Expected response type is Stream: " + response.Length.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling FileApi: " + e.Message);
            }
        }
Example #27
0
        public async Task <Stream> Get(DownloadFileRequest request)
        {
            var filePath = Directory.GetFiles(outputDirectoryProvider.GetOutputDirectory(), $"{request.Id}.*").FirstOrDefault();

            if (filePath == null)
            {
                return(await NotFoundFileResult.Create());
            }
            else
            {
                var extension    = Path.GetExtension(filePath);
                var downloadName = $"{DateTime.Now:yyyyMMdd_HHmmss}{extension}";
                var result       = await DownloadFileResult.Create(downloadName, filePath);

                File.Delete(filePath);
                return(result);
            }
        }
Example #28
0
        public override async Task DownloadFile(DownloadFileRequest request,
                                                IServerStreamWriter <DownloadFileResponse> responseStream, ServerCallContext context)
        {
            string filePath = Path.Combine(_filePath, string.Format("{0}_{1}_{2}", request.Username, request.Id, request.Filename));

            // Example of exception
            if (File.Exists(filePath) == false)
            {
                _logger.LogError($"File '{filePath}' not found.");
                Metadata metadata = new Metadata()
                {
                    { "Filename", filePath }
                };
                throw new RpcException(new Status(StatusCode.NotFound, "Image file not found."),
                                       metadata, "More details for the exception...");
            }
            DownloadFileResponse downloadResponse = new DownloadFileResponse();

            downloadResponse.Info   = new FileInfo();
            downloadResponse.Status = TransferStatus.Success;

            byte[] image;
            try
            {
                image = File.ReadAllBytes(filePath);
            }
            catch (Exception)
            {
                _logger.LogError($"Exception while reading image file '{filePath}'.");
                throw new RpcException(Status.DefaultCancelled, "Exception while reading image file.");
            }
            int fileOffset = 0;

            byte[] fileChunk = new byte[FileChunkSize];
            while (fileOffset < image.Length)
            {
                int length = Math.Min(FileChunkSize, image.Length - fileOffset);
                Buffer.BlockCopy(image, fileOffset, fileChunk, 0, length);
                fileOffset += length;
                ByteString byteString = ByteString.CopyFrom(fileChunk);
                downloadResponse.ChunkData = byteString;
                await responseStream.WriteAsync(downloadResponse).ConfigureAwait(false);
            }
        }
        private async Task DownloadFile(string fileId, string username, string fileName,
                                        CancellationToken cancellationToken)
        {
            var success    = true;
            var tmpFile    = Path.Combine(Path.GetTempPath(), string.Format("tmp_{0}", Guid.NewGuid().ToString()));
            var targetFile =
                Path.Combine(@"C:\Users\Chris\source\repos\TestGateway\Testclient\Files\Client\Download", fileName);

            try
            {
                var downloadRequest = new DownloadFileRequest {
                    Id = fileId, Username = username, Filename = fileName
                };
                using var streamingCall = _client.DownloadFile(downloadRequest);
                await using (Stream fs = File.OpenWrite(tmpFile))
                {
                    await foreach (var downloadResponse in
                                   streamingCall.ResponseStream.ReadAllAsync(cancellationToken).ConfigureAwait(false))
                    {
                        fs.Write(downloadResponse.ChunkData.ToByteArray());
                    }
                }
            }
            // Is thrown on cancellation -> ignore...
            catch (OperationCanceledException)
            {
                success = false;
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Exception thrown");
                success = false;
            }

            if (!success)
            {
                File.Delete(tmpFile);
            }
            else
            {
                File.Move(tmpFile, targetFile, true);
            }
        }
        /// <summary>
        /// Internal implementation of download attachment
        /// </summary>
        /// <param name="entityId"></param>
        /// <param name="entityName"></param>
        /// <param name="serverRelativeUrl"></param>
        /// <param name="documentType"></param>
        /// <param name="checkUser"></param>
        /// <returns></returns>
        private async Task <IActionResult> DownloadAttachmentInternal(string entityId, string entityName, [FromQuery] string serverRelativeUrl, [FromQuery] string documentType, bool checkUser)
        {
            // get the file.
            if (string.IsNullOrEmpty(serverRelativeUrl) || string.IsNullOrEmpty(documentType) || string.IsNullOrEmpty(entityId) || string.IsNullOrEmpty(entityName))
            {
                return(BadRequest());
            }

            var hasAccess = true;

            if (checkUser)
            {
                ValidateSession();
                hasAccess = await CanAccessEntityFile(entityName, entityId, documentType, serverRelativeUrl).ConfigureAwait(true);
            }

            if (!hasAccess)
            {
                return(BadRequest());
            }

            var logUrl = WordSanitizer.Sanitize(serverRelativeUrl);

            // call the web service
            var downloadRequest = new DownloadFileRequest
            {
                ServerRelativeUrl = serverRelativeUrl
            };

            var downloadResult = _fileManagerClient.DownloadFile(downloadRequest);

            if (downloadResult.ResultStatus == ResultStatus.Success)
            {
                // Update modifiedon to current time
                UpdateEntityModifiedOnDate(entityName, entityId, true);
                _logger.LogInformation($"SUCCESS in getting file {logUrl}");
                var fileContents = downloadResult.Data.ToByteArray();
                return(new FileContentResult(fileContents, "application/octet-stream"));
            }

            _logger.LogError($"ERROR in getting file {logUrl} - {downloadResult.ErrorDetail}");
            throw new Exception($"ERROR in getting file {logUrl} - {downloadResult.ErrorDetail}");
        }
Example #31
0
 private void Worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         BackgroundWorker worker = sender as BackgroundWorker;
         _value = 0;
         foreach (var file in files)
         {
             if (!file.NeedUpdate) continue;
             _value++;
             string fullfilename = _managerPath.TrimEnd('\\') + "\\" + file.FileName.TrimStart('\\');
             FileInfo saveFile = new FileInfo(fullfilename);
             if (!saveFile.Directory.Exists) saveFile.Directory.Create();
             DownloadFileRequest request = new DownloadFileRequest();
             request.FileName = file.FileName;
             var response = SDKFactory.Client.Execute(request);
             response.FileContent.ToFile(fullfilename);
             file.NeedUpdate = false;
             //保存版本信息
             string versionjson = JsonHelper.Serialize(files);
             System.IO.File.WriteAllText(_versionpath, versionjson, Encoding.UTF8);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #32
0
        private void downloadFile(frmLMSMain sender, bool isUpload, HttpRequestMessageProperty httpRequest, string jobID, string fileRefID, string fileName)
        {
            string txt = "";

                if (isUpload)
                    sender.UploadStatus += "Downloading the response file.\n";
                else
                    sender.DownloadStatus += "Downloading the report file.\n";

                try
                {
                    FileTransferServicePortClient client = new FileTransferServicePortClient(FTconfigName);
                    using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                    {

                        OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                        DownloadFileRequest downloadReq = new DownloadFileRequest();
                        downloadReq.fileReferenceId = fileRefID;
                        downloadReq.taskReferenceId = jobID;

                        DownloadFileResponse downloadResponse = client.downloadFile(downloadReq);

                        if (downloadResponse.ack.ToString().Equals("Success"))
                        {
                            FileAttachment attachment = downloadResponse.fileAttachment;
                            saveFileAttachment(attachment, fileName);

                            txt += downloadResponse.timestamp + " :: " + "File was successfully downloaded to " + fileName;
                            Console.WriteLine(txt);
                            if (isUpload)
                                sender.UploadStatus += txt;
                            else
                                sender.DownloadStatus += txt;
                        }
                        else
                        {
                            txt = downloadResponse.timestamp + " :: " + "Problem downloading the file.";
                            Console.WriteLine(txt);
                            if (isUpload)
                                sender.UploadStatus += txt;
                            else
                                sender.DownloadStatus += txt;

                            if (downloadResponse.errorMessage != null)
                            {
                                ErrorAdmin.updateResponseStatus(downloadResponse, sender, isUpload);
                            }
                        }

                    }
                }
                catch (Exception ex)
                {

                    if (isUpload)
                        sender.UploadStatus += ex + "\n";
                    else
                        sender.DownloadStatus += ex + "\n";
                }
        }
Example #33
0
        static void downloadFile(bool isUpload, HttpRequestMessageProperty httpRequest, string jobID, string fileRefID, string fileName)
        {
            //Downloading the response file.\n";
            try
            {
                FileTransferServicePortClient client = new FileTransferServicePortClient(FTconfigName);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {

                    OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                    DownloadFileRequest downloadReq = new DownloadFileRequest();
                    downloadReq.fileReferenceId = fileRefID;
                    downloadReq.taskReferenceId = jobID;

                    DownloadFileResponse downloadResponse = client.downloadFile(downloadReq);

                    if (downloadResponse.ack.ToString().Equals("Success"))
                    {
                        //log into database
                        FileAttachment attachment = downloadResponse.fileAttachment;
                        saveFileAttachment(attachment, fileName);
                        LMSMessage += Environment.NewLine + " response file successfully downloaded:";
                    }
                    else
                    {
                        throw new Exception(downloadResponse.errorMessage[0].message);
                        // "Problem downloading the file.";
                    }

                }
            }
            catch (Exception ex)
            {
                LMSMessage += Environment.NewLine + " downloadFile:" + ex.Message;
            }
        }