Added is running as service to IServerApplicationHost

This commit is contained in:
Luke Pulverenti 2014-01-29 19:18:05 -05:00
parent fb69d5b76d
commit d39f8a1161
4 changed files with 24 additions and 5 deletions

View File

@ -20,6 +20,12 @@ namespace MediaBrowser.Controller
/// <value>The name of the web application.</value> /// <value>The name of the web application.</value>
string WebApplicationName { get; } 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> /// <summary>
/// Gets a value indicating whether [supports automatic run at startup]. /// Gets a value indicating whether [supports automatic run at startup].
/// </summary> /// </summary>

View File

@ -19,7 +19,13 @@ namespace MediaBrowser.Model.System
/// </summary> /// </summary>
/// <value>The operating sytem.</value> /// <value>The operating sytem.</value>
public string OperatingSystem { get; set; } 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> /// <summary>
/// Gets or sets the mac address. /// Gets or sets the mac address.
/// </summary> /// </summary>

View File

@ -179,10 +179,16 @@ namespace MediaBrowser.ServerApplication
/// </summary> /// </summary>
/// <param name="applicationPaths">The application paths.</param> /// <param name="applicationPaths">The application paths.</param>
/// <param name="logManager">The log manager.</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) : base(applicationPaths, logManager)
{ {
_isRunningAsService = isRunningAsService;
}
private readonly bool _isRunningAsService;
public bool IsRunningAsService
{
get { return _isRunningAsService; }
} }
/// <summary> /// <summary>
@ -431,7 +437,7 @@ namespace MediaBrowser.ServerApplication
await ItemRepository.Initialize().ConfigureAwait(false); await ItemRepository.Initialize().ConfigureAwait(false);
await ProviderRepository.Initialize().ConfigureAwait(false); await ProviderRepository.Initialize().ConfigureAwait(false);
((LibraryManager)LibraryManager).ItemRepository = ItemRepository; ((LibraryManager)LibraryManager).ItemRepository = ItemRepository;
} }
@ -687,7 +693,8 @@ namespace MediaBrowser.ServerApplication
WanAddress = GetWanAddress(), WanAddress = GetWanAddress(),
HasUpdateAvailable = _hasUpdateAvailable, HasUpdateAvailable = _hasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup, SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
IsRunningAsService = IsRunningAsService
}; };
} }

View File

@ -212,7 +212,7 @@ namespace MediaBrowser.ServerApplication
SystemEvents.SessionEnding += SystemEvents_SessionEnding; SystemEvents.SessionEnding += SystemEvents_SessionEnding;
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
_appHost = new ApplicationHost(appPaths, logManager); _appHost = new ApplicationHost(appPaths, logManager, runService);
_app = new App(_appHost, _appHost.LogManager.GetLogger("App"), runService); _app = new App(_appHost, _appHost.LogManager.GetLogger("App"), runService);