mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Sync value on config reload
This commit is contained in:
1 parent
cb3301dd8e
commit
767f7291ee
2 files changed
+9
-5
No files matched your search
@@ -152,6 +152,11 @@ namespace BepInEx.Configuration
|
||||
return value;
|
||||
}
|
||||
|
||||
public void SyncFromConfig()
|
||||
{
|
||||
BoxedValue = ConfigFile.ConfigurationProvider.GetValue(Definition.ConfigPath, SettingType) ?? DefaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger setting changed event.
|
||||
/// </summary>
|
||||
|
||||
@@ -239,9 +239,10 @@ namespace BepInEx.Configuration
|
||||
lock (_ioLock)
|
||||
{
|
||||
ConfigurationProvider.Load();
|
||||
|
||||
foreach (var kv in Entries)
|
||||
kv.Value.SyncFromConfig();
|
||||
}
|
||||
|
||||
// TODO: Implement configuration document to document entry parsing
|
||||
|
||||
OnConfigReloaded();
|
||||
}
|
||||
@@ -326,9 +327,7 @@ namespace BepInEx.Configuration
|
||||
|
||||
var entry = new ConfigEntry<T>(this, configDefinition, defaultValue, configDescription);
|
||||
Entries[configDefinition] = entry;
|
||||
|
||||
entry.BoxedValue = ConfigurationProvider.GetValue(configDefinition.ConfigPath, typeof(T)) ?? defaultValue;
|
||||
|
||||
entry.SyncFromConfig();
|
||||
if (SaveOnConfigSet)
|
||||
Save();
|
||||
|
||||
|
||||
Reference in new issue
Block a user