Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
        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);
            }
        }
Example #4
0
 private static void WriteGameCode(PacketSerializationContext context, in GameCode gameCode)
Example #5
0
 private static void WriteHeader(PacketSerializationContext context, RecordedPacketType type)
 {
     // Length placeholder.
     context.Writer.Write((int)0);
     context.Writer.Write((byte)type);
 }