private void vm_LineWanted(object sender, LineWantedEventArgs e) { if (wrapperState == VMWrapperState.RequestRestore) { entry = "restore"; } if (wrapperState == VMWrapperState.RunCommand) { entry = saveCommand; } if (wrapperState == VMWrapperState.RequestSave) { entry = "save"; } if (wrapperState == VMWrapperState.Completed) { entry = null; } needLine = false; e.Line = entry; }
void engine_LineWanted(object sender, LineWantedEventArgs e) { if (test.CurrentStep.CommandType != CommandType.LineWanted) { test.CurrentStep.Status = TestStatus.Failed; test.CurrentStep.Message = "Game requested unexpected line wanted."; engine.Stop(); } else { e.Line = test.CurrentStep.Command; } }
void engine_LineWanted(object sender, LineWantedEventArgs e) { lineReady.Reset(); if (WaitHandle.WaitAny(lineEvents) == 0) { e.Line = nextLine; } else { engine.Stop(); } }
private uint glk_select(uint[] args) { DeliverOutput(); if (glkWantLineInput) { string line; if (LineWanted == null) { line = ""; } else { LineWantedEventArgs e = new LineWantedEventArgs(); LineWanted(this, e); line = e.Line; } byte[] bytes = StringToLatin1(line); uint max = Math.Min(glkLineInputBufSize, (uint)bytes.Length); for (uint i = 0; i < max; i++) { image.WriteByte(glkLineInputBuffer + i, bytes[i]); } // return event GlkWriteReference( args[0], GlkConst.evtype_LineInput, 1, max, 0); glkWantLineInput = false; } else if (glkWantCharInput) { char ch; if (KeyWanted == null) { ch = '\0'; } else { KeyWantedEventArgs e = new KeyWantedEventArgs(); KeyWanted(this, e); ch = e.Char; } // return event GlkWriteReference( args[0], GlkConst.evtype_CharInput, 1, ch, 0); glkWantCharInput = false; } else { // no event GlkWriteReference( args[0], GlkConst.evtype_None, 0, 0, 0); } return(0); }
private void vm_LineWanted(object sender, LineWantedEventArgs e) { this.Invoke(new Action(RequestLine)); inputReadyEvent.WaitOne(); e.Line = inputLine; }
public void FyreLineWanted(object sender, LineWantedEventArgs e) { e.Line = GetInputLineAsync().Result; }