public void Route(ApplicationModes applicationModes) { _logger.Info("Application mode: {0}", applicationModes); switch (applicationModes) { case ApplicationModes.InstallService: { _logger.Debug("Install Service selected"); if (_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)) { _consoleService.PrintServiceAlreadyExist(); } else { _remoteAccessAdapter.MakeAccessible(true); _serviceProvider.Install(ServiceProvider.SERVICE_NAME); _serviceProvider.SetPermissions(ServiceProvider.SERVICE_NAME); // Start the service and exit. // Ensures that there isn't an instance of Readarr already running that the service account cannot stop. _processProvider.SpawnNewProcess("sc.exe", $"start {ServiceProvider.SERVICE_NAME}", null, true); } break; } case ApplicationModes.UninstallService: { _logger.Debug("Uninstall Service selected"); if (!_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)) { _consoleService.PrintServiceDoesNotExist(); } else { _serviceProvider.Uninstall(ServiceProvider.SERVICE_NAME); } break; } case ApplicationModes.RegisterUrl: { _logger.Debug("Regiser URL selected"); _remoteAccessAdapter.MakeAccessible(false); break; } default: { _consoleService.PrintHelp(); break; } } }
public void StartServer() { _remoteAccessAdapter.MakeAccessible(true); _logger.Info("Listening on the following URLs:"); foreach (var url in _urlAclAdapter.Urls) { _logger.Info(" {0}", url); } _owinApp = _owinAppFactory.CreateApp(_urlAclAdapter.Urls); }