/// <summary>
        ///
        /// </summary>
        /// <param name="entryType"></param>
        /// <returns></returns>
        public GeneralSetting GetGeneralSettings(GeneralSettingEntryType entryType)
        {
            GeneralSetting settingsValue = generalSettingsReader.Read(configFilePath, entryType);

            if (settingsValue == null)
            {
                //get a default state setting if the reader is unable to read one from the config file
                settingsValue = settingsFactory.CreateSettings <GeneralSetting>(entryType);
            }

            return(settingsValue);
        }
        public FileSystemSettings ProvideFileSystemSettings()
        {
            var config = new SettingsConfiguration(
                "FileSystemSettings",
                string.Empty,
                typeof(SettingsProvider).Assembly.GetBasePath());

            var fileSystemSettingsDto = _settingsFactory.CreateSettings <FileSystemSettingsDto>(config);

            return(new FileSystemSettings {
                DirectoryPath = fileSystemSettingsDto.DirectoryPath
            });
        }
Ejemplo n.º 3
0
 public TranslationServiceSettingsProvider(ISettingsFactory settingsFactory)
 {
     _appSettings = settingsFactory.CreateSettings <TestConsoleAppSettings>(
         "AppSettings",
         string.Empty,
         typeof(TranslationServiceSettingsProvider).Assembly.CodeBase);
 }
Ejemplo n.º 4
0
        public void Initialize(string settingsPath)
        {
            var settingsConfig = new SettingsConfiguration(
                AppSettings.SectionKey,
                string.Empty,
                settingsPath,
                @"Apps\DeeplTranslator\");

            var settingsDto = _settingsFactory.CreateSettings <AppSettingsDto>(settingsConfig);

            _appSettings = new AppSettings(settingsDto.DeeplApiKey);
        }
        public DeeplSettingsProvider(ISettingsFactory settingsFactory)
        {
            var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            var config = new SettingsConfiguration(
                "AppSettings",
                environmentName,
                typeof(DeeplSettingsProvider).Assembly.GetBasePath(),
                "Apps/DeeplTranslations");

            Settings = settingsFactory.CreateSettings <DeeplSettingsDto>(config);
        }
        ISettings CreateSettings(IPropertyService propertyService, ISettingsFactory settingsFactory)
        {
            var settingsFileName = new ProjectTemplatePackagesSettingsFileName(propertyService);

            return(settingsFactory.CreateSettings(settingsFileName.Directory));
        }
		ISettings CreateSettings(IPropertyService propertyService, ISettingsFactory settingsFactory)
		{
			var settingsFileName = new ProjectTemplatePackagesSettingsFileName(propertyService);
			return settingsFactory.CreateSettings(settingsFileName.Directory);
		}