Exemple #1
0
        public Wacs(ILifetimeScope container)
        {
            // Basic services
            _container         = container;
            _scopeBuilder      = container.Resolve <AutofacBuilder>();
            _passwordGenerator = container.Resolve <PasswordGenerator>();
            _log = _container.Resolve <ILogService>();

            ShowBanner();

            _arguments = _container.Resolve <IArgumentsService>();
            _args      = _arguments.MainArguments;
            if (_args != null)
            {
                if (_args.Verbose)
                {
                    _log.SetVerbose();
                    _arguments.ShowCommandLine();
                }
                _email          = container.Resolve <EmailClient>();
                _input          = _container.Resolve <IInputService>();
                _renewalService = _container.Resolve <IRenewalService>();
            }
            else
            {
                Environment.Exit(1);
            }
        }
 public AutoRenewal(
     IConfigurationLoader configurationLoader,
     IRenewalService renewalService,
     ILogger <AutoRenewal> logger)
 {
     _configurationLoader = configurationLoader;
     _renewalService      = renewalService;
     _logger = logger;
 }
Exemple #3
0
 public Importer(ILogService log, ILegacyRenewalService legacyRenewal,
                 IRenewalService currentRenewal, LegacyTaskSchedulerService legacyTaskScheduler,
                 TaskSchedulerService currentTaskScheduler, PasswordGenerator passwordGenerator)
 {
     _legacyRenewal        = legacyRenewal;
     _currentRenewal       = currentRenewal;
     _log                  = log;
     _currentTaskScheduler = currentTaskScheduler;
     _legacyTaskScheduler  = legacyTaskScheduler;
     _passwordGenerator    = passwordGenerator;
 }
Exemple #4
0
 public Importer(ILogService log, IInputService input,
                 ILegacyRenewalService legacyRenewal, IRenewalService currentRenewal, PluginService pluginService,
                 LegacyTaskSchedulerService legacyTaskScheduler, TaskSchedulerService currentTaskScheduler)
 {
     _legacyRenewal        = legacyRenewal;
     _currentRenewal       = currentRenewal;
     _log                  = log;
     _input                = input;
     _currentTaskScheduler = currentTaskScheduler;
     _legacyTaskScheduler  = legacyTaskScheduler;
     _pluginService        = pluginService;
 }
Exemple #5
0
 public Wacs(ILifetimeScope container)
 {
     // Basic services
     _container         = container;
     _scopeBuilder      = container.Resolve <AutofacBuilder>();
     _passwordGenerator = container.Resolve <PasswordGenerator>();
     _log = _container.Resolve <ILogService>();
     ShowBanner();
     _optionsService = _container.Resolve <IOptionsService>();
     _input          = _container.Resolve <IInputService>();
     _arguments      = _optionsService.MainArguments;
     if (_arguments != null)
     {
         _renewalService = _container.Resolve <IRenewalService>();
     }
 }
Exemple #6
0
        private static void Main(string[] args)
        {
            // Setup DI
            _container = AutofacBuilder.Global(args, new PluginService(_log));

            // Basic services
            _log            = _container.Resolve <ILogService>();
            _optionsService = _container.Resolve <IOptionsService>();
            _options        = _optionsService.Options;
            if (_options == null)
            {
                return;
            }
            _input = _container.Resolve <IInputService>();

            // .NET Framework check
            var dn = _container.Resolve <DotNetVersionService>();

            if (!dn.Check())
            {
                return;
            }

            // Show version information
            _input.ShowBanner();

            // Advanced services
            _renewalService = _container.Resolve <IRenewalService>();
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            // Main loop
            do
            {
                try
                {
                    if (_options.Renew)
                    {
                        CheckRenewals(_options.ForceRenewal);
                        CloseDefault();
                    }
                    else if (!string.IsNullOrEmpty(_options.Plugin))
                    {
                        if (_options.Cancel)
                        {
                            CancelRenewal();
                        }
                        else
                        {
                            CreateNewCertificate(RunLevel.Unattended);
                        }
                        CloseDefault();
                    }
                    else
                    {
                        MainMenu();
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
                if (!_options.CloseOnFinish)
                {
                    _options.Plugin       = null;
                    _options.Renew        = false;
                    _options.ForceRenewal = false;
                    Environment.ExitCode  = 0;
                }
            } while (!_options.CloseOnFinish);
        }