mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-12 18:50:20 +08:00
update
This commit is contained in:
parent
c110c2331a
commit
20a322a0a0
@ -19,13 +19,12 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
|
|||||||
|
|
||||||
stream.skipUntil(10)
|
stream.skipUntil(10)
|
||||||
val idBytes = stream.readUntil(11)
|
val idBytes = stream.readUntil(11)
|
||||||
val id = idBytes.map { it.toString(16) }.joinToString("")
|
|
||||||
|
|
||||||
return when (id) {
|
return when (idBytes.joinToString("") { it.toString(16) }) {
|
||||||
"08 25 31 01" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_01, stream);
|
"08 25 31 01" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_01, stream)
|
||||||
"08 25 31 02" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_02, stream);
|
"08 25 31 02" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_02, stream)
|
||||||
|
|
||||||
else -> throw UnsupportedOperationException();
|
else -> throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,9 +46,9 @@ fun DataInputStream.readUntil(byte: Byte): ByteArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun DataInputStream.readIP(): String {
|
fun DataInputStream.readIP(): String {
|
||||||
var buff = "";
|
var buff = ""
|
||||||
for (i in 0..12) {//todo: check that
|
for (i in 0..12) {//todo: check that
|
||||||
buff += readByte().toInt();
|
buff += readByte().toInt()
|
||||||
}
|
}
|
||||||
return buff;
|
return buff
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user