You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
using System;
|
|
using System.Diagnostics;
|
|
using System.ServiceProcess;
|
|
using System.Threading;
|
|
using NLog;
|
|
using Ninject;
|
|
|
|
namespace NzbDrone
|
|
{
|
|
public class NzbDroneService : ServiceBase
|
|
{
|
|
|
|
private static readonly Logger Logger = LogManager.GetLogger("Host.CentralDispatch");
|
|
|
|
protected override void OnStart(string[] args)
|
|
{
|
|
try
|
|
{
|
|
while (!Debugger.IsAttached) Thread.Sleep(100);
|
|
Debugger.Break();
|
|
CentralDispatch.Kernel.Get<ApplicationServer>().Start();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
Logger.Fatal("Failed to start Windows Service", e);
|
|
}
|
|
|
|
}
|
|
|
|
protected override void OnStop()
|
|
{
|
|
try
|
|
{
|
|
CentralDispatch.Kernel.Get<ApplicationServer>().Stop();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Logger.Fatal("Failed to stop Windows Service", e);
|
|
}
|
|
}
|
|
}
|
|
} |