From 39c66558cfedfbb28b11c37cd43ef39adcbe1d26 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 10 Feb 2021 08:27:36 -0600 Subject: more docs --- .../DefaultValueConfigurationSource.cs | 31 +++------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'src/slskd/Common/Configuration/DefaultValueConfigurationSource.cs') diff --git a/src/slskd/Common/Configuration/DefaultValueConfigurationSource.cs b/src/slskd/Common/Configuration/DefaultValueConfigurationSource.cs index 5bbba10e..07e4f1b7 100644 --- a/src/slskd/Common/Configuration/DefaultValueConfigurationSource.cs +++ b/src/slskd/Common/Configuration/DefaultValueConfigurationSource.cs @@ -15,7 +15,6 @@ // along with this program. If not, see https://www.gnu.org/licenses/. // -#pragma warning disable SA1649 // File name should match first type name namespace slskd.Configuration { using System; @@ -24,7 +23,7 @@ namespace slskd.Configuration using Microsoft.Extensions.Configuration; /// - /// Defines an default value mapping. + /// Defines a default value mapping. /// public record DefaultValue(string Key, Type Type, object Default); @@ -38,11 +37,8 @@ namespace slskd.Configuration /// /// The to which to add. /// A list of default value mappings. - /// - /// A value indicating whether configuration keys should be normalized (_, - removed, changed to lowercase). - /// /// The updated . - public static IConfigurationBuilder AddDefaultValues(this IConfigurationBuilder builder, IEnumerable map, bool normalizeKey = true) + public static IConfigurationBuilder AddDefaultValues(this IConfigurationBuilder builder, IEnumerable map) { if (builder == null) { @@ -52,7 +48,6 @@ namespace slskd.Configuration return builder.AddDefaultValues(s => { s.Map = map ?? Enumerable.Empty(); - s.NormalizeKey = normalizeKey; }); } @@ -78,11 +73,9 @@ namespace slskd.Configuration public DefaultValueConfigurationProvider(DefaultValueConfigurationSource source) { Map = source.Map; - NormalizeKey = source.NormalizeKey; } private IEnumerable Map { get; set; } - private bool NormalizeKey { get; set; } /// /// Sets the keys specified in the map to the specified default values. @@ -93,17 +86,7 @@ namespace slskd.Configuration { var (key, _, value) = item; - if (NormalizeKey) - { - key = key?.Replace("_", string.Empty).Replace("-", string.Empty).ToLowerInvariant(); - } - - if (string.IsNullOrEmpty(key)) - { - continue; - } - - if (value == null) + if (string.IsNullOrEmpty(key) || value == null) { continue; } @@ -123,11 +106,6 @@ namespace slskd.Configuration /// public IEnumerable Map { get; set; } - /// - /// Gets or sets a value indicating whether configuration keys should be normalized (_, - removed, changed to lowercase). - /// - public bool NormalizeKey { get; set; } - /// /// Builds the for this source. /// @@ -138,5 +116,4 @@ namespace slskd.Configuration return new DefaultValueConfigurationProvider(this); } } -} -#pragma warning restore SA1649 // File name should match first type name \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3