aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-12-05 18:06:21 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-12-05 18:06:21 +0200
commit9259bc36791a7084ae33bcf0a698101ddb24d28f (patch)
tree81f41efe302cf8381e282315ce209baf71d78d0f /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup
parent959b48659a8ad212add5927a43da7f5593c54249 (diff)
downloadTango-9259bc36791a7084ae33bcf0a698101ddb24d28f.tar.gz
Tango-9259bc36791a7084ae33bcf0a698101ddb24d28f.zip
Integrated CDN downloads to PPC and MS.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs38
1 files changed, 20 insertions, 18 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
index 537e652e6..cce6c32ab 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -249,27 +249,29 @@ namespace Tango.PPC.Common.MachineSetup
LogManager.Log("Downloading software package...");
- long fileSize = 0;
- UpdateProgress("Downloading software package", "Downloading...", false);
+ AutoFileDownloader downloader = new AutoFileDownloader(setup_response.BlobAddress, setup_response.CdnAddress, tempFile);
+ await downloader.ResolveMode();
- await Task.Factory.StartNew(() =>
+ if (downloader.Mode == AutoFileDownloader.DownloadMode.Standard)
{
- using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) =>
- {
- 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 {downloader.Address}");
+ }
- LogManager.Log($"Connecting to storage blob with address {setup_response.BlobAddress}");
- CloudBlockBlob blob = new CloudBlockBlob(new Uri(setup_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);
- }
- });
+ 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...");