diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-29 19:18:05 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-29 19:18:05 -0500 |
| commit | d39f8a11614de8850de9a9b433c1a4f190ccadc9 (patch) | |
| tree | b95d1c1142d104d201a5a0f92245a2bb7e7b19d2 | |
| parent | fb69d5b76d9f43979037ee2bb7469917c6e82633 (diff) | |
Added is running as service to IServerApplicationHost
| -rw-r--r-- | MediaBrowser.Controller/IServerApplicationHost.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/System/SystemInfo.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/ApplicationHost.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 2 |
4 files changed, 24 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 5554ced37..38a3cc923 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -21,6 +21,12 @@ namespace MediaBrowser.Controller string WebApplicationName { get; } /// <summary> + /// Gets a value indicating whether this instance is running as service. + /// </summary> + /// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value> + bool IsRunningAsService { get; } + + /// <summary> /// Gets a value indicating whether [supports automatic run at startup]. /// </summary> /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value> diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 3082e80b6..24707b29b 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -19,7 +19,13 @@ namespace MediaBrowser.Model.System /// </summary> /// <value>The operating sytem.</value> public string OperatingSystem { get; set; } - + + /// <summary> + /// Gets or sets a value indicating whether this instance is running as service. + /// </summary> + /// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value> + public bool IsRunningAsService { get; set; } + /// <summary> /// Gets or sets the mac address. /// </summary> diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 4b15ca8d0..91019c0a8 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -179,10 +179,16 @@ namespace MediaBrowser.ServerApplication /// </summary> /// <param name="applicationPaths">The application paths.</param> /// <param name="logManager">The log manager.</param> - public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager) + public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool isRunningAsService) : base(applicationPaths, logManager) { + _isRunningAsService = isRunningAsService; + } + private readonly bool _isRunningAsService; + public bool IsRunningAsService + { + get { return _isRunningAsService; } } /// <summary> @@ -431,7 +437,7 @@ namespace MediaBrowser.ServerApplication await ItemRepository.Initialize().ConfigureAwait(false); await ProviderRepository.Initialize().ConfigureAwait(false); - + ((LibraryManager)LibraryManager).ItemRepository = ItemRepository; } @@ -687,7 +693,8 @@ namespace MediaBrowser.ServerApplication WanAddress = GetWanAddress(), HasUpdateAvailable = _hasUpdateAvailable, SupportsAutoRunAtStartup = SupportsAutoRunAtStartup, - TranscodingTempPath = ApplicationPaths.TranscodingTempPath + TranscodingTempPath = ApplicationPaths.TranscodingTempPath, + IsRunningAsService = IsRunningAsService }; } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 302136321..f34c3921d 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -212,7 +212,7 @@ namespace MediaBrowser.ServerApplication SystemEvents.SessionEnding += SystemEvents_SessionEnding; SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; - _appHost = new ApplicationHost(appPaths, logManager); + _appHost = new ApplicationHost(appPaths, logManager, runService); _app = new App(_appHost, _appHost.LogManager.GetLogger("App"), runService); |
