1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 17:27:59 +00:00
Radarr/NzbDrone/Router.cs
2011-10-12 19:24:30 -07:00

56 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Model;
using NzbDrone.Providers;
namespace NzbDrone
{
public class Router
{
private static readonly Logger Logger = LogManager.GetLogger("Host.Router");
private readonly ApplicationServer _applicationServer;
private readonly ServiceProvider _serviceProvider;
private readonly ConsoleProvider _consoleProvider;
public Router(ApplicationServer applicationServer, ServiceProvider serviceProvider, ConsoleProvider consoleProvider)
{
_applicationServer = applicationServer;
_serviceProvider = serviceProvider;
_consoleProvider = consoleProvider;
}
public void Route()
{
Logger.Info("Application mode: {0}", CentralDispatch.ApplicationMode);
switch (CentralDispatch.ApplicationMode)
{
case ApplicationMode.Console:
{
_applicationServer.Start();
_consoleProvider.WaitForClose();
break;
}
case ApplicationMode.InstallService:
{
_serviceProvider.Install();
break;
}
case ApplicationMode.UninstallService:
{
_serviceProvider.UnInstall();
break;
}
default:
{
_consoleProvider.PrintHelp();
break;
}
}
}
}
}