huiyadanli/RevokeMsgPatcher · error · Exception
补丁安装失败,原因:无对应的文件修改器
Error message
补丁安装失败,原因:无对应的文件修改器
What it means
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.
Source
Thrown at RevokeMsgPatcher/Modifier/AppModifier.cs:392
{
throw new BusinessException("maybe_modified", $"程序支持此文件版本: {editor.FileName} - {editor.FileVersion}。但是文件校验不通过,请确认是否使用过其他补丁程序!");
}
}
}
}
}
/// <summary>
/// c.根据补丁信息,安装补丁
/// 两种打补丁的方式:精准(指定位置替换)、通用(特征码替换)
/// </summary>
/// <returns></returns>
public bool Patch()
{
// 首先验证文件修改器是否没问题
if (editors.Count == 0)
{
throw new Exception("补丁安装失败,原因:无对应的文件修改器");
}
foreach (FileHexEditor editor in editors)
{
if (editor == null)
{
throw new Exception("补丁安装失败,原因:文件修改器初始化失败!");
}
}
// 再备份所有文件
foreach (FileHexEditor editor in editors)
{
editor.Backup();
}
// 打补丁!
List<FileHexEditor> done = new List<FileHexEditor>(); // 已经打上补丁的View on GitHub (pinned to 89cbbb3f0c)
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.
Example fix
// before
modifier.InitEditors(installPath);
modifier.Patch(); // throws if editors empty
// after
if (!modifier.InitEditors(installPath))
{
// InitEditors already showed a MessageBox; abort.
return;
}
modifier.ValidateAndFindModifyInfo(categories);
modifier.Patch(); Defensive patterns
Strategy: validation
Validate before calling
if (!modifier.InitEditors(installPath))
{
// InitEditors already showed '当前版本没有对应的文件修改信息...'.
return;
}
modifier.ValidateAndFindModifyInfo(categories);
modifier.Patch(); Prevention
- 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.
When it happens
Trigger: Calling Patch() before InitEditors(installPath) + ValidateAndFindModifyInfo(...); or InitEditors returned false (showing '当前版本没有对应的文件修改信息...') and the caller still proceeded to Patch().
Common situations: Orchestration code skipped InitEditors or ignored its bool return value; the app version is outside every TargetInfo's version range.
Related errors
AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13).
Data as JSON: /api/errors/755b0266f93e208f.
Report an issue: GitHub.