MCPcopy Index your code
hub / github.com/BasicProtein/AugmentCode-Free / run

Method run

gui_qt6/patch_worker.py:31–85  ·  view source on GitHub ↗

执行补丁操作

(self)

Source from the content-addressed store, hash-verified

29 self.extension_finder = ExtensionFinder()
30
31 def run(self):
32 """执行补丁操作"""
33 try:
34 self.progress_updated.emit(get_text("patch.searching"))
35
36 # 查找扩展文件
37 extension_files = self.extension_finder.find_extension_files(
38 self.ide_type, self.portable_root
39 )
40
41 if not extension_files:
42 self.patch_completed.emit(False, get_text("patch.not_found", ide_type=self.ide_type.value))
43 return
44
45 self.progress_updated.emit(get_text("patch.found_files", count=len(extension_files)))
46
47 # 对每个文件应用补丁
48 success_count = 0
49 total_files = len(extension_files)
50
51 for i, file_path in enumerate(extension_files, 1):
52 self.progress_updated.emit(get_text("patch.processing",
53 current=i, total=total_files, file=file_path))
54
55 # 检查文件状态
56 status = self.patch_manager.get_patch_status(file_path)
57 self.file_found.emit(file_path, status)
58
59 if status == get_text("patch.status.patched"):
60 self.progress_updated.emit(get_text("patch.already_patched", file=file_path))
61 continue
62
63 # 应用补丁
64 result = self.patch_manager.apply_patch(file_path, self.patch_mode)
65
66 if result.success:
67 success_count += 1
68 self.progress_updated.emit(get_text("patch.patch_success", file=file_path))
69 else:
70 self.progress_updated.emit(get_text("patch.patch_failed", message=result.message))
71
72 # 完成总结
73 if success_count > 0:
74 message = get_text("patch.completed", success=success_count, total=total_files)
75 self.progress_updated.emit(f"🎉 {message}")
76 self.patch_completed.emit(True, message)
77 else:
78 message = get_text("patch.no_success")
79 self.progress_updated.emit(f"⚠️ {message}")
80 self.patch_completed.emit(False, message)
81
82 except Exception as e:
83 error_msg = get_text("patch.error", error=str(e))
84 self.progress_updated.emit(f"❌ {error_msg}")
85 self.patch_completed.emit(False, error_msg)
86
87
88class RestoreWorker(QThread):

Callers

nothing calls this directly

Calls 4

get_textFunction · 0.90
find_extension_filesMethod · 0.80
get_patch_statusMethod · 0.80
apply_patchMethod · 0.80

Tested by

no test coverage detected