diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-25 17:52:49 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-25 17:52:49 +0200 |
| commit | 9277bbd2fa070c69b83904f8fe5628fab2b947b8 (patch) | |
| tree | 3099f9ce92f04c28517eb13938e913a1e376b3fe /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | |
| parent | f779e2b6f0bb1dedc7644c64651b59e31ce62c00 (diff) | |
| download | Tango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.tar.gz Tango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.zip | |
Working on job export import to storage.
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 | 34 |
1 files changed, 34 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 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 } } |
