/// <inheritdoc/> public int Write(IRconCommand command) { int id = 0; currentId++; id = currentId; _responses.TryAdd(id, new RconResponse(id)); var packet = RconPacket.From(id, command); var terminator = RconPacket.CommandTerminator(id); _writer.Write(packet.GetBytes()); _writer.Flush(); return(id); }
private void CheckForData() { while (!_stopEvent.WaitOne(1)) { try { if (!_rconStream.DataAvailable) { continue; } var packet = RconPacket.From(_reader); _responses[packet.CommandId].AddPacket(packet); } catch { continue; } } _stoppedEvent.Set(); }
internal void AddPacket(RconPacket packet) { _packets.Enqueue(packet); Complete = true; }