{"record":{"id":"755b0266f93e208f","repo":"huiyadanli/RevokeMsgPatcher","slug":"error-755b02","errorCode":null,"errorMessage":"补丁安装失败，原因：无对应的文件修改器","messagePattern":"补丁安装失败，原因：无对应的文件修改器","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"RevokeMsgPatcher/Modifier/AppModifier.cs","lineNumber":392,"sourceCode":"                        {\n                            throw new BusinessException(\"maybe_modified\", $\"程序支持此文件版本： {editor.FileName} - {editor.FileVersion}。但是文件校验不通过，请确认是否使用过其他补丁程序！\");\n                        }\n                    }\n                }\n            }\n        }\n\n        /// <summary>\n        /// c.根据补丁信息，安装补丁\n        /// 两种打补丁的方式：精准（指定位置替换）、通用（特征码替换）\n        /// </summary>\n        /// <returns></returns>\n        public bool Patch()\n        {\n            // 首先验证文件修改器是否没问题\n            if (editors.Count == 0)\n            {\n                throw new Exception(\"补丁安装失败，原因：无对应的文件修改器\");\n            }\n\n            foreach (FileHexEditor editor in editors)\n            {\n                if (editor == null)\n                {\n                    throw new Exception(\"补丁安装失败，原因：文件修改器初始化失败！\");\n                }\n            }\n\n            // 再备份所有文件\n            foreach (FileHexEditor editor in editors)\n            {\n                editor.Backup();\n            }\n\n            // 打补丁！\n            List<FileHexEditor> done = new List<FileHexEditor>(); // 已经打上补丁的","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/huiyadanli/RevokeMsgPatcher/blob/89cbbb3f0cc896d5d092de0199a635c5c39944b6/RevokeMsgPatcher/Modifier/AppModifier.cs#L374-L410","documentation":"AppModifier.Patch() throws a plain Exception if editors.Count == 0. That means InitEditors was never run, returned false, or no TargetInfo matched the installed app's version range, so no file editors exist to patch.","triggerScenarios":"Calling Patch() before InitEditors(installPath) + ValidateAndFindModifyInfo(...); or InitEditors returned false (showing '当前版本没有对应的文件修改信息...') and the caller still proceeded to Patch().","commonSituations":"Orchestration code skipped InitEditors or ignored its bool return value; the app version is outside every TargetInfo's version range.","solutions":["Always call InitEditors(installPath) and check its bool return before Patch().","Ensure config.FileTargetInfos has entries whose StartVersion/EndVersion range matches the installed app version.","Abort the flow with a user message when InitEditors returns false."],"exampleFix":"// before\nmodifier.InitEditors(installPath);\nmodifier.Patch(); // throws if editors empty\n\n// after\nif (!modifier.InitEditors(installPath))\n{\n    // InitEditors already showed a MessageBox; abort.\n    return;\n}\nmodifier.ValidateAndFindModifyInfo(categories);\nmodifier.Patch();","handlingStrategy":"validation","validationCode":"if (!modifier.InitEditors(installPath))\n{\n    // InitEditors already showed '当前版本没有对应的文件修改信息...'.\n    return;\n}\nmodifier.ValidateAndFindModifyInfo(categories);\nmodifier.Patch();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call InitEditors and honor its bool return before Patch().","Ensure config.FileTargetInfos version ranges cover the installed app.","Treat an empty editor list as a hard stop with a user message."],"tags":["app-modifier","init","orchestration"],"backgroundTag":null,"analyzedSha":"89cbbb3f0cc896d5d092de0199a635c5c39944b6","analyzedAt":"2026-08-13T10:37:37.073Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}