aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-11-26 08:37:59 +0200
committerAvi Levkovich <avi@twine-s.com>2018-11-26 08:37:59 +0200
commitc04beae40ad2699cc1b27686cc3cb09bd04f13b3 (patch)
tree24052137ca379f9dcaf665801da718a64c6be344 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
parent56277e1cdd3d33e5834fc886e1e236afc9afd7a3 (diff)
parenta78d877a558cc9519ece2b48f6f3281d78874c59 (diff)
downloadTango-c04beae40ad2699cc1b27686cc3cb09bd04f13b3.tar.gz
Tango-c04beae40ad2699cc1b27686cc3cb09bd04f13b3.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
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.cs34
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
}
}