WindowsApp.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using MediaBrowser.Common.Net;
  2. using MediaBrowser.IsoMounter;
  3. using MediaBrowser.Model.Logging;
  4. using MediaBrowser.Server.Startup.Common;
  5. using MediaBrowser.ServerApplication.Networking;
  6. using System.Collections.Generic;
  7. using System.Reflection;
  8. namespace MediaBrowser.ServerApplication.Native
  9. {
  10. public class WindowsApp : INativeApp
  11. {
  12. public List<Assembly> GetAssembliesWithParts()
  13. {
  14. var list = new List<Assembly>();
  15. list.Add(typeof(PismoIsoManager).Assembly);
  16. list.Add(GetType().Assembly);
  17. return list;
  18. }
  19. public void AuthorizeServer(int httpServerPort, string httpServerUrlPrefix, int udpPort, string tempDirectory)
  20. {
  21. ServerAuthorization.AuthorizeServer(httpServerPort, httpServerUrlPrefix, udpPort, tempDirectory);
  22. }
  23. public NativeEnvironment Environment
  24. {
  25. get
  26. {
  27. return new NativeEnvironment
  28. {
  29. OperatingSystem = OperatingSystem.Windows,
  30. SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X86_X64 : Architecture.X86
  31. };
  32. }
  33. }
  34. public bool SupportsRunningAsService
  35. {
  36. get
  37. {
  38. return true;
  39. }
  40. }
  41. public bool IsRunningAsService
  42. {
  43. get;
  44. set;
  45. }
  46. public bool CanSelfRestart
  47. {
  48. get
  49. {
  50. return MainStartup.CanSelfRestart;
  51. }
  52. }
  53. public bool SupportsAutoRunAtStartup
  54. {
  55. get
  56. {
  57. return true;
  58. }
  59. }
  60. public bool CanSelfUpdate
  61. {
  62. get
  63. {
  64. return MainStartup.CanSelfUpdate;
  65. }
  66. }
  67. public void Shutdown()
  68. {
  69. MainStartup.Shutdown();
  70. }
  71. public void Restart()
  72. {
  73. MainStartup.Restart();
  74. }
  75. public void ConfigureAutoRun(bool autorun)
  76. {
  77. Autorun.Configure(autorun);
  78. }
  79. public INetworkManager CreateNetworkManager(ILogger logger)
  80. {
  81. return new NetworkManager(logger);
  82. }
  83. public void PreventSystemStandby()
  84. {
  85. Standby.PreventSystemStandby();
  86. }
  87. }
  88. }