public void WrapSendPacket(short packet_id, IProtoSerializer packet) { lock (mutex) { SerializeHelper.WriteByte(buffer, SocketBuffer.PackageBreaker, ref offset); SerializeHelper.WriteShort(buffer, packet_id, ref offset); SerializeHelper.WriteByte(buffer, 0, ref offset); SerializeHelper.WriteInt(buffer, packet.Length(), ref offset); packet.Serialize(buffer, ref offset); SerializeHelper.WriteUInt32(buffer, 0, ref offset); SerializeHelper.WriteByte(buffer, SocketBuffer.PackageBreaker, ref offset); } }