aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
commit9277bbd2fa070c69b83904f8fe5628fab2b947b8 (patch)
tree3099f9ce92f04c28517eb13938e913a1e376b3fe /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate
parentf779e2b6f0bb1dedc7644c64651b59e31ce62c00 (diff)
downloadTango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.tar.gz
Tango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.zip
Working on job export import to storage.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs7
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs34
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs3
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
}
}