feat(core): 增强离线模式支持和版本管理

- 在主窗口中添加离线模式管理器,支持自动切换到离线模式。
- 更新下载管理器以处理离线模式下的下载逻辑,确保用户体验流畅。
- 添加版本警告机制,提示用户在版本过低时的操作选项。
- 优化配置管理器,确保在离线模式下仍可使用相关功能。
- 更新UI管理器以反映当前工作模式,提升用户界面友好性。
This commit is contained in:
hyb-oyqq
2025-08-06 15:22:44 +08:00
parent b18f4a276c
commit 7befe19f30
17 changed files with 1707 additions and 148 deletions

View File

@@ -13,6 +13,7 @@ class GameDetector:
"""
self.game_info = game_info
self.debug_manager = debug_manager
self.directory_cache = {} # 添加目录缓存
def _is_debug_mode(self):
"""检查是否处于调试模式
@@ -135,6 +136,12 @@ class GameDetector:
"""
debug_mode = self._is_debug_mode()
# 检查缓存中是否已有该目录的识别结果
if selected_folder in self.directory_cache:
if debug_mode:
print(f"DEBUG: 使用缓存的目录识别结果: {selected_folder}")
return self.directory_cache[selected_folder]
if debug_mode:
print(f"--- 开始识别目录: {selected_folder} ---")
@@ -307,5 +314,14 @@ class GameDetector:
if debug_mode:
print(f"DEBUG: 最终识别的游戏目录: {game_paths}")
print(f"--- 目录识别结束 ---")
# 将识别结果存入缓存
self.directory_cache[selected_folder] = game_paths
return game_paths
return game_paths
def clear_directory_cache(self):
"""清除目录缓存"""
self.directory_cache = {}
if self._is_debug_mode():
print("DEBUG: 已清除目录缓存")