CoreAppHost.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections.Generic;
  2. using System.Reflection;
  3. using Emby.Server.Implementations;
  4. using MediaBrowser.Common.Net;
  5. using MediaBrowser.Controller.Drawing;
  6. using MediaBrowser.Model.IO;
  7. using Microsoft.Extensions.Configuration;
  8. using Microsoft.Extensions.Logging;
  9. namespace Jellyfin.Server
  10. {
  11. /// <summary>
  12. /// Implementation of the abstract <see cref="ApplicationHost" /> class.
  13. /// </summary>
  14. public class CoreAppHost : ApplicationHost
  15. {
  16. /// <summary>
  17. /// Initializes a new instance of the <see cref="CoreAppHost" /> class.
  18. /// </summary>
  19. /// <param name="applicationPaths">The <see cref="ServerApplicationPaths" /> to be used by the <see cref="CoreAppHost" />.</param>
  20. /// <param name="loggerFactory">The <see cref="ILoggerFactory" /> to be used by the <see cref="CoreAppHost" />.</param>
  21. /// <param name="options">The <see cref="StartupOptions" /> to be used by the <see cref="CoreAppHost" />.</param>
  22. /// <param name="fileSystem">The <see cref="IFileSystem" /> to be used by the <see cref="CoreAppHost" />.</param>
  23. /// <param name="imageEncoder">The <see cref="IImageEncoder" /> to be used by the <see cref="CoreAppHost" />.</param>
  24. /// <param name="networkManager">The <see cref="INetworkManager" /> to be used by the <see cref="CoreAppHost" />.</param>
  25. public CoreAppHost(
  26. ServerApplicationPaths applicationPaths,
  27. ILoggerFactory loggerFactory,
  28. StartupOptions options,
  29. IFileSystem fileSystem,
  30. IImageEncoder imageEncoder,
  31. INetworkManager networkManager)
  32. : base(
  33. applicationPaths,
  34. loggerFactory,
  35. options,
  36. fileSystem,
  37. imageEncoder,
  38. networkManager)
  39. {
  40. }
  41. /// <inheritdoc />
  42. public override bool CanSelfRestart => StartupOptions.RestartPath != null;
  43. /// <inheritdoc />
  44. protected override void RestartInternal() => Program.Restart();
  45. /// <inheritdoc />
  46. protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
  47. {
  48. yield return typeof(CoreAppHost).Assembly;
  49. }
  50. /// <inheritdoc />
  51. protected override void ShutdownInternal() => Program.Shutdown();
  52. }
  53. }