diff options
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 05398984b..7d012a923 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -640,15 +640,14 @@ namespace Emby.Server.Implementations /// Gets the exports. /// </summary> /// <typeparam name="T"></typeparam> - /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param> + /// <param name="manageLifetime">if set to <c>true</c> [manage lifetime].</param> /// <returns>IEnumerable{``0}.</returns> public IEnumerable<T> GetExports<T>(bool manageLifetime = true) { var parts = GetExportTypes<T>() .Select(CreateInstanceSafe) .Where(i => i != null) - .Cast<T>() - .ToList(); + .Cast<T>(); if (manageLifetime) { @@ -703,7 +702,7 @@ namespace Emby.Server.Implementations /// <summary> /// Runs the startup tasks. /// </summary> - public async Task RunStartupTasks() + public Task RunStartupTasks() { Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false)); @@ -736,6 +735,8 @@ namespace Emby.Server.Implementations Logger.LogInformation("All entry points have started"); //LoggerFactory.RemoveConsoleOutput(); + + return Task.CompletedTask; } private void RunEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup) @@ -965,9 +966,6 @@ namespace Emby.Server.Implementations DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory.CreateLogger("DeviceManager"), NetworkManager); RegisterSingleInstance(DeviceManager); - var newsService = new Emby.Server.Implementations.News.NewsService(ApplicationPaths, JsonSerializer); - RegisterSingleInstance<INewsService>(newsService); - MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory.CreateLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder); RegisterSingleInstance(MediaSourceManager); @@ -1312,7 +1310,6 @@ namespace Emby.Server.Implementations { if (!ServerConfigurationManager.Configuration.IsPortAuthorized) { - RegisterServerWithAdministratorAccess(); ServerConfigurationManager.Configuration.IsPortAuthorized = true; ConfigurationManager.SaveConfiguration(); } @@ -2227,32 +2224,6 @@ namespace Emby.Server.Implementations protected abstract void ShutdownInternal(); - /// <summary> - /// Registers the server with administrator access. - /// </summary> - private void RegisterServerWithAdministratorAccess() - { - Logger.LogInformation("Requesting administrative access to authorize http server"); - - try - { - AuthorizeServer(); - } - catch (NotImplementedException) - { - - } - catch (Exception ex) - { - Logger.LogError(ex, "Error authorizing server"); - } - } - - protected virtual void AuthorizeServer() - { - throw new NotImplementedException(); - } - public event EventHandler HasUpdateAvailableChanged; private bool _hasUpdateAvailable; @@ -2267,7 +2238,7 @@ namespace Emby.Server.Implementations if (fireEvent) { - EventHelper.FireEventIfNotNull(HasUpdateAvailableChanged, this, EventArgs.Empty, Logger); + HasUpdateAvailableChanged?.Invoke(this, EventArgs.Empty); } } } @@ -2383,11 +2354,10 @@ namespace Emby.Server.Implementations { Logger.LogInformation("Application has been updated to version {0}", package.versionStr); - EventHelper.FireEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<PackageVersionInfo> + ApplicationUpdated?.Invoke(this, new GenericEventArgs<PackageVersionInfo> { Argument = package - - }, Logger); + }); NotifyPendingRestart(); } |
