huiyadanli/RevokeMsgPatcher · warning · Exception

在路径{appPath}下,未找到package.json.h.bak备份文件,请确认是否通过本软件安装过 LiteLo

Error message

在路径{appPath}下,未找到package.json.h.bak备份文件,请确认是否通过本软件安装过 LiteLoaderQQNT

What it means

RestorePackageJson(appPath) restores QQNT's package.json by copying package.json.h.bak over package.json. That backup is only written by ModifyPackageJson during a successful LiteLoaderQQNT install; if it is absent, restore cannot proceed and a plain Exception is thrown.

Source

Thrown at RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.cs:240

        {
            string destPath = Path.Combine(installPath, "dbghelp.dll");
            if (File.Exists(destPath))
            {
                File.Delete(destPath);
            }
        }

        private void RestorePackageJson(string appPath)
        {
            string packageJsonPath = Path.Combine(appPath, "package.json");
            string backupPath = Path.Combine(appPath, "package.json.h.bak");
            if (File.Exists(backupPath))
            {
                File.Copy(backupPath, packageJsonPath, true);
            }
            else
            {
                throw new Exception($"在路径{appPath}下,未找到package.json.h.bak备份文件,请确认是否通过本软件安装过 LiteLoaderQQNT");
            }
        }

        /// <summary>
        /// 打补丁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPath_Click(object sender, EventArgs e)
        {
            string installPath = txtQQNTPath.Text;
            if (!IsAllFilesExist(installPath))
            {
                MessageBox.Show("请选择正确的QQNT安装路径!");
                return;
            }

            try

View on GitHub (pinned to 89cbbb3f0c)

Solutions

  1. Install LiteLoaderQQNT via this tool first (install creates package.json.h.bak).
  2. If you modified package.json by other means, restore it manually from QQNT's original or reinstall QQNT.
  3. Verify GetAppPath resolved to the correct versions\<ver>\resources\app directory.
Defensive patterns

Strategy: validation

Validate before calling

string backupPath = Path.Combine(appPath, "package.json.h.bak");
if (!File.Exists(backupPath))
{
    MessageBox.Show("未找到备份文件,请先通过本软件安装 LiteLoaderQQNT。");
    return;
}
RestorePackageJson(appPath);

Prevention

When it happens

Trigger: Clicking Restore (btnRestore_Click -> RestorePackageJson) when package.json.h.bak does not exist in the resolved appPath. Happens when LiteLoaderQQNT was never installed via this tool, when the backup was deleted, or when QQNT was reinstalled (wiping the app folder).

Common situations: User runs Restore before ever installing; QQNT got reinstalled so the .bak is gone; wrong QQNT install path so appPath resolves to a folder that never had the backup.

Related errors


AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13). Data as JSON: /api/errors/f10718e9b8937750. Report an issue: GitHub.