update:版本检测修复

This commit is contained in:
2025-07-05 12:10:14 +08:00
parent fc1a8d9c59
commit d98538d4ab

View File

@@ -120,6 +120,7 @@ class HashManager:
sha256_hash.update(byte_block) sha256_hash.update(byte_block)
return sha256_hash.hexdigest() return sha256_hash.hexdigest()
# 使用多线程优化哈希值计算
def calculate_hashes_in_parallel(self, file_paths): def calculate_hashes_in_parallel(self, file_paths):
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
future_to_file = { future_to_file = {
@@ -435,7 +436,7 @@ class MainWindow(QMainWindow):
) )
for game, info in GAME_INFO.items() for game, info in GAME_INFO.items()
} }
# 判断游戏是否存在,不存在则跳过
if ( if (
game_version not in game_exe game_version not in game_exe
or not os.path.exists(game_exe[game_version]) or not os.path.exists(game_exe[game_version])
@@ -480,14 +481,8 @@ class MainWindow(QMainWindow):
QApplication.processEvents() QApplication.processEvents()
with py7zr.SevenZipFile(_7z_path, mode="r") as archive: with py7zr.SevenZipFile(_7z_path, mode="r") as archive:
archive.extractall(path=PLUGIN) archive.extractall(path=PLUGIN)
# 创建游戏目录(如果不存在)
os.makedirs(game_folder, exist_ok=True) os.makedirs(game_folder, exist_ok=True)
# 复制主文件
shutil.copy(plugin_path, game_folder) shutil.copy(plugin_path, game_folder)
# 如果是After版本还需要复制签名文件
if game_version == "NEKOPARA After": if game_version == "NEKOPARA After":
sig_path = os.path.join(PLUGIN, GAME_INFO[game_version]["sig_path"]) sig_path = os.path.join(PLUGIN, GAME_INFO[game_version]["sig_path"])
shutil.copy(sig_path, game_folder) shutil.copy(sig_path, game_folder)