mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-01 12:00:34 +08:00
Small improvements
This commit is contained in:
parent
0ea95c33e6
commit
e1c4ff9cbd
@ -75,8 +75,6 @@ private fun Route.mirai(path: String, body: PipelineInterceptor<Unit, Applicatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
|
||||||
suspend inline fun ApplicationCall.ok() = this.respond(HttpStatusCode.OK, "OK")
|
suspend inline fun ApplicationCall.ok() = this.respond(HttpStatusCode.OK, "OK")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,12 +121,23 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets["commonTest"].apply {
|
||||||
|
dependencies {
|
||||||
|
kotlin("kotlin-test-annotations-common")
|
||||||
|
kotlin("kotlin-test-common")
|
||||||
|
}
|
||||||
|
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets["jvmTest"].apply {
|
sourceSets["jvmTest"].apply {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
kotlin("kotlin-test", kotlinVersion)
|
||||||
|
kotlin("kotlin-test-annotations-common", kotlinVersion)
|
||||||
|
kotlin("kotlin-test-junit5", kotlinVersion)
|
||||||
|
implementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
|
||||||
}
|
}
|
||||||
kotlin.outputDir = file("build/classes/kotlin/jvm/test")
|
kotlin.outputDir = file("build/classes/kotlin/jvm/test")
|
||||||
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
kotlin.setSrcDirs(listOf("src/$name/kotlin"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.all {
|
sourceSets.all {
|
||||||
|
@ -11,7 +11,6 @@ import kotlinx.serialization.DeserializationStrategy
|
|||||||
import kotlinx.serialization.protobuf.ProtoBuf
|
import kotlinx.serialization.protobuf.ProtoBuf
|
||||||
import net.mamoe.mirai.network.BotNetworkHandler
|
import net.mamoe.mirai.network.BotNetworkHandler
|
||||||
import net.mamoe.mirai.utils.io.ByteArrayPool
|
import net.mamoe.mirai.utils.io.ByteArrayPool
|
||||||
import net.mamoe.mirai.utils.io.debugPrint
|
|
||||||
import net.mamoe.mirai.utils.io.read
|
import net.mamoe.mirai.utils.io.read
|
||||||
import net.mamoe.mirai.utils.io.toUHexString
|
import net.mamoe.mirai.utils.io.toUHexString
|
||||||
import net.mamoe.mirai.utils.readProtoMap
|
import net.mamoe.mirai.utils.readProtoMap
|
||||||
@ -35,6 +34,8 @@ abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypter>(val d
|
|||||||
get() = (this::class.annotations.firstOrNull { it is AnnotatedId } as? AnnotatedId)
|
get() = (this::class.annotations.firstOrNull { it is AnnotatedId } as? AnnotatedId)
|
||||||
?: error("Annotation AnnotatedId not found for class ${this::class.simpleName}")
|
?: error("Annotation AnnotatedId not found for class ${this::class.simpleName}")
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: 2019/11/22 修改为参数
|
||||||
/**
|
/**
|
||||||
* 包 ID.
|
* 包 ID.
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,6 @@ import kotlinx.io.pool.ObjectPool
|
|||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.random.nextInt
|
import kotlin.random.nextInt
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 类型转换 Utils.
|
* 类型转换 Utils.
|
||||||
* 这些函数为内部函数, 可能会改变
|
* 这些函数为内部函数, 可能会改变
|
@ -0,0 +1,10 @@
|
|||||||
|
package net.mamoe.mirai.utils.io
|
||||||
|
|
||||||
|
|
||||||
|
class TypeConversionTest {
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
fun testConversions() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -70,21 +70,6 @@ suspend fun deserializeTest() {
|
|||||||
|
|
||||||
""".trimIndent().replace("\n", " ").replace("[", "").replace("]", "")
|
""".trimIndent().replace("\n", " ").replace("[", "").replace("]", "")
|
||||||
.hexToBytes()
|
.hexToBytes()
|
||||||
|
|
||||||
/*
|
|
||||||
00 00 00 07 00 00 00 52 08 01 12 03 98 01 02
|
|
||||||
10 02
|
|
||||||
22 [4E] 08 A0 89 F7 B6 03 10 A2 FF 8C F0 03 18 BB 92 94 BF 08 22 10 64 CF BB 65 00 13 8D B5 58 E2 45 1E EA 65 88 E1 28 04 30 02 38 20 40 FF 01 48 00 50 01 5A 05 32 36 39 33 33 60 00 68 00 70 00 78 00 80 01 97 04 88 01 ED 03 90 01 04 A0 01 01
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (i in 0..bytes.size) {
|
|
||||||
try {
|
|
||||||
println(bytes.copyOfRange(i, bytes.size).read { readProtoMap() })
|
|
||||||
} catch (e: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
println(bytes.read { readProtoMap() })
|
println(bytes.read { readProtoMap() })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user