CoreAppHost.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. /// <param name="configuration">The <see cref="IConfiguration" /> to be used by the <see cref="CoreAppHost" />.</param>
  26. public CoreAppHost(
  27. ServerApplicationPaths applicationPaths,
  28. ILoggerFactory loggerFactory,
  29. StartupOptions options,
  30. IFileSystem fileSystem,
  31. IImageEncoder imageEncoder,
  32. INetworkManager networkManager,
  33. IConfiguration configuration)
  34. : base(
  35. applicationPaths,
  36. loggerFactory,
  37. options,
  38. fileSystem,
  39. imageEncoder,
  40. networkManager,
  41. configuration)
  42. {
  43. }
  44. /// <inheritdoc />
  45. public override bool CanSelfRestart => StartupOptions.RestartPath != null;
  46. /// <inheritdoc />
  47. protected override void RestartInternal() => Program.Restart();
  48. /// <inheritdoc />
  49. protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
  50. {
  51. yield return typeof(CoreAppHost).Assembly;
  52. }
  53. /// <inheritdoc />
  54. protected override void ShutdownInternal() => Program.Shutdown();
  55. }
  56. }