31 lines
721 B
C#
31 lines
721 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Core
|
|
{
|
|
public class RoomListRequestPacket : IPacket
|
|
{
|
|
public byte[] Serialize()
|
|
{
|
|
byte[] packetType = BitConverter.GetBytes(IPAddress.HostToNetworkOrder((short)PacketType.RoomListRequest));
|
|
|
|
short dataSize = (short)(packetType.Length);
|
|
byte[] header = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(dataSize));
|
|
|
|
byte[] buffer = new byte[2 + dataSize];
|
|
|
|
int cursor = 0;
|
|
Array.Copy(header, 0, buffer, cursor, header.Length);
|
|
cursor += header.Length;
|
|
|
|
Array.Copy(packetType, 0, buffer, cursor, packetType.Length);
|
|
|
|
return buffer;
|
|
}
|
|
}
|
|
}
|