CoreAppHost.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.Collections.Generic;
  2. using System.Reflection;
  3. using Emby.Server.Implementations;
  4. using Emby.Server.Implementations.HttpServer;
  5. using Jellyfin.Server.SocketSharp;
  6. using MediaBrowser.Model.IO;
  7. using MediaBrowser.Model.System;
  8. using Microsoft.Extensions.Configuration;
  9. using Microsoft.Extensions.Logging;
  10. namespace Jellyfin.Server
  11. {
  12. public class CoreAppHost : ApplicationHost
  13. {
  14. public CoreAppHost(
  15. ServerApplicationPaths applicationPaths,
  16. ILoggerFactory loggerFactory,
  17. StartupOptions options,
  18. IFileSystem fileSystem,
  19. IEnvironmentInfo environmentInfo,
  20. MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder,
  21. MediaBrowser.Common.Net.INetworkManager networkManager,
  22. IConfiguration configuration)
  23. : base(
  24. applicationPaths,
  25. loggerFactory,
  26. options,
  27. fileSystem,
  28. environmentInfo,
  29. imageEncoder,
  30. networkManager,
  31. configuration)
  32. {
  33. }
  34. public override bool CanSelfRestart => StartupOptions.RestartPath != null;
  35. protected override bool SupportsDualModeSockets => true;
  36. protected override void RestartInternal() => Program.Restart();
  37. protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
  38. {
  39. yield return typeof(CoreAppHost).Assembly;
  40. }
  41. protected override void ShutdownInternal() => Program.Shutdown();
  42. protected override IHttpListener CreateHttpListener()
  43. => new WebSocketSharpListener(
  44. Logger,
  45. Certificate,
  46. StreamHelper,
  47. NetworkManager,
  48. SocketFactory,
  49. CryptographyProvider,
  50. SupportsDualModeSockets,
  51. FileSystemManager,
  52. EnvironmentInfo);
  53. }
  54. }