aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-14 18:13:32 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-14 18:13:32 +0200
commit5b420a654977644e7e2433a7761dc1a696babd15 (patch)
tree0b2b7132e914aa2e18ea15c89475c7bafc541c98 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
parent281bfcfea70a1c7250e7c081de998e4ce0cc6e0e (diff)
downloadTango-5b420a654977644e7e2433a7761dc1a696babd15.tar.gz
Tango-5b420a654977644e7e2433a7761dc1a696babd15.zip
Moving PPC update, setup and machine service to Azure!!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs23
1 files changed, 11 insertions, 12 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 a3012ffd8..12c4a9de9 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -1,4 +1,5 @@
using FluentFTP;
+using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
@@ -142,28 +143,26 @@ namespace Tango.PPC.Common.MachineSetup
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(setup_response.FtpAddress, setup_response.FtpUserName, setup_response.FtpPassword))
- {
- LogManager.Log("FTP: Connecting to site: " + setup_response.FtpAddress);
- ftp.ConnectAsync().Wait();
- LogManager.Log("FTP: Retrieving download size...");
- fileSize = (int)ftp.GetFileSize(setup_response.FtpFilePath);
- LogManager.Log("FTP: Download size: " + fileSize + " bytes.");
- LogManager.Log("FTP: Starting download...");
- ftp.DownloadAsync(fs, setup_response.FtpFilePath).Wait();
- }
+
+ 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);
}
LogManager.Log("Extracting downloaded zip file...");