//protected override void OnSendData(OldPacket pkt, out byte[] toSend) //{ // //for debugging: sometimes the server is getting PACKET_INTERNAL from this client // //I'm not sure why and it happens randomly so this check will allow me to examine // // packet contents and the call stack to figure it out // if (pkt.Family == PacketFamily.Internal) // throw new ArgumentException("This is an invalid packet!"); // toSend = _packetProcessActions.EncodePacket(pkt); // //at this point, toSend should be 3 or 4 bytes longer than the original packet data // //this includes 2 bytes of len, 1 or 2 bytes of seq, and then packet payload // if (EventSendData != null) // { // DataTransferEventArgs dte = new DataTransferEventArgs(DataTransferEventArgs.TransferType.Send, pkt.Family, pkt.Action, pkt.Data); // EventSendData(dte); // } //} protected override void OnSendRawData(OldPacket pkt, out byte[] toSend) { if (EventSendData != null) { DataTransferEventArgs dte = new DataTransferEventArgs(DataTransferEventArgs.TransferType.SendRaw, pkt.Family, pkt.Action, pkt.Data); EventSendData(dte); } pkt.WritePos = 0; pkt.AddShort((short)pkt.Length); toSend = pkt.Get(); }
/// <summary> /// Does optional processing of raw packet data before sending it to the server /// </summary> protected virtual void OnSendRawData(OldPacket pkt, out byte[] toSend) { toSend = pkt.Get(); }