CoreAppHost.cs 1.9 KB

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