Exemplo n.º 1
0
        // Token: 0x060017F7 RID: 6135 RVA: 0x000631C8 File Offset: 0x000613C8
        public static byte[] Serialize(PingPacket packetInfo)
        {
            byte[] array = new byte[40];
            array[0] = packetInfo.Type;
            array[1] = packetInfo.SubCode;
            int num = 2;

            byte[] bytes = BitConverter.GetBytes(packetInfo.CheckSum);
            Array.Copy(bytes, 0, array, num, bytes.Length);
            num  += bytes.Length;
            bytes = BitConverter.GetBytes(packetInfo.Identifier);
            Array.Copy(bytes, 0, array, num, bytes.Length);
            num  += bytes.Length;
            bytes = BitConverter.GetBytes(packetInfo.SequenceNumber);
            Array.Copy(bytes, 0, array, num, bytes.Length);
            num += bytes.Length;
            Array.Copy(packetInfo.Data, 0, array, num, packetInfo.Data.Length);
            num += packetInfo.Data.Length;
            return(array);
        }
Exemplo n.º 2
0
        // Token: 0x060017F6 RID: 6134 RVA: 0x00063138 File Offset: 0x00061338
        public static byte[] FormPacket()
        {
            PingPacket pingPacket = new PingPacket();

            pingPacket.Type           = 8;
            pingPacket.SubCode        = 0;
            pingPacket.CheckSum       = 0;
            pingPacket.Identifier     = 45;
            pingPacket.SequenceNumber = 0;
            for (int i = 0; i < 32; i++)
            {
                pingPacket.Data[i] = 35;
            }
            byte[]   value = PingPacket.Serialize(pingPacket);
            ushort[] array = new ushort[20];
            for (int j = 0; j < 20; j++)
            {
                array[j] = BitConverter.ToUInt16(value, j * 2);
            }
            pingPacket.CheckSum = PingPacket.Checksum(array, 20);
            return(PingPacket.Serialize(pingPacket));
        }