diff options
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.cs | 28 |
1 files changed, 28 insertions, 0 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 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 }); } + /// <summary> + /// Gets the update package file information. + /// </summary> + /// <param name="filePath">The file path.</param> + /// <returns></returns> + public Task<UpdatePackageFile> GetUpdatePackageFileInfo(string filePath) + { + return Task.Factory.StartNew<UpdatePackageFile>(() => + { + 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 } } |
