diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-09 13:24:57 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-09 13:24:57 -0500 |
| commit | 1a80362a0f04c3cc571456af64f9de19c0c30d2a (patch) | |
| tree | 31916eea422d8ac861aa36a47cae832eee168ad8 /MediaBrowser.ServerApplication/Native/WindowsApp.cs | |
| parent | 40897bac1494791e1ec6abcfe85cda27d4664a32 (diff) | |
created common startup project for mono & windows
Diffstat (limited to 'MediaBrowser.ServerApplication/Native/WindowsApp.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Native/WindowsApp.cs | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs new file mode 100644 index 000000000..a4d0f74ab --- /dev/null +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -0,0 +1,104 @@ +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; + +namespace MediaBrowser.ServerApplication.Native +{ + public class WindowsApp : INativeApp + { + public List<Assembly> GetAssembliesWithParts() + { + var list = new List<Assembly>(); + + list.Add(typeof(PismoIsoManager).Assembly); + + list.Add(GetType().Assembly); + + return list; + } + + public void AuthorizeServer(int httpServerPort, string httpServerUrlPrefix, int udpPort, string tempDirectory) + { + ServerAuthorization.AuthorizeServer(httpServerPort, httpServerUrlPrefix, udpPort, tempDirectory); + } + + public NativeEnvironment Environment + { + get + { + return new NativeEnvironment + { + OperatingSystem = OperatingSystem.Windows, + SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X86_X64 : Architecture.X86 + }; + } + } + + 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(); + } + + public void Restart() + { + MainStartup.Restart(); + } + + public void ConfigureAutoRun(bool autorun) + { + Autorun.Configure(autorun); + } + + public INetworkManager CreateNetworkManager(ILogger logger) + { + return new NetworkManager(logger); + } + + public void PreventSystemStandby() + { + Standby.PreventSystemStandby(); + } + } +} |
