Fix contentToString

This commit is contained in:
Him188 2020-01-20 00:17:45 +08:00
parent 4dc6c3bfba
commit db3a1fb2d1
4 changed files with 4 additions and 8 deletions

View File

@ -27,10 +27,6 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>() {
this._id = PacketId(commandId = 0x0810, commandName = "wtlogin.login")
}
fun hahahaha() {
}
object SubCommand9 {
private const val appId = 16L
private const val subAppId = 537062845L
@ -61,8 +57,6 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>() {
LoginType.PASSWORD
)
hahahaha()
/* // from GetStWithPasswd
int mMiscBitmap = this.mMiscBitmap;
if (t.uinDeviceToken) {
@ -199,6 +193,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>() {
println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })
tlvMap[0x150]?.let { client.analysisTlv150(it) }
tlvMap[0x305]?.let { println("TLV 0x305=${it.toUHexString()}") }
tlvMap[0x161]?.let { client.analysisTlv161(it) }
tlvMap[0x119]?.let { t119Data ->
t119Data.decryptBy(client.tgtgtKey).toReadPacket().debugPrint("0x119data").apply {

View File

@ -5,7 +5,7 @@ import kotlin.reflect.full.allSuperclasses
actual fun Any.contentToStringReflectively(prefix: String): String {
val newPrefix = prefix + ProtoMap.indent
val newPrefix = prefix
return (this::class.simpleName ?: "<UnnamedClass>") + "#" + this::class.hashCode() + " {\n" +
this.allFieldsFromSuperClassesMatching { it.name.startsWith("net.mamoe.mirai") }
.distinctBy { it.name }

View File

@ -163,7 +163,7 @@ fun Any?.contentToString(prefix: String = ""): String = when (this) {
is Iterable<*> -> this.joinToString(prefix = "[", postfix = "]") { it.contentToString() }
is Iterator<*> -> this.asSequence().joinToString(prefix = "[", postfix = "]") { it.contentToString() }
is Sequence<*> -> this.joinToString(prefix = "[", postfix = "]") { it.contentToString() }
is Map<*, *> -> this.entries.joinToString(prefix = "{", postfix = "}") { it.key.contentToString() + "=" + it.value.contentToString() }
is Map<*, *> -> this.entries.joinToString(prefix = "{", postfix = "}") { it.key.contentToString(prefix) + "=" + it.value.contentToString(prefix) }
else -> {
if (this == null) "null"
else if (this::class.isData) this.toString()

View File

@ -12,6 +12,7 @@ actual fun Any.contentToStringReflectively(prefix: String): String {
this.allFieldsFromSuperClassesMatching { it.name.startsWith("net.mamoe.mirai") }
.distinctBy { it.name }
.filterNot { it.name.contains("$") || it.name == "Companion" || it.isSynthetic || it.name == "serialVersionUID" }
.filterNot { it.isEnumConstant }
.joinToStringPrefixed(
prefix = newPrefix
) {