Skip to content

Commit

Permalink
MiraiNative: release 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Aug 5, 2020
1 parent 5897cdd commit 14723a6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "org.itxtech"
version = "1.7.0"
version = "1.8.0"

kotlin {
sourceSets {
Expand Down
8 changes: 4 additions & 4 deletions native/native.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,0,9
PRODUCTVERSION 1,7,0,9
FILEVERSION 1,8,0,10
PRODUCTVERSION 1,8,0,10
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "iTX Technologies"
VALUE "FileDescription", "Mirai Native Bridge"
VALUE "FileVersion", "1.7.0.9"
VALUE "FileVersion", "1.8.0.10"
VALUE "InternalName", "CQP.dll"
VALUE "LegalCopyright", "Copyright (C) 2020 iTX Technologies"
VALUE "OriginalFilename", "CQP.dll"
VALUE "ProductName", "Mirai Native Bridge"
VALUE "ProductVersion", "1.7.0.9"
VALUE "ProductVersion", "1.8.0.10"
END
END
BLOCK "VarFileInfo"
Expand Down
9 changes: 9 additions & 0 deletions src/main/kotlin/org/itxtech/mirainative/MiraiNative.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import org.itxtech.mirainative.ui.Tray
import org.itxtech.mirainative.util.ConfigMan
import java.io.File
import java.io.FileOutputStream
import java.math.BigInteger
import java.security.MessageDigest
import java.util.jar.Manifest

object MiraiNative : PluginBase() {
Expand All @@ -50,6 +52,8 @@ object MiraiNative : PluginBase() {
var botOnline = false
val bot: Bot by lazy { Bot.botInstances.first() }

fun ByteArray.checksum() = BigInteger(1, MessageDigest.getInstance("MD5").digest(this))

private fun checkNativeLibs() {
logger.info("正在加载 ${dll.absolutePath}")
LibraryManager.load(dll.absolutePath)
Expand All @@ -75,6 +79,11 @@ object MiraiNative : PluginBase() {
val cqp = FileOutputStream(dll)
getResources("CQP.dll")?.copyTo(cqp)
cqp.close()
} else {
if (getResources("CQP.dll")!!.readBytes().checksum() != dll.readBytes().checksum()) {
logger.warning("${dll.absolutePath} 与 Mirai Native 内置的 CQP.dll 的校验和不同。")
logger.warning("如运行时出现问题,请尝试删除 ${dll.absolutePath} 并重启 Mirai。")
}
}

initDataDir()
Expand Down
Binary file modified src/main/resources/CQP.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MiraiNative
main: org.itxtech.mirainative.MiraiNative
version: 1.7.0
version: 1.8.0
author: iTX Technologies
info: 强大的 Mirai 原生插件加载器

0 comments on commit 14723a6

Please sign in to comment.