public void StartAndStopAreNotReentrant() { using var gpw = new GameProcessWatcher(_gif, new NativeMethodsMock()); bool IsRunning() => gpw.GetPrivateField <bool>("_running"); Assert.False(IsRunning()); gpw.Start(); Assert.True(IsRunning()); gpw.Start(); Assert.True(IsRunning()); gpw.Stop(); Assert.False(IsRunning()); gpw.Stop(); Assert.False(IsRunning()); }
public void Start() { if (_running) { return; } _running = true; _graphicsConfig.Start(); _bindingsWatcher.Start(); _statusWatcher.Start(); _modifierKeysWatcher.Start(); _journalWatcher.Start(); if (DetectForegroundProcess) { _gameProcessWatcher.Start(); } }