using MediaBrowser.Model.Logging;
using System.Linq;
using System.ServiceProcess;
namespace MediaBrowser.ServerApplication
{
///
/// Class BackgroundService
///
public class BackgroundService : ServiceBase
{
public static string Name = "Emby";
public static string DisplayName = "Emby Server";
public static string GetExistingServiceName()
{
return Name;
}
private readonly ILogger _logger;
///
/// Initializes a new instance of the class.
///
public BackgroundService(ILogger logger)
{
_logger = logger;
CanPauseAndContinue = false;
CanStop = true;
ServiceName = GetExistingServiceName();
}
///
/// When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.
///
protected override void OnStop()
{
_logger.Info("Stop command received");
base.OnStop();
}
}
}