mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-10 12:10:10 +08:00
Add size return to verify packet length
This commit is contained in:
parent
6b93ce3ccc
commit
82f1fda69c
@ -38,9 +38,10 @@ fun BytePacketBuilder.writeShortLVByteArrayLimitedLength(array: ByteArray, maxLe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BytePacketBuilder.writeShortLVByteArray(byteArray: ByteArray) {
|
fun BytePacketBuilder.writeShortLVByteArray(byteArray: ByteArray): Int {
|
||||||
this.writeShort(byteArray.size.toShort())
|
this.writeShort(byteArray.size.toShort())
|
||||||
this.writeFully(byteArray)
|
this.writeFully(byteArray)
|
||||||
|
return byteArray.size
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BytePacketBuilder.writeShortLVPacket(tag: UByte? = null, lengthOffset: ((Long) -> Long)? = null, builder: BytePacketBuilder.() -> Unit): Int =
|
fun BytePacketBuilder.writeShortLVPacket(tag: UByte? = null, lengthOffset: ((Long) -> Long)? = null, builder: BytePacketBuilder.() -> Unit): Int =
|
||||||
|
Loading…
Reference in New Issue
Block a user