mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 01:30:17 +08:00
Enhance printTLVMap
This commit is contained in:
parent
27f52e6b07
commit
6d2d6bec35
@ -186,9 +186,9 @@ fun Input.readFlatTUVarIntMap(expectingEOF: Boolean = false, tagSize: Int = 1):
|
||||
fun Map<Int, ByteArray>.printTLVMap(name: String = "", keyLength: Int = 2) =
|
||||
debugPrintln("TLVMap $name= " + this.mapValues { (_, value) -> value.toUHexString() }.mapKeys {
|
||||
when (keyLength) {
|
||||
1 -> it.key.toUByte().toUHexString()
|
||||
2 -> it.key.toUShort().toUHexString()
|
||||
4 -> it.key.toUInt().toUHexString()
|
||||
1 -> it.key.toUByte().contentToString()
|
||||
2 -> it.key.toUShort().contentToString()
|
||||
4 -> it.key.toUInt().contentToString()
|
||||
else -> illegalArgument("Expecting 1, 2 or 4 for keyLength")
|
||||
}
|
||||
}.entries.joinToString(prefix = "{", postfix = "}", separator = "\n"))
|
||||
|
Loading…
Reference in New Issue
Block a user