private static void WritePacket(PacketSerializationContext context, IMessageReader reader, MessageType messageType) { context.Writer.Write((byte)messageType); context.Writer.Write((byte)reader.Tag); context.Writer.Write((int)reader.Length); context.Writer.Write(reader.Buffer, reader.Offset, reader.Length); }
private void WritePacketHeader(PacketSerializationContext context, RecordedPacketType type) { // Length placeholder. context.Writer.Write(0); // Timestamp relative to recording start time. context.Writer.Write((uint)(DateTimeOffset.UtcNow - _startTime).TotalMilliseconds); context.Writer.Write((byte)type); }
private static void WriteClient(PacketSerializationContext context, ClientBase client, bool full) { var address = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345); var addressBytes = address.Address.GetAddressBytes(); context.Writer.Write(client.Id); if (full) { context.Writer.Write((byte)addressBytes.Length); context.Writer.Write(addressBytes); context.Writer.Write((ushort)address.Port); context.Writer.Write(client.Name); } }
private static void WriteGameCode(PacketSerializationContext context, in GameCode gameCode)
private static void WriteHeader(PacketSerializationContext context, RecordedPacketType type) { // Length placeholder. context.Writer.Write((int)0); context.Writer.Write((byte)type); }