public object GetPartOfRecord(FakeInput kind, object fakeInputParameter) { if (kind == FakeInput.NONE || _playStorage == null || !_playStorage.ContainsKey(kind) || !_playStorage[kind].ContainsKey(fakeInputParameter)) { throw new Exception("Play Storage is unload."); } try { if (AtfInitializer.Instance.isDebugPrintOn) { print($"Action to deliver remain: {_playStorage[kind][fakeInputParameter].Count}"); } if (recorder.IsPlaying() && !recorder.IsPlayPaused()) { return(_playStorage[kind][fakeInputParameter].Dequeue().Content); } return(_playStorage[kind][fakeInputParameter].Peek().Content); } catch (Exception e) { if (AtfInitializer.Instance.isDebugPrintOn) { print($"Clearing play cache: {e}"); } recorder.StopPlay(); ClearPlayStorage(); } throw new Exception("Play Storage is unload or empty."); }
private static object RealOrFakeInputOrRecord(object realInput, object fakeInputParameter, FakeInput kind) { if (RECORDER.IsPlaying()) { if (RECORDER.IsInputStopped()) { print("Input now cannot be stopped. Please uncheck the option."); } if (!RECORDER.IsPlayPaused()) { try { realInput = GetCurrentFakeInput(kind, fakeInputParameter); } catch (Exception e) { if (AtfInitializer.Instance.isDebugPrintOn) { print(e); } } return(realInput); } else { return(realInput); } } else { if (RECORDER.IsRecording()) { if (RECORDER.IsInputStopped()) { realInput = RECORDER.GetLastInput(kind, fakeInputParameter); } if (!RECORDER.IsRecordingPaused()) { RECORDER.Record(kind, realInput, fakeInputParameter); } return(realInput); } else { if (RECORDER.IsInputStopped()) { return(RECORDER.GetLastInput(kind, fakeInputParameter)); } else { RECORDER.SetLastInput(kind, realInput, fakeInputParameter); return(realInput); } } } }