From c338e69e9b60ddb71102a6b11058912dd06d5018 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 26 Nov 2018 13:12:10 +0200 Subject: Import job & update completed with dialogs! --- .../MachineUpdate/MachineUpdateManager.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs') 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 d3757e50d..b4780887b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -2,6 +2,7 @@ using Microsoft.WindowsAzure.Storage.Blob; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; @@ -479,6 +480,33 @@ namespace Tango.PPC.Common.MachineUpdate }); } + /// + /// Gets the update package file information. + /// + /// The file path. + /// + public Task GetUpdatePackageFileInfo(string filePath) + { + return Task.Factory.StartNew(() => + { + UpdatePackageFile file = new UpdatePackageFile(); + var tempFolder = TemporaryManager.CreateFolder(); + + using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile(filePath)) + { + var appEntry = zip.Entries.SingleOrDefault(x => x.FileName == "Tango.PPC.UI.exe"); + appEntry.Extract(tempFolder); + } + + FileVersionInfo info = FileVersionInfo.GetVersionInfo(Path.Combine(tempFolder, "Tango.PPC.UI.exe")); + file.Version = Version.Parse(info.ProductVersion); + + tempFolder.Delete(); + + return file; + }); + } + #endregion } } -- cgit v1.3.1