mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
support mono restarts
This commit is contained in:
parent
d0c9273d67
commit
fb48dd3487
@ -146,6 +146,26 @@ namespace MediaBrowser.Server.Mac
|
|||||||
MenuBarIcon.Instance.Terminate ();
|
MenuBarIcon.Instance.Terminate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Restart()
|
||||||
|
{
|
||||||
|
_logger.Info("Disposing app host");
|
||||||
|
AppHost.Dispose();
|
||||||
|
|
||||||
|
_logger.Info("Starting new instance");
|
||||||
|
|
||||||
|
var currentProcess = Process.GetCurrentProcess();
|
||||||
|
|
||||||
|
var args = Environment.GetCommandLineArgs()
|
||||||
|
.Select(NormalizeCommandLineArgument);
|
||||||
|
|
||||||
|
var commandLineArgsString = string.Join(" ", args.ToArray());
|
||||||
|
|
||||||
|
Process.Start(currentProcess.MainModule.FileName, commandLineArgsString);
|
||||||
|
|
||||||
|
_logger.Info("AppController.Terminate");
|
||||||
|
MenuBarIcon.Instance.Terminate();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the UnhandledException event of the CurrentDomain control.
|
/// Handles the UnhandledException event of the CurrentDomain control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,16 +19,16 @@ namespace MediaBrowser.Server.Mac
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restarts this instance.
|
/// Restarts this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Restart()
|
public virtual void Restart()
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether this instance [can self restart].
|
/// Determines whether this instance [can self restart].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
||||||
public bool CanSelfRestart
|
public virtual bool CanSelfRestart
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,27 @@ namespace MediaBrowser.Server.Mac
|
|||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
{
|
{
|
||||||
MainClass.Shutdown();
|
MainClass.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this instance [can self restart].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
||||||
|
public override bool CanSelfRestart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restarts this instance.
|
||||||
|
/// </summary>
|
||||||
|
public override void Restart()
|
||||||
|
{
|
||||||
|
MainClass.Restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,16 +21,16 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restarts this instance.
|
/// Restarts this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Restart()
|
public virtual void Restart()
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether this instance [can self restart].
|
/// Determines whether this instance [can self restart].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
|
||||||
public bool CanSelfRestart
|
public virtual bool CanSelfRestart
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -13,5 +13,25 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
{
|
{
|
||||||
MainClass.Shutdown();
|
MainClass.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this instance [can self restart].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
|
||||||
|
public override bool CanSelfRestart
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restarts this instance.
|
||||||
|
/// </summary>
|
||||||
|
public override void Restart()
|
||||||
|
{
|
||||||
|
MainClass.Restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.IO;
|
|
||||||
using MediaBrowser.Common.Implementations.IO;
|
using MediaBrowser.Common.Implementations.IO;
|
||||||
using MediaBrowser.Common.Implementations.Logging;
|
using MediaBrowser.Common.Implementations.Logging;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
@ -8,6 +7,8 @@ using MediaBrowser.Server.Startup.Common;
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -136,6 +137,36 @@ namespace MediaBrowser.Server.Mono
|
|||||||
{
|
{
|
||||||
ApplicationTaskCompletionSource.SetResult (true);
|
ApplicationTaskCompletionSource.SetResult (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Restart()
|
||||||
|
{
|
||||||
|
_logger.Info("Disposing app host");
|
||||||
|
_appHost.Dispose();
|
||||||
|
|
||||||
|
_logger.Info("Starting new instance");
|
||||||
|
|
||||||
|
var currentProcess = Process.GetCurrentProcess();
|
||||||
|
|
||||||
|
var args = Environment.GetCommandLineArgs()
|
||||||
|
.Select(NormalizeCommandLineArgument);
|
||||||
|
|
||||||
|
var commandLineArgsString = string.Join(" ", args.ToArray());
|
||||||
|
|
||||||
|
Process.Start(currentProcess.MainModule.FileName, commandLineArgsString);
|
||||||
|
|
||||||
|
_logger.Info("Calling Environment.Exit");
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string NormalizeCommandLineArgument(string arg)
|
||||||
|
{
|
||||||
|
if (arg.IndexOf(" ", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "\"" + arg + "\"";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoCheckCertificatePolicy : ICertificatePolicy
|
class NoCheckCertificatePolicy : ICertificatePolicy
|
||||||
|
@ -516,11 +516,11 @@ namespace MediaBrowser.ServerApplication
|
|||||||
_logger.Info("Hiding server notify icon");
|
_logger.Info("Hiding server notify icon");
|
||||||
_serverNotifyIcon.Visible = false;
|
_serverNotifyIcon.Visible = false;
|
||||||
|
|
||||||
_logger.Info("Executing windows forms restart");
|
_logger.Info("Starting new instance");
|
||||||
//Application.Restart();
|
//Application.Restart();
|
||||||
Process.Start(_appHost.ServerConfigurationManager.ApplicationPaths.ApplicationPath);
|
Process.Start(_appHost.ServerConfigurationManager.ApplicationPaths.ApplicationPath);
|
||||||
|
|
||||||
_logger.Info("Calling Application.Exit");
|
_logger.Info("Calling Environment.Exit");
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
//[assembly: AssemblyVersion("3.0.*")]
|
//[assembly: AssemblyVersion("3.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.5621.0")]
|
[assembly: AssemblyVersion("3.0.5621.1")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user