diff --git a/build.gradle.kts b/build.gradle.kts index a9d1ab2..0020315 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "org.itxtech" -version = "1.7.0" +version = "1.8.0" kotlin { sourceSets { diff --git a/native/native.rc b/native/native.rc index 07035cc..ead5d55 100644 --- a/native/native.rc +++ b/native/native.rc @@ -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 @@ -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" diff --git a/src/main/kotlin/org/itxtech/mirainative/MiraiNative.kt b/src/main/kotlin/org/itxtech/mirainative/MiraiNative.kt index 0c1ec8b..42dd3e6 100644 --- a/src/main/kotlin/org/itxtech/mirainative/MiraiNative.kt +++ b/src/main/kotlin/org/itxtech/mirainative/MiraiNative.kt @@ -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() { @@ -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) @@ -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() diff --git a/src/main/resources/CQP.dll b/src/main/resources/CQP.dll index f101aae..ecafb8b 100644 Binary files a/src/main/resources/CQP.dll and b/src/main/resources/CQP.dll differ diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 903735a..bfbdf69 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: MiraiNative main: org.itxtech.mirainative.MiraiNative -version: 1.7.0 +version: 1.8.0 author: iTX Technologies info: 强大的 Mirai 原生插件加载器