aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs32
1 files changed, 20 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 8642c089f..333fb261d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -329,24 +329,32 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log("Downloading software package...");
- long fileSize = 0;
UpdateProgress("Downloading software package", "Downloading...", false);
- using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) =>
+ AutoFileDownloader downloader = new AutoFileDownloader(update_response.BlobAddress, update_response.CdnAddress, tempFile);
+ await downloader.ResolveMode();
+
+ if (downloader.Mode == AutoFileDownloader.DownloadMode.Standard)
{
- UpdateProgress("Downloading software package", "Downloading...", false, current, fileSize);
- }))
+ LogManager.Log($"Connecting to storage CDN with address {downloader.Address}");
+ }
+ else
{
- 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($"Connecting to storage blob with address {downloader.Address}");
}
+ downloader.Progress += (x, e) =>
+ {
+ UpdateProgress("Downloading software package", "Downloading...", false, e.Current, e.Total);
+ };
+
+ var size = await downloader.GetFileSize();
+ LogManager.Log("Download size: " + size + " bytes.");
+ LogManager.Log("Starting file download...");
+ await downloader.Download();
+
+ downloader.Dispose();
+
UpdateProgress("Downloading software package", "Extracting package...");
LogManager.Log("Extracting downloaded zip file...");