mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 04:50:26 +08:00
Fix loading deviceJson from JSON string on JVM; fix loading deviceJson from JSON string and file on native.
This commit is contained in:
parent
b5246d8a30
commit
06616bac35
mirai-core-api/src
@ -341,7 +341,7 @@ public actual open class BotConfiguration { // open for Java
|
||||
@ConfigurationDsl
|
||||
public actual fun loadDeviceInfoJson(json: String) {
|
||||
deviceInfo = {
|
||||
this.json.decodeFromString(DeviceInfo.serializer(), json)
|
||||
DeviceInfoManager.deserialize(json, this.json)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ public actual open class BotConfiguration { // open for Java
|
||||
@ConfigurationDsl
|
||||
public actual fun loadDeviceInfoJson(json: String) {
|
||||
deviceInfo = {
|
||||
Companion.json.decodeFromString(DeviceInfo.serializer(), json)
|
||||
DeviceInfoManager.deserialize(json, Companion.json)
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ public actual open class BotConfiguration { // open for Java
|
||||
public actual fun fileBasedDeviceInfo(filepath: String) {
|
||||
deviceInfo = {
|
||||
val file = MiraiFile.create(workingDir).resolve(filepath)
|
||||
Json.decodeFromString(DeviceInfo.serializer(), file.readText())
|
||||
DeviceInfoManager.deserialize(file.readText(), json)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user