Skip to content

Commit

Permalink
Expose a helper to toggle config watchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Meivyn committed Jun 1, 2024
1 parent 2236b34 commit ab1e432
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions IPA.Loader/Config/ConfigRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ private static void AddConfigToWatchers(Config config)
watcher.EnableRaisingEvents = true;
}

internal static FileSystemWatcher[] GetWatchers()
{
return watcherTrackConfigs.Keys.ToArray();
}

private static void EnsureWritesSane(Config config)
{
// compare exchange loop to be sane
Expand Down
13 changes: 13 additions & 0 deletions IPA.Loader/Config/ConfigWatchersHelper.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}

0 comments on commit ab1e432

Please sign in to comment.