Example #1
0
        IEnumerable <ShellSettings> IShellSettingsManager.LoadSettings()
        {
            var shellSettings = new List <ShellSettings>();

            foreach (var tenant in _appDataFolder.ListDirectories(_optionsAccessor.Value.Location))
            {
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("ShellSettings found in '{0}', attempting to load.", tenant.Name);
                }
                var configurationContainer =
                    new ConfigurationBuilder()
                    .AddJsonFile(_appDataFolder.Combine(tenant.PhysicalPath, string.Format(SettingsFileNameFormat, "json")),
                                 true)
                    .AddXmlFile(_appDataFolder.Combine(tenant.PhysicalPath, string.Format(SettingsFileNameFormat, "xml")),
                                true)
                    .AddYamlFile(_appDataFolder.Combine(tenant.PhysicalPath, string.Format(SettingsFileNameFormat, "txt")),
                                 false);

                var config       = configurationContainer.Build();
                var shellSetting = ShellSettingsSerializer.ParseSettings(config);
                shellSettings.Add(shellSetting);

                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("Loaded ShellSettings for tenant '{0}'", shellSetting.Name);
                }
            }

            return(shellSettings);
        }
Example #2
0
        IEnumerable <ShellSettings> IShellSettingsManager.LoadSettings()
        {
            var shellSettings = new List <ShellSettings>();

            foreach (var tenant in
                     _hostingEnvironment.ContentRootFileProvider.GetDirectoryContents(
                         Path.Combine(
                             _optionsAccessor.Value.ShellsRootContainerName,
                             _optionsAccessor.Value.ShellsContainerName)))
            {
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("ShellSettings found in '{0}', attempting to load.", tenant.Name);
                }
                var configurationContainer =
                    new ConfigurationBuilder()
                    .SetBasePath(tenant.PhysicalPath)
                    .AddJsonFile(string.Format(SettingsFileNameFormat, "json"),
                                 true)
                    .AddXmlFile(string.Format(SettingsFileNameFormat, "xml"),
                                true)
                    .AddYamlFile(string.Format(SettingsFileNameFormat, "txt"),
                                 false);

                var config       = configurationContainer.Build();
                var shellSetting = ShellSettingsSerializer.ParseSettings(config);
                shellSettings.Add(shellSetting);

                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("Loaded ShellSettings for tenant '{0}'", shellSetting.Name);
                }
            }

            return(shellSettings);
        }