2015-01-13 03:46:44 +00:00
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
|
using MediaBrowser.Common.Net;
|
2014-11-09 18:24:57 +00:00
|
|
|
|
using MediaBrowser.IsoMounter;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using MediaBrowser.Server.Startup.Common;
|
|
|
|
|
using MediaBrowser.ServerApplication.Networking;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.ServerApplication.Native
|
|
|
|
|
{
|
|
|
|
|
public class WindowsApp : INativeApp
|
|
|
|
|
{
|
2015-01-13 03:46:44 +00:00
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
|
|
|
|
|
|
public WindowsApp(IFileSystem fileSystem)
|
|
|
|
|
{
|
|
|
|
|
_fileSystem = fileSystem;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-09 18:24:57 +00:00
|
|
|
|
public List<Assembly> GetAssembliesWithParts()
|
|
|
|
|
{
|
|
|
|
|
var list = new List<Assembly>();
|
|
|
|
|
|
|
|
|
|
list.Add(typeof(PismoIsoManager).Assembly);
|
|
|
|
|
|
|
|
|
|
list.Add(GetType().Assembly);
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-11 02:12:43 +00:00
|
|
|
|
public void AuthorizeServer(int udpPort, int httpServerPort, int httpsPort, string tempDirectory)
|
2014-11-09 18:24:57 +00:00
|
|
|
|
{
|
2015-01-11 02:12:43 +00:00
|
|
|
|
ServerAuthorization.AuthorizeServer(udpPort, httpServerPort, httpsPort, tempDirectory);
|
2014-11-09 18:24:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NativeEnvironment Environment
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return new NativeEnvironment
|
|
|
|
|
{
|
|
|
|
|
OperatingSystem = OperatingSystem.Windows,
|
2014-11-23 23:10:41 +00:00
|
|
|
|
SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X86_X64 : Architecture.X86,
|
|
|
|
|
OperatingSystemVersionString = System.Environment.OSVersion.VersionString
|
2014-11-09 18:24:57 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-03 18:13:53 +00:00
|
|
|
|
public bool SupportsLibraryMonitor
|
|
|
|
|
{
|
|
|
|
|
get { return true; }
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-09 18:24:57 +00:00
|
|
|
|
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 14:27:01 +00:00
|
|
|
|
public void Restart(StartupOptions startupOptions)
|
2014-11-09 18:24:57 +00:00
|
|
|
|
{
|
|
|
|
|
MainStartup.Restart();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ConfigureAutoRun(bool autorun)
|
|
|
|
|
{
|
2015-01-13 03:46:44 +00:00
|
|
|
|
Autorun.Configure(autorun, _fileSystem);
|
2014-11-09 18:24:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public INetworkManager CreateNetworkManager(ILogger logger)
|
|
|
|
|
{
|
|
|
|
|
return new NetworkManager(logger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PreventSystemStandby()
|
|
|
|
|
{
|
|
|
|
|
Standby.PreventSystemStandby();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|