private void StartDummyLoop() { lock (RunDummyThreadLock) { _runDummyThread = true; } Thread dummyThread = new Thread(() => { LogManager.Instance.WriteLine("dummyThread start"); NameWakeupData currentDummy = null; bool localRunDummyThread = true; while (localRunDummyThread && !this._process.HasExited) { try { var dummy = GetDummy(); if (!Equals(dummy, currentDummy)) { currentDummy = dummy; DummyChanged?.Invoke(dummy); } } catch (Exception ex) { LogManager.Instance.WriteException(ex); StopDummyLoop(); DummyLoopErrorOccured?.Invoke(ex); return; } lock (RunDummyThreadLock) { localRunDummyThread = _runDummyThread; } Thread.Sleep(2000); } LogManager.Instance.WriteLine("dummyThread ended"); }) { Name = "dummyThread" }; dummyThread.Start(); }
private int GetWakeupTiming(NameWakeupData currentDummy) { var animationString = ReadAnimationString(2); if (animationString == FaceDownAnimation) { return(currentDummy.FaceDownFrames); } if (animationString == FaceUpAnimation) { return(currentDummy.FaceUpFrames); } if (animationString == WallSplatAnimation) { //wakeup timing is universal on wall splat recovery return(WallSplatWakeupTiming); } return(0); }