You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|