public static ToffeeInternalPacket Create <T>(ToffeeParticipant sender, ushort opCode, T o) { ToffeeInternalPacket packet = new ToffeeInternalPacket(sender, opCode); packet.WriteStruct(o); return(packet); }
/// <summary> /// Builds a packet, and sends it to the server. /// </summary> /// <param name="opCode">The OpCode of the packet to build.</param> /// <param name="o">The packet data.</param> public void Send <T>(ushort opCode, T o) { Send(ToffeeInternalPacket.Create(this, opCode, o).BuildPacket()); }
/// <summary> /// Sends a packet to the server. /// </summary> /// <param name="packet">The data to send.</param> public void Send(ToffeeInternalPacket packet) { Send(packet.BuildPacket()); }