/// <summary> /// Occurs when data is received from the engine controller after sending this command. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EngineController_DataReceived(object sender, ChessCommandReceivedEventArgs e) { var data = e.Data; if (ResponseIsNotNullOrEmpty(data)) { if (data.StartsWith(ID)) { ParseIdName(data); ParseIdAuthor(data); } else if (data.StartsWith(OPTION)) { ParseOption(data); } else if (data.StartsWith(UCIOK)) { CommandResponseReceived = true; } else if (data.StartsWith("copyprotection")) { CopyProtectionInfo = data; } else if (data.StartsWith("registration")) { RegistrationInfo = GetRegistrationStatus(data); } } }
/// <summary> /// Occurs when an error is received from the engine controller after sending this command. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EngineController_ErrorReceived(object sender, ChessCommandReceivedEventArgs e) { Logger.LogError($"ErrorReceived: {e.Data}."); if (ResponseIsNotNullOrEmpty(e.Data)) { CommandResponseReceived = true; ErrorText = e.Data; } }
private void ChessEngineController_DataReceived(object sender, ChessCommandReceivedEventArgs e) { var data = e.Data; if (ResponseIsNotNullOrEmpty(data)) { if (data.StartsWith("bestmove")) { BestMove = data; CommandResponseReceived = true; return; } InfoResponse.AppendLine(data); } }