aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-11-15 14:55:08 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-11-15 14:55:08 +0200
commitaac4f633ac04ac5b1d134ce35981e8b898f5687e (patch)
treeda21e713aec69e5d6cfc6d64f617a736e34da4a4 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
parentaeacbdabd448b2e7455e16460b996c8090731d9d (diff)
parentb0909a133eaba5223ca397c8186ba6b96fdaa647 (diff)
downloadTango-aac4f633ac04ac5b1d134ce35981e8b898f5687e.tar.gz
Tango-aac4f633ac04ac5b1d134ce35981e8b898f5687e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs22
1 files changed, 10 insertions, 12 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
index 6a65e4fbe..a75ca9017 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -1,4 +1,5 @@
using FluentFTP;
+using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.IO;
@@ -142,28 +143,25 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log("Downloading software package...");
- int fileSize = 0;
+ long fileSize = 0;
DownloadingPackagesProgress = 0;
using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) =>
{
InvokeUINow(() =>
{
- Thread.Sleep(2); //TODO: this is necessary only for visibility...
DownloadingPackagesProgress = ((double)current / (double)fileSize) * 100d;
});
}))
{
- using (FtpClient ftp = new FtpClient(update_response.FtpAddress, update_response.FtpUserName, update_response.FtpPassword))
- {
- LogManager.Log("FTP: Connecting to site: " + update_response.FtpAddress);
- ftp.ConnectAsync().Wait();
- LogManager.Log("FTP: Retrieving download size...");
- fileSize = (int)ftp.GetFileSize(update_response.FtpFilePath);
- LogManager.Log("FTP: Download size: " + fileSize + " bytes.");
- LogManager.Log("FTP: Starting download...");
- ftp.DownloadAsync(fs, update_response.FtpFilePath).Wait();
- }
+ LogManager.Log($"Connecting to storage blob with address {update_response.BlobAddress}");
+ CloudBlockBlob blob = new CloudBlockBlob(new Uri(update_response.BlobAddress));
+ LogManager.Log("Fetching blob attributes...");
+ blob.FetchAttributes();
+ fileSize = blob.Properties.Length;
+ LogManager.Log("Download size: " + fileSize + " bytes.");
+ LogManager.Log("Starting blob download...");
+ blob.DownloadToStream(fs);
}
LogManager.Log("Extracting downloaded zip file...");