/// <summary> /// Called when the server receives a valid packet, before it's processed. /// </summary> /// <param name="pSocket">The servers socket which received the packet.</param> /// <param name="PacketID">The packet ID (first byte of Data)</param> /// <param name="PacketSize">Size of the packet</param> /// <param name="IsPacketDynamicSized">True if this is a dynamic length packet</param> unsafe static void OnPacketReceived(byte *pSocket, byte PacketID, uint PacketSize, int IsPacketDynamicSized) { if (MyServerConfig.PacketDebug) { Console.WriteLine("Packet obj: ID:{0:X2} Size:{1} Dyn:{2}", PacketID, PacketSize, IsPacketDynamicSized); } using (Network.ClientPacketSafe packet = Network.ClientPacket.Instantiate(pSocket, PacketID, PacketSize, IsPacketDynamicSized != 0 ? true : false)) { if (packet != null && !packet.OnReceived()) { packet.Remove(); } } }
public override void VerifyTransform(Sharpkick.Network.ClientPacketSafe resultPacket) { Packet00_CreateChar packet = resultPacket as Packet00_CreateChar; if (packet == null) { throw new VerificationException("Expected Packet00_CreateChar. Unexpected underlying packet type: {0}", resultPacket.GetType()); } for (uint i = 0; i < expectedLen; i++) { if (packet[i] != PacketData[i]) { throw new VerificationException("Data verification failed at index {0}", i); } } }