feat: 全局配置不存在时会优先使用当前配置的字段,并赋值给全局配置

This commit is contained in:
uye
2023-07-21 08:54:24 +08:00
parent c88b8610c4
commit bb17d4a0b1

View File

@@ -65,6 +65,14 @@ namespace MaaWpfGui.Helper
_logger.Debug("Read global configuration key {Key} with default value {DefaultValue}, configuration hit: {HasValue}, configuration value {Value}", key, defaultValue, hasValue, value);
if (!hasValue)
{
hasValue = _kvs.TryGetValue(key, out value);
if (hasValue)
{
_logger.Debug("Read global configuration key {Key} with current configuration value {Value}, configuration hit: {HasValue}, configuration value {Value}", key, value, hasValue, value);
SetGlobalValue(key, value);
return value;
}
SetGlobalValue(key, defaultValue);
return defaultValue;
}