update:支持after安装
This commit is contained in:
BIN
source/main.exe
BIN
source/main.exe
Binary file not shown.
@@ -62,6 +62,13 @@ app_data = {
|
|||||||
"install_path": "NEKOPARA Vol. 4/vol4adult.xp3",
|
"install_path": "NEKOPARA Vol. 4/vol4adult.xp3",
|
||||||
"plugin_path": "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",
|
"nekopara_vol2.exe",
|
||||||
"NEKOPARAvol3.exe",
|
"NEKOPARAvol3.exe",
|
||||||
"nekopara_vol4.exe",
|
"nekopara_vol4.exe",
|
||||||
|
"nekopara_after.exe",
|
||||||
]
|
]
|
||||||
|
|
||||||
def is_admin(self):
|
def is_admin(self):
|
||||||
@@ -221,7 +229,7 @@ class AdminPrivileges:
|
|||||||
f"权限检测 {APP_NAME}",
|
f"权限检测 {APP_NAME}",
|
||||||
"\n无法获取管理员权限,程序将退出\n",
|
"\n无法获取管理员权限,程序将退出\n",
|
||||||
QMessageBox.StandardButton.Ok,
|
QMessageBox.StandardButton.Ok,
|
||||||
)
|
)
|
||||||
msg_box.exec()
|
msg_box.exec()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -331,6 +339,7 @@ class MainWindow(QMainWindow):
|
|||||||
# 初始化功能变量
|
# 初始化功能变量
|
||||||
self.selected_folder = ""
|
self.selected_folder = ""
|
||||||
self.installed_status = {f"NEKOPARA Vol.{i}": False for i in range(1, 5)}
|
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.download_queue = deque()
|
||||||
self.current_download_thread = None
|
self.current_download_thread = None
|
||||||
self.hash_manager = HashManager(BLOCK_SIZE)
|
self.hash_manager = HashManager(BLOCK_SIZE)
|
||||||
@@ -388,10 +397,12 @@ class MainWindow(QMainWindow):
|
|||||||
response = requests.get(CONFIG_URL, headers=headers, timeout=10)
|
response = requests.get(CONFIG_URL, headers=headers, timeout=10)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
config_data = response.json()
|
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("配置文件数据异常")
|
raise ValueError("配置文件数据异常")
|
||||||
return {
|
return {
|
||||||
f"vol{i+1}": config_data[f"vol.{i+1}.data"]["url"] for i in range(4)
|
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:
|
except requests.exceptions.RequestException as e:
|
||||||
status_code = e.response.status_code if e.response is not None else "未知"
|
status_code = e.response.status_code if e.response is not None else "未知"
|
||||||
@@ -469,7 +480,18 @@ 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)
|
||||||
|
|
||||||
|
# 复制主文件
|
||||||
shutil.copy(plugin_path, game_folder)
|
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
|
self.installed_status[game_version] = True
|
||||||
QMessageBox.information(
|
QMessageBox.information(
|
||||||
self, f"通知 {APP_NAME}", f"\n{game_version} 补丁已安装\n"
|
self, f"通知 {APP_NAME}", f"\n{game_version} 补丁已安装\n"
|
||||||
@@ -509,6 +531,7 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# 处理1-4卷
|
||||||
for i in range(1, 5):
|
for i in range(1, 5):
|
||||||
game_version = f"NEKOPARA Vol.{i}"
|
game_version = f"NEKOPARA Vol.{i}"
|
||||||
if not self.installed_status[game_version]:
|
if not self.installed_status[game_version]:
|
||||||
@@ -521,6 +544,19 @@ class MainWindow(QMainWindow):
|
|||||||
self.download_queue.append(
|
self.download_queue.append(
|
||||||
(url, game_folder, game_version, _7z_path, plugin_path)
|
(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()
|
self.next_download_task()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user