huiyadanli/RevokeMsgPatcher · warning · BusinessException
match_already_replace
match_already_replace
Error message
特征比对:当前应用已经安装了对应功能的补丁!
What it means
ModifyFinder.FindChanges counted fewer signature matches (matchNum) than expected replacePatterns. IsAllReplaced then confirmed every selected pattern now shows 'search bytes absent AND replace bytes present', meaning the target file is already fully patched for all selected features. It throws BusinessException with ErrorCode 'match_already_replace'.
Source
Thrown at RevokeMsgPatcher/Matcher/ModifyFinder.cs:50
for (int i = 0; i < matchIndexs.Length; i++)
{
matchNum++;
// 与要替换的串不一样才需要替换(当前的特征肯定不一样)
if (!FuzzyMatcher.IsEqual(fileByteArray, matchIndexs[i], pattern.Replace))
{
changes.Add(new Change(matchIndexs[i], pattern.Replace));
}
}
}
}
// 匹配数和期望的匹配数不一致时报错(当前一个特征会出现多次)
if (matchNum < replacePatterns.Count)
{
Tuple<bool, SortedSet<string>> res = IsAllReplaced(fileByteArray, replacePatterns);
if (res.Item1)
{
throw new BusinessException("match_already_replace", "特征比对:当前应用已经安装了对应功能的补丁!");
}
else
{
if (res.Item2.Count > 0)
{
throw new BusinessException("match_inconformity", $"特征比对:以下功能补丁已经安装,请取消勾选!\n已安装功能:【{string.Join("、", res.Item2)}】");
}
else
{
throw new BusinessException("match_inconformity", $"特征比对:当前特征码匹配数[{matchNum}]和期望的匹配数[{replacePatterns.Count}]不一致。\n" +
$"出现此种情况的一般有如下可能:\n" +
$"1. 你可能已经安装了某个功能的补丁,请选择未安装功能进行安装。\n" +
$"2. 如果当前版本为最新版本,特征码可能出现变化(可能性比较低),请联系作者处理。");
}
}
}
else
{View on GitHub (pinned to 89cbbb3f0c)
Solutions
- Restore the original DLL first, then patch.
- Only select features the UI does not mark as already installed.
Defensive patterns
Strategy: try-catch
Type guard
static bool IsBusinessException(Exception e, string code) => e is BusinessException b && b.ErrorCode == code; static bool IsAlreadyReplaced(Exception e) => IsBusinessException(e, "match_already_replace");
Try / catch
try
{
modifier.ValidateAndFindModifyInfo(categories);
}
catch (BusinessException ex) when (ex.ErrorCode == "match_already_replace")
{
// All selected features are already installed; inform user, offer Restore.
MessageBox.Show("所选功能已全部安装,如需重装请先还原。");
} Prevention
- Filter BusinessException by ErrorCode rather than matching message text.
- Restore before re-patching; let the UI pre-mark already-installed features.
- Show the user actionable guidance (restore / uncheck) for each known ErrorCode.
When it happens
Trigger: Running ValidateAndFindModifyInfo / FindChanges on a DLL that already has every selected feature applied (e.g. by this tool previously, before a restore). matchNum < replacePatterns.Count and IsAllReplaced.Item1 is true.
Common situations: User re-runs the patch without restoring first; the DLL was patched across a prior session.
Related errors
AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13).
Data as JSON: /api/errors/03f65c0d604f8e81.
Report an issue: GitHub.