From 9277bbd2fa070c69b83904f8fe5628fab2b947b8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 25 Nov 2018 17:52:49 +0200 Subject: Working on job export import to storage. --- .../MachineUpdate/MachineUpdateManager.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 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 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 }); } + /// + /// Performs a machine update using the specified software update package path. + /// + /// Name of the file. + /// + public Task Update(string fileName) + { + return Task.Factory.StartNew(() => + { + 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 } } -- cgit v1.3.1