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.
30 lines
709 B
30 lines
709 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Core
|
|
{
|
|
public class DuplicatePacket : IPacket
|
|
{
|
|
public byte[] Serialize()
|
|
{
|
|
byte[] packetType = BitConverter.GetBytes(IPAddress.HostToNetworkOrder((short)PacketType.Duplicate));
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|