public DomainParseService(ILogService log, ProxyService proxy, ISettingsService settings, VersionService version) { _log = log; _settings = settings; _proxy = proxy; _version = version; }
public ILifetimeScope TestScope() { var log = new mock.LogService(false); var versionService = new real.VersionService(log); var pluginService = new real.PluginService(log, versionService); var argumentsParser = new ArgumentsParser(log, pluginService, $"".Split(' ')); var argumentsService = new real.ArgumentsService(log, argumentsParser); var input = new mock.InputService(new List <string>() { "C", // Cancel command "y", // Confirm cancel all "Q" // Quit }); var builder = new ContainerBuilder(); _ = builder.RegisterInstance(log).As <real.ILogService>(); _ = builder.RegisterInstance(argumentsParser).As <ArgumentsParser>(); _ = builder.RegisterInstance(argumentsService).As <real.IArgumentsService>(); _ = builder.RegisterInstance(argumentsService).As <real.IArgumentsService>(); _ = builder.RegisterInstance(pluginService).As <real.IPluginService>(); _ = builder.RegisterInstance(input).As <real.IInputService>(); _ = builder.RegisterType <mock.MockRenewalStore>().As <real.IRenewalStore>().SingleInstance(); _ = builder.RegisterType <mock.MockSettingsService>().As <real.ISettingsService>().SingleInstance();; _ = builder.RegisterType <mock.UserRoleService>().As <real.IUserRoleService>().SingleInstance(); _ = builder.RegisterType <real.VersionService>().SingleInstance(); _ = builder.RegisterType <real.ProxyService>().SingleInstance(); _ = builder.RegisterType <real.PasswordGenerator>().SingleInstance(); pluginService.Configure(builder); _ = builder.RegisterType <real.DomainParseService>().SingleInstance(); _ = builder.RegisterType <Mock.Clients.MockIISClient>().As <IIISClient>().SingleInstance(); _ = builder.RegisterType <IISHelper>().SingleInstance(); _ = builder.RegisterType <real.ExceptionHandler>().SingleInstance(); _ = builder.RegisterType <UnattendedResolver>(); _ = builder.RegisterType <InteractiveResolver>(); _ = builder.RegisterType <real.AutofacBuilder>().As <real.IAutofacBuilder>().SingleInstance(); _ = builder.RegisterType <AcmeClient>().SingleInstance(); _ = builder.RegisterType <ZeroSsl>().SingleInstance(); _ = builder.RegisterType <real.PemService>().SingleInstance(); _ = builder.RegisterType <EmailClient>().SingleInstance(); _ = builder.RegisterType <ScriptClient>().SingleInstance(); _ = builder.RegisterType <LookupClientProvider>().SingleInstance(); _ = builder.RegisterType <mock.CertificateService>().As <real.ICertificateService>().SingleInstance(); _ = builder.RegisterType <real.TaskSchedulerService>().SingleInstance(); _ = builder.RegisterType <real.NotificationService>().SingleInstance(); _ = builder.RegisterType <RenewalValidator>().SingleInstance(); _ = builder.RegisterType <RenewalExecutor>().SingleInstance(); _ = builder.RegisterType <RenewalManager>().SingleInstance(); _ = builder.Register(c => c.Resolve <real.IArgumentsService>().MainArguments).SingleInstance(); return(builder.Build()); }
public TaskSchedulerService( ISettingsService settings, IArgumentsService arguments, IInputService input, ILogService log, VersionService version) { _arguments = arguments.MainArguments; _settings = settings; _input = input; _log = log; _version = version; }
public SettingsService(ILogService log, IArgumentsService arguments, VersionService version) { _log = log; _arguments = arguments; var settingsFileName = "settings.json"; var settingsFileTemplateName = "settings_default.json"; _log.Verbose($"Looking for {settingsFileName} in {version.ResourcePath}"); var settings = new FileInfo(Path.Combine(version.ResourcePath, settingsFileName)); var settingsTemplate = new FileInfo(Path.Combine(version.ResourcePath, settingsFileTemplateName)); var useFile = settings; if (!settings.Exists && settingsTemplate.Exists) { _log.Verbose($"Copying {settingsFileTemplateName} to {settingsFileName}"); try { settingsTemplate.CopyTo(settings.FullName); } catch (Exception) { _log.Error($"Unable to create {settingsFileName}, falling back to {settingsFileTemplateName}"); useFile = settingsTemplate; } } try { new ConfigurationBuilder() .AddJsonFile(useFile.FullName, true, true) .Build() .Bind(this); } catch (Exception ex) { _log.Error($"Unable to start program using {useFile.Name}"); while (ex.InnerException != null) { _log.Error(ex.InnerException.Message); ex = ex.InnerException; } return; } CreateConfigPath(); CreateLogPath(); CreateCachePath(); Valid = true; }
public PluginService(ILogService logger, VersionService version) { _log = logger; _version = version; _allTypes = GetTypes(); _argumentProviders = GetResolvable <IArgumentsProvider>(); _optionFactories = GetResolvable <IPluginOptionsFactory>(true); _plugins = new List <Type>(); void AddPluginType <T>(string name) { var temp = GetResolvable <T>(); ListPlugins(temp, name); _plugins.AddRange(temp); } AddPluginType <ITargetPlugin>("target"); AddPluginType <IValidationPlugin>("validation"); AddPluginType <IOrderPlugin>("order"); AddPluginType <ICsrPlugin>("csr"); AddPluginType <IStorePlugin>("store"); AddPluginType <IInstallationPlugin>("installation"); }
public ProxyService(ILogService log, ISettingsService settings, VersionService version) { _log = log; _settings = settings; _version = version; }