From 4f67fc4aefc11c1a4293227c70de922dbe03c652 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Thu, 7 Mar 2013 00:34:00 -0500 Subject: removed base kernel and ikernel --- .../Updates/ApplicationUpdater.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 MediaBrowser.Common.Implementations/Updates/ApplicationUpdater.cs (limited to 'MediaBrowser.Common.Implementations/Updates') diff --git a/MediaBrowser.Common.Implementations/Updates/ApplicationUpdater.cs b/MediaBrowser.Common.Implementations/Updates/ApplicationUpdater.cs new file mode 100644 index 0000000000..3b06f2006d --- /dev/null +++ b/MediaBrowser.Common.Implementations/Updates/ApplicationUpdater.cs @@ -0,0 +1,32 @@ +using MediaBrowser.Common.Configuration; +using System.Diagnostics; +using System.IO; + +namespace MediaBrowser.Common.Implementations.Updates +{ + public enum MBApplication + { + MBServer, + MBTheater + } + + /// + /// Update the specified application using the specified archive + /// + public class ApplicationUpdater + { + private const string UpdaterExe = "Mediabrowser.Installer.exe"; + public void UpdateApplication(MBApplication app, IApplicationPaths appPaths, string archive) + { + // Use our installer passing it the specific archive + // We need to copy to a temp directory and execute it there + var source = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe); + var target = Path.Combine(Path.GetTempPath(), UpdaterExe); + var product = app == MBApplication.MBTheater ? "mbt" : "server"; + File.Copy(source, target, true); + Process.Start(UpdaterExe, string.Format("product={0} archive=\"{1}\" caller={2}", product, archive, Process.GetCurrentProcess().Id)); + + // That's it. The installer will do the work once we exit + } + } +} -- cgit v1.2.3