mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:12:37 +08:00
prep for graphical wrapper
This commit is contained in:
parent
4d304ba1ac
commit
412dc0ac13
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
package net.mamoe.mirai.console.graphical
|
||||
|
||||
import net.mamoe.mirai.console.pure.MiraiConsoleUIPure
|
||||
|
||||
import net.mamoe.mirai.console.MiraiConsole
|
||||
import tornadofx.launch
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class MiraiConsoleGraphicalLoader {
|
||||
companion object {
|
||||
internal lateinit var coreVersion :String
|
||||
internal lateinit var consoleVersion: String
|
||||
@JvmStatic
|
||||
fun load(
|
||||
coreVersion: String,
|
||||
consoleVersion: String
|
||||
) {
|
||||
this.coreVersion = coreVersion
|
||||
this.consoleVersion = consoleVersion
|
||||
Runtime.getRuntime().addShutdownHook(thread(start = false) {
|
||||
MiraiConsole.stop()
|
||||
})
|
||||
launch<MiraiGraphicalUI>()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -27,8 +27,7 @@ class MiraiGraphicalUI : App(Decorator::class, PrimaryStyleSheet::class) {
|
||||
|
||||
override fun init() {
|
||||
super.init()
|
||||
|
||||
MiraiConsole.start(find<MiraiGraphicalUIController>())
|
||||
MiraiConsole.start(find<MiraiGraphicalUIController>(),MiraiConsoleGraphicalLoader.coreVersion,MiraiConsoleGraphicalLoader.consoleVersion)
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
|
Loading…
Reference in New Issue
Block a user