Skip to content

Commit

Permalink
Add utility: DataFileDiskAutoReloader.StartWatching
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyCushnie committed Oct 29, 2024
1 parent 3a2d472 commit 93a2584
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions JECS/DataFiles/DataFileDiskAutoReloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ public void Dispose()
AutoReloadTimer.Stop();
AutoReloadTimer.Dispose();
}

OnAutoReload = null;
}


public static DataFileDiskAutoReloader StartWatching(IDataFileOnDisk file, Action onAutoReload = null)
{
var reloader = new DataFileDiskAutoReloader(file);
reloader.StartWatchingForDiskChanges();

if (onAutoReload != null)
reloader.OnAutoReload += onAutoReload;

return reloader;
}
}
}

0 comments on commit 93a2584

Please sign in to comment.