Kotz's editorconfig styles slightly modified. Target typed new usage. Brackets in expressions used for clarity.

This commit is contained in:
Kwoth
2021-12-26 02:52:09 +01:00
parent 68741ec484
commit d18f9429c6
172 changed files with 921 additions and 494 deletions

View File

@@ -11,7 +11,7 @@ public sealed class BotConfigService : ConfigServiceBase<BotConfig>
public override string Name { get; } = "bot";
private const string FilePath = "data/bot.yml";
private static TypedKey<BotConfig> changeKey = new TypedKey<BotConfig>("config.bot.updated");
private static readonly TypedKey<BotConfig> changeKey = new("config.bot.updated");
public BotConfigService(IConfigSeria serializer, IPubSub pubSub)
: base(FilePath, serializer, pubSub, changeKey)

View File

@@ -41,5 +41,5 @@ public static class ConfigPrinters
=> culture.Name;
public static string Color(Rgba32 color)
=> ((uint) (color.B << 0 | color.G << 8 | color.R << 16)).ToString("X6");
=> ((uint) ((color.B << 0) | (color.G << 8) | (color.R << 16))).ToString("X6");
}

View File

@@ -95,10 +95,10 @@ public abstract class ConfigServiceBase<TSettings> : IConfigService
File.WriteAllText(_filePath, strData);
}
private readonly Dictionary<string, Func<TSettings, string, bool>> _propSetters = new Dictionary<string, Func<TSettings, string, bool>>();
private readonly Dictionary<string, Func<object>> _propSelectors = new Dictionary<string, Func<object>>();
private readonly Dictionary<string, Func<object, string>> _propPrinters = new Dictionary<string, Func<object, string>>();
private readonly Dictionary<string, string> _propComments = new Dictionary<string, string>();
private readonly Dictionary<string, Func<TSettings, string, bool>> _propSetters = new();
private readonly Dictionary<string, Func<object>> _propSelectors = new();
private readonly Dictionary<string, Func<object, string>> _propPrinters = new();
private readonly Dictionary<string, string> _propComments = new();
protected void AddParsedProp<TProp>(
string key,