Browse Source

Expose a helper to toggle config watchers

master
Meivyn 6 months ago
parent
commit
ab1e432192
No known key found for this signature in database GPG Key ID: 8BDD3E48158B2F71
2 changed files with 18 additions and 0 deletions
  1. +5
    -0
      IPA.Loader/Config/ConfigRuntime.cs
  2. +13
    -0
      IPA.Loader/Config/ConfigWatchersHelper.cs

+ 5
- 0
IPA.Loader/Config/ConfigRuntime.cs View File

@ -145,6 +145,11 @@ namespace IPA.Config
watcher.EnableRaisingEvents = true;
}
internal static FileSystemWatcher[] GetWatchers()
{
return watcherTrackConfigs.Keys.ToArray();
}
private static void EnsureWritesSane(Config config)
{
// compare exchange loop to be sane


+ 13
- 0
IPA.Loader/Config/ConfigWatchersHelper.cs View File

@ -0,0 +1,13 @@
namespace IPA.Config
{
public static class ConfigWatchersHelper
{
public static void ToggleWatchers()
{
foreach (var watcher in ConfigRuntime.GetWatchers())
{
watcher.EnableRaisingEvents = !watcher.EnableRaisingEvents;
}
}
}
}

Loading…
Cancel
Save