diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 18:41:28 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 18:41:28 +0200 |
| commit | ab4d7232c388a10224a642fe210b30670f91e574 (patch) | |
| tree | 75b7349a23f5db0c682dcce2ba87a85a18409b42 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate | |
| parent | 80ed2914882d82dce0f60c09185da6a500f78d8b (diff) | |
| parent | 03180d26af65c24822cf5ffd44a347db7394d3b2 (diff) | |
| download | Tango-ab4d7232c388a10224a642fe210b30670f91e574.tar.gz Tango-ab4d7232c388a10224a642fe210b30670f91e574.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate')
3 files changed, 43 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs index d2be997b5..13752b931 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs @@ -43,6 +43,13 @@ namespace Tango.PPC.Common.MachineUpdate Task<MachineUpdateResult> Update(String serialNumber, String machineServiceAddress); /// <summary> + /// Performs a machine update using the specified software update package path. + /// </summary> + /// <param name="fileName">Name of the file.</param> + /// <returns></returns> + Task<MachineUpdateResult> Update(String fileName); + + /// <summary> /// Checks if any update are available for the specified machine serial number. /// </summary> /// <param name="serialNumber">The serial number.</param> 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 a75ca9017..d3757e50d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -445,6 +445,40 @@ namespace Tango.PPC.Common.MachineUpdate }); } + /// <summary> + /// Performs a machine update using the specified software update package path. + /// </summary> + /// <param name="fileName">Name of the file.</param> + /// <returns></returns> + public Task<MachineUpdateResult> Update(string fileName) + { + return Task.Factory.StartNew<MachineUpdateResult>(() => + { + CurrentStep = MachineUpdateSteps.UpdatingFromPackage; + + LogManager.Log($"Starting machine update from update package '{fileName}'..."); + + //Create temporary folders for packages. + var _newPackageTempFolder = TemporaryManager.CreateFolder(); + _newPackageTempFolder.Persist = true; + + LogManager.Log("Extracting downloaded zip file..."); + //Extract software package. + ZipFile.ExtractToDirectory(fileName, _newPackageTempFolder); + + LogManager.Log("Copying latest updater utility to application path..."); + //Copy new updater utility to app path. + File.Copy(Path.Combine(_newPackageTempFolder, "Tango.PPC.Updater.exe"), Path.Combine(PathHelper.GetStartupPath(), "Tango.PPC.Updater.exe"), true); + + LogManager.Log("Update operation completed!"); + + return new MachineUpdateResult() + { + UpdatePackagePath = _newPackageTempFolder, + }; + }); + } + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs index 3d8208e4b..74931d2d4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs @@ -16,6 +16,7 @@ namespace Tango.PPC.Common.MachineUpdate [Description("Synchronizing Data")] SynchronizingData, [Description("Updating Configuration")] - SynchronizingMachineConfiguration + SynchronizingMachineConfiguration, + UpdatingFromPackage } } |
