|
|
@ -36,29 +36,32 @@ namespace NzbDrone
|
|
|
|
|
|
|
|
|
|
|
|
public void Route(ApplicationMode applicationMode)
|
|
|
|
public void Route(ApplicationMode applicationMode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.Info("Application mode: {0}", applicationMode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!_environmentProvider.IsUserInteractive)
|
|
|
|
if(!_environmentProvider.IsUserInteractive)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
applicationMode = ApplicationMode.Service;
|
|
|
|
applicationMode = ApplicationMode.Service;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.Info("Application mode: {0}", applicationMode);
|
|
|
|
|
|
|
|
|
|
|
|
switch (applicationMode)
|
|
|
|
switch (applicationMode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case ApplicationMode.Service:
|
|
|
|
case ApplicationMode.Service:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.Trace("Service selected");
|
|
|
|
_serviceProvider.Run(_applicationServer);
|
|
|
|
_serviceProvider.Run(_applicationServer);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case ApplicationMode.Console:
|
|
|
|
case ApplicationMode.Console:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.Trace("Console selected");
|
|
|
|
_applicationServer.Start();
|
|
|
|
_applicationServer.Start();
|
|
|
|
_consoleProvider.WaitForClose();
|
|
|
|
_consoleProvider.WaitForClose();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case ApplicationMode.InstallService:
|
|
|
|
case ApplicationMode.InstallService:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.Trace("Install Service selected");
|
|
|
|
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
|
|
|
if (_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_consoleProvider.PrintServiceAlreadyExist();
|
|
|
|
_consoleProvider.PrintServiceAlreadyExist();
|
|
|
@ -72,6 +75,7 @@ namespace NzbDrone
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case ApplicationMode.UninstallService:
|
|
|
|
case ApplicationMode.UninstallService:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.Trace("Uninstall Service selected");
|
|
|
|
if (!_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
|
|
|
if (!_serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_consoleProvider.PrintServiceDoestExist();
|
|
|
|
_consoleProvider.PrintServiceDoestExist();
|
|
|
|