解耦修改器核心、存檔與兵種預設流程(含程式碼審查修正)#8
Closed
nojackno2-ctrl wants to merge 2 commits into
Closed
Conversation
- TroopPresetCodec.Write 改用不變文化最短往返格式,匯出 .artroop 不再把超過兩位小數的自訂值四捨五入;TroopPresetCodecTests 新增精度往返回歸。 - TroopPresetForm 匯出迴圈改為逐格檢查 TryReadValidatedCell 回傳值,與套用路徑一致,杜絕無效格默默匯出 0 的可能。 - SaveBackupService.RestoreBackup 暫存清理警告不再內嵌中文前綴,避免與 UI 的 LogRestoreBackupCleanupFailed 前綴重複;回滾雙重失敗改回解耦前語意——透過新增的 onRollbackFailure 回呼回報(UI 沿用舊日誌字串),對外重拋原始還原例外而非 AggregateException。 - ModifierForm.Data.cs 將 BuildCurrentPatchProfile 提到預設屬性表迴圈外,每次重載只建構一次。 本環境無 .NET SDK,git diff --check 乾淨;建置與 xUnit 由 CI 驗證。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C36zfC9C9a4E5nVyXNKp3K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
本 PR 包含兩個提交:
1.
4acd542解耦修改器核心、存檔與兵種預設流程(來自codex/decouple-core-and-file-workflows)FeatureDetector(711 行 → 44 行)拆為 7 個目標檔案偵測器(Exe/ClScript/Ress/Objdef/TeamDat/Bci/Install),協調器只保留 RomanEndless 的 EXE/team.dat 調和政策。BackupManager(772 行 → 約 184 行)拆為BackupSourceLoader、BackupValidator、BackupAutoHealer、GameDirectoryBackupLoader、OriginalFileValidator、UnitBaselineCatalog、CleanEparaBaseline;BackupFiles改為唯讀視圖,寫入一律經由會使快取失效的SetBackupFile。PatchEngine(454 行 → 138 行)拆為PatchFileComposer(8 個IPatchFileContributordry-run 組稿)、PatchRestoreService、PatchOperationRunner(UI 中立的交易執行器)。SaveBackupService/SaveBackupManifestCodec接管存檔掃描、預覽、ZIP 備份、交易式還原與刪除;TroopPresetCodec接管 4/6/9 欄相容解析與序列化;UnitStatsEditorService/UnitStatsProjectionService移除TroopPresetForm對ModifierForm的直接依賴。FeatureKey<T>/FeatureKeys作為功能 ID 與預設值的單一來源;FeatureRegistry.ValidateToggleIds於啟動時驗證 UI 開關表完整性。IsObjdefOriginal由 fail-open 改為 fail-closed(必須明確解析到FigRomAnf00_AnfuehrerHP=400);核心讀取統一使用PatchText.GameEncoding,消除 code-page provider 的測試順序相依。2.
d85b528程式碼審查修正(逐行審查 4acd542 全部 diff 後的存活發現)TroopPresetCodec.Write改用不變文化最短往返格式,匯出.artroop不再把超過兩位小數的自訂值四捨五入;新增精度往返回歸測試。TroopPresetForm匯出迴圈改為逐格檢查TryReadValidatedCell回傳值,與套用路徑一致。SaveBackupService.RestoreBackup暫存清理警告不再內嵌中文前綴(避免與 UI 的LogRestoreBackupCleanupFailed前綴重複);回滾雙重失敗改回解耦前語意——經新增的onRollbackFailure回呼記錄,對外重拋原始還原例外而非AggregateException。ModifierForm.Data.cs將BuildCurrentPatchProfile提到預設屬性表迴圈外。審查後刻意保留的行為變化:
CleanEparaBaseline移除註解行尾空白(epara 不參與偵測);TeamDatFeatureDetector例外時保留部分證據並一律執行 RomanEndless EXE 調和(較舊單體更完善)。驗證
4acd542、d85b528(run #68)。git diff --check乾淨、AI_HANDOFF 保留 UTF-8 BOM。🤖 Generated with Claude Code
https://claude.ai/code/session_01C36zfC9C9a4E5nVyXNKp3K
Generated by Claude Code