|
|
@ -3,7 +3,6 @@ using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
using MediaBrowser.Common.Updates;
|
|
|
|
using MediaBrowser.Common.Updates;
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
|
|
|
using MediaBrowser.Controller.Plugins;
|
|
|
|
using MediaBrowser.Controller.Plugins;
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
using MediaBrowser.Model.Updates;
|
|
|
|
using MediaBrowser.Model.Updates;
|
|
|
@ -20,34 +19,24 @@ namespace Emby.Server.Implementations.EntryPoints
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private readonly IInstallationManager _installationManager;
|
|
|
|
private readonly IInstallationManager _installationManager;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The kernel.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private readonly IServerApplicationHost _appHost;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ISessionManager _sessionManager;
|
|
|
|
private readonly ISessionManager _sessionManager;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="ServerEventNotifier"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="ServerEventNotifier"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="appHost">The application host.</param>
|
|
|
|
|
|
|
|
/// <param name="installationManager">The installation manager.</param>
|
|
|
|
/// <param name="installationManager">The installation manager.</param>
|
|
|
|
/// <param name="sessionManager">The session manager.</param>
|
|
|
|
/// <param name="sessionManager">The session manager.</param>
|
|
|
|
public ServerEventNotifier(
|
|
|
|
public ServerEventNotifier(
|
|
|
|
IServerApplicationHost appHost,
|
|
|
|
|
|
|
|
IInstallationManager installationManager,
|
|
|
|
IInstallationManager installationManager,
|
|
|
|
ISessionManager sessionManager)
|
|
|
|
ISessionManager sessionManager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_installationManager = installationManager;
|
|
|
|
_installationManager = installationManager;
|
|
|
|
_appHost = appHost;
|
|
|
|
|
|
|
|
_sessionManager = sessionManager;
|
|
|
|
_sessionManager = sessionManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
/// <inheritdoc />
|
|
|
|
public Task RunAsync()
|
|
|
|
public Task RunAsync()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_appHost.HasPendingRestartChanged += OnHasPendingRestartChanged;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
|
|
|
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
|
|
|
_installationManager.PackageInstalling += OnPackageInstalling;
|
|
|
|
_installationManager.PackageInstalling += OnPackageInstalling;
|
|
|
|
_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
|
|
|
|
_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
|
|
|
@ -87,16 +76,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
|
|
|
await SendMessageToAdminSessions("PluginUninstalled", e).ConfigureAwait(false);
|
|
|
|
await SendMessageToAdminSessions("PluginUninstalled", e).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Handles the HasPendingRestartChanged event of the kernel control.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="sender">The source of the event.</param>
|
|
|
|
|
|
|
|
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
|
|
|
|
|
|
|
private async void OnHasPendingRestartChanged(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _sessionManager.SendRestartRequiredNotification(CancellationToken.None).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SendMessageToAdminSessions<T>(string name, T data)
|
|
|
|
private async Task SendMessageToAdminSessions<T>(string name, T data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -128,8 +107,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
|
|
|
_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
|
|
|
|
_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
|
|
|
|
_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
|
|
|
|
_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
|
|
|
|
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
|
|
|
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
|
|
|
|
|
|
|
|
|
|
|
_appHost.HasPendingRestartChanged -= OnHasPendingRestartChanged;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|