/// <summary> /// Main loop /// </summary> public void Start() { // Validation failure if (_arguments == null) { Environment.Exit(1); } // Version display (handled by ShowBanner in constructor) if (_arguments.Version) { CloseDefault(); if (_arguments.CloseOnFinish) { return; } } // Help function if (_arguments.Help) { _optionsService.ShowHelp(); CloseDefault(); if (_arguments.CloseOnFinish) { return; } } // Verbose logging if (_arguments.Verbose) { _log.SetVerbose(); } // Main loop do { try { if (_arguments.Import) { Import(RunLevel.Unattended); CloseDefault(); } else if (_arguments.List) { ShowRenewals(); CloseDefault(); } else if (_arguments.Renew) { CheckRenewals(_arguments.Force); CloseDefault(); } else if (!string.IsNullOrEmpty(_arguments.Target)) { if (_arguments.Cancel) { CancelRenewal(RunLevel.Unattended); } else { CreateNewCertificate(RunLevel.Unattended); } CloseDefault(); } else { MainMenu(); } } catch (Exception ex) { HandleException(ex); } if (!_arguments.CloseOnFinish) { _arguments.Clear(); Environment.ExitCode = 0; } } while (!_arguments.CloseOnFinish); }