diff --git a/source/main.exe b/source/main.exe deleted file mode 100644 index 2a45014..0000000 Binary files a/source/main.exe and /dev/null differ diff --git a/source/main.py b/source/main.py index baaf3c6..fc10685 100644 --- a/source/main.py +++ b/source/main.py @@ -62,6 +62,13 @@ app_data = { "install_path": "NEKOPARA Vol. 4/vol4adult.xp3", "plugin_path": "vol.4/vol4adult.xp3", }, + "NEKOPARA After": { + "exe": "nekopara_after.exe", + "hash": "eb26ff6850096a240af8340ba21c5c3232e90f29fb8191e24b6ce701acae0aa9", + "install_path": "NEKOPARA After/afteradult.xp3", + "plugin_path": "after/afteradult.xp3", + "sig_path": "after/afteradult.xp3.sig" + }, }, } @@ -187,6 +194,7 @@ class AdminPrivileges: "nekopara_vol2.exe", "NEKOPARAvol3.exe", "nekopara_vol4.exe", + "nekopara_after.exe", ] def is_admin(self): @@ -221,7 +229,7 @@ class AdminPrivileges: f"权限检测 {APP_NAME}", "\n无法获取管理员权限,程序将退出\n", QMessageBox.StandardButton.Ok, - ) + ) msg_box.exec() sys.exit(1) @@ -331,6 +339,7 @@ class MainWindow(QMainWindow): # 初始化功能变量 self.selected_folder = "" self.installed_status = {f"NEKOPARA Vol.{i}": False for i in range(1, 5)} + self.installed_status["NEKOPARA After"] = False # 添加After的状态 self.download_queue = deque() self.current_download_thread = None self.hash_manager = HashManager(BLOCK_SIZE) @@ -388,10 +397,12 @@ class MainWindow(QMainWindow): response = requests.get(CONFIG_URL, headers=headers, timeout=10) response.raise_for_status() config_data = response.json() - if not all(f"vol.{i+1}.data" in config_data for i in range(4)): + if not all(f"vol.{i+1}.data" in config_data for i in range(4)) or "after.data" not in config_data: raise ValueError("配置文件数据异常") return { f"vol{i+1}": config_data[f"vol.{i+1}.data"]["url"] for i in range(4) + } | { + "after": config_data["after.data"]["url"] } except requests.exceptions.RequestException as e: status_code = e.response.status_code if e.response is not None else "未知" @@ -469,7 +480,18 @@ class MainWindow(QMainWindow): QApplication.processEvents() with py7zr.SevenZipFile(_7z_path, mode="r") as archive: archive.extractall(path=PLUGIN) + + # 创建游戏目录(如果不存在) + os.makedirs(game_folder, exist_ok=True) + + # 复制主文件 shutil.copy(plugin_path, game_folder) + + # 如果是After版本,还需要复制签名文件 + if game_version == "NEKOPARA After": + sig_path = os.path.join(PLUGIN, GAME_INFO[game_version]["sig_path"]) + shutil.copy(sig_path, game_folder) + self.installed_status[game_version] = True QMessageBox.information( self, f"通知 {APP_NAME}", f"\n{game_version} 补丁已安装\n" @@ -509,6 +531,7 @@ class MainWindow(QMainWindow): ) return + # 处理1-4卷 for i in range(1, 5): game_version = f"NEKOPARA Vol.{i}" if not self.installed_status[game_version]: @@ -521,6 +544,19 @@ class MainWindow(QMainWindow): self.download_queue.append( (url, game_folder, game_version, _7z_path, plugin_path) ) + + # 处理After + game_version = "NEKOPARA After" + if not self.installed_status[game_version]: + url = config["after"] + game_folder = os.path.join(self.selected_folder, "NEKOPARA After") + _7z_path = os.path.join(PLUGIN, "after.7z") + plugin_path = os.path.join( + PLUGIN, GAME_INFO[game_version]["plugin_path"] + ) + self.download_queue.append( + (url, game_folder, game_version, _7z_path, plugin_path) + ) self.next_download_task()