jellyfin/MediaBrowser.Common.Implementations/Updates/ApplicationUpdater.cs

33 lines
1.2 KiB
C#
Raw Normal View History

2013-03-07 05:34:00 +00:00
using MediaBrowser.Common.Configuration;
2013-03-02 19:48:25 +00:00
using System.Diagnostics;
using System.IO;
2013-03-07 05:34:00 +00:00
namespace MediaBrowser.Common.Implementations.Updates
2013-03-02 19:48:25 +00:00
{
public enum MBApplication
{
MBServer,
MBTheater
}
/// <summary>
/// Update the specified application using the specified archive
/// </summary>
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);
2013-03-13 12:51:33 +00:00
Process.Start(target, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false", product, archive, Process.GetCurrentProcess().Id));
2013-03-02 19:48:25 +00:00
// That's it. The installer will do the work once we exit
}
}
}