mirror of
https://github.com/Radarr/Radarr
synced 2024-12-25 17:27:59 +00:00
43 lines
No EOL
1 KiB
C#
43 lines
No EOL
1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
} |