Exemplo n.º 1
0
        private void DownloadFile(string path, ImportedFile file)
        {
            using (var fs = File.Create(path))
            {
                using (var responseStream = _ftpLoader.LoadFileFromFtp(file))
                {
                    responseStream.CopyTo(fs);
                }

                fs.Flush();
            }
        }
Exemplo n.º 2
0
        public void SaveFile(ImportedFile file)
        {
            using (var responseStream = _ftpLoader.LoadFileFromFtp(file))
            {
                CloudStorageAccount storageAccount    = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStorageConnectionString"]);
                CloudBlobClient     blobServiceClient = storageAccount.CreateCloudBlobClient();

                CloudBlobContainer containerClient = blobServiceClient.GetContainerReference(FolderName);
                containerClient.CreateIfNotExists();
                var blockBlob = containerClient.GetBlockBlobReference(file.OriginalFileName);
                blockBlob.Properties.ContentType = "text/xml";

                blockBlob.UploadFromStream(responseStream);
            }
        }