jellyfin/MediaBrowser.ServerApplication/Native/WindowsApp.cs

130 lines
3.1 KiB
C#
Raw Normal View History

2015-10-12 21:09:56 +02:00
using MediaBrowser.Common.Net;
using MediaBrowser.IsoMounter;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Startup.Common;
using MediaBrowser.ServerApplication.Networking;
using System.Collections.Generic;
using System.Reflection;
2015-10-04 06:23:11 +02:00
using CommonIO;
using MediaBrowser.Controller.Power;
namespace MediaBrowser.ServerApplication.Native
{
public class WindowsApp : INativeApp
{
private readonly IFileSystem _fileSystem;
2016-01-21 18:45:42 +01:00
private readonly ILogger _logger;
2016-01-21 18:45:42 +01:00
public WindowsApp(IFileSystem fileSystem, ILogger logger)
{
_fileSystem = fileSystem;
2016-01-21 18:45:42 +01:00
_logger = logger;
}
public List<Assembly> GetAssembliesWithParts()
{
var list = new List<Assembly>();
2015-10-12 21:09:56 +02:00
if (!System.Environment.Is64BitProcess)
{
2016-01-06 17:57:15 +01:00
//list.Add(typeof(PismoIsoManager).Assembly);
2015-10-12 21:09:56 +02:00
}
list.Add(GetType().Assembly);
return list;
}
2015-01-11 03:12:43 +01:00
public void AuthorizeServer(int udpPort, int httpServerPort, int httpsPort, string tempDirectory)
{
2015-01-11 03:12:43 +01:00
ServerAuthorization.AuthorizeServer(udpPort, httpServerPort, httpsPort, tempDirectory);
}
public NativeEnvironment Environment
{
get
{
return new NativeEnvironment
{
OperatingSystem = OperatingSystem.Windows,
2014-11-24 00:10:41 +01:00
SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X86_X64 : Architecture.X86,
OperatingSystemVersionString = System.Environment.OSVersion.VersionString
};
}
}
public bool SupportsLibraryMonitor
{
get { return true; }
}
public bool SupportsRunningAsService
{
get
{
return true;
}
}
public bool IsRunningAsService
{
get;
set;
}
public bool CanSelfRestart
{
get
{
return MainStartup.CanSelfRestart;
}
}
public bool SupportsAutoRunAtStartup
{
get
{
return true;
}
}
public bool CanSelfUpdate
{
get
{
return MainStartup.CanSelfUpdate;
}
}
public void Shutdown()
{
MainStartup.Shutdown();
}
2015-06-05 16:27:01 +02:00
public void Restart(StartupOptions startupOptions)
{
MainStartup.Restart();
}
public void ConfigureAutoRun(bool autorun)
{
Autorun.Configure(autorun, _fileSystem);
}
public INetworkManager CreateNetworkManager(ILogger logger)
{
return new NetworkManager(logger);
}
public void PreventSystemStandby()
{
Standby.PreventSystemStandby();
}
public IPowerManagement GetPowerManagement()
{
2016-01-21 18:45:42 +01:00
return new WindowsPowerManagement(_logger);
}
}
}