集成 LiteLoaderQQNT

This commit is contained in:
辉鸭蛋 2024-06-15 00:33:51 +08:00
parent f734a67586
commit 8b63257bb4
11 changed files with 135 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -1380,7 +1380,7 @@ namespace RevokeMsgPatcher
{
Search = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 E8 3F 3F 3F 3F"),
Replace = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 B8 01 00 00 00"),
Category = "去校验"
Category = "LiteLoaderQQNT+插件列表+防撤回"
}
}
}

View File

@ -171,7 +171,7 @@ namespace RevokeMsgPatcher
{
DialogResult result = MessageBox.Show(@"防撤回(老) 和 防撤回带提示(新) 两个功能二选一即可!
1. ()
1. () ()
2. ()
a.
@ -221,7 +221,7 @@ namespace RevokeMsgPatcher
{
modifier.Patch();
ga.RequestPageView($"{enName}/{version}/patch/succ", "补丁安装成功");
MessageBox.Show("补丁安装成功!");
MessageBox.Show("补丁安装成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (BusinessException ex)
{
@ -280,7 +280,16 @@ namespace RevokeMsgPatcher
EnableAllButton(false);
try
{
bool succ = modifier.Restore();
bool succ;
if (rbtQQNT.Checked)
{
succ = qqntModifier.Restore();
}
else
{
succ = modifier.Restore();
}
if (succ)
{
MessageBox.Show("还原成功!");

View File

@ -134,6 +134,12 @@ namespace RevokeMsgPatcher.Modifier
if (j == editors.Count)
{
label.Text = version + "(支持特征防撤回)";
// QQNT 特殊处理
if (config.Name == "QQNT")
{
label.Text = version + "支持LiteLoader";
}
label.ForeColor = Color.LimeGreen;
UIController.AddCategoryCheckBoxToPanel(panel, categories.ToArray(), installed.ToArray());
}
@ -256,6 +262,8 @@ namespace RevokeMsgPatcher.Modifier
/// <param name="installPath">APP安装路径</param>
public bool InitEditors(string installPath)
{
InstallPath = null;
// 初始化文件修改器
editors = new List<FileHexEditor>();
foreach (TargetInfo info in config.FileTargetInfos.Values)
@ -275,6 +283,8 @@ namespace RevokeMsgPatcher.Modifier
return false;
}
InstallPath = installPath;
return true;
}
@ -413,6 +423,8 @@ namespace RevokeMsgPatcher.Modifier
done.Add(editor);
}
}
AfterPatchSuccess();
}
catch (Exception ex)
{
@ -422,6 +434,7 @@ namespace RevokeMsgPatcher.Modifier
editor.Restore();
}
AfterPatchFail();
throw ex;
}
@ -478,5 +491,9 @@ namespace RevokeMsgPatcher.Modifier
throw new Exception("备份文件不存在,还原失败!");
}
}
public abstract void AfterPatchSuccess();
public abstract void AfterPatchFail();
}
}

View File

@ -12,6 +12,14 @@ namespace RevokeMsgPatcher.Modifier
this.config = config;
}
public override void AfterPatchSuccess()
{
}
public override void AfterPatchFail()
{
}
/// <summary>
/// 自动寻找获取微信安装路径
/// </summary>

View File

@ -12,6 +12,14 @@ namespace RevokeMsgPatcher.Modifier
this.config = config;
}
public override void AfterPatchSuccess()
{
}
public override void AfterPatchFail()
{
}
/// <summary>
/// 自动寻找获取微信安装路径
/// </summary>

View File

@ -2,7 +2,10 @@
using RevokeMsgPatcher.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace RevokeMsgPatcher.Modifier
{
@ -75,5 +78,70 @@ namespace RevokeMsgPatcher.Modifier
return "";
}
public string GetIndexJsPath()
{
if (string.IsNullOrEmpty(InstallPath))
{
throw new Exception("未获取到QQNT安装路径或者QQNT安装路径不合法");
}
string indexPath = Path.Combine(InstallPath, @"resources\app\app_launcher\index.js");
if (!File.Exists(indexPath))
{
throw new Exception("未找到index.js文件");
}
return indexPath;
}
public string GetLiteLoaderPath()
{
return Path.Combine(Application.StartupPath, @"LiteLoaderQQNT");
}
public override void AfterPatchSuccess()
{
string indexPath = GetIndexJsPath();
string content = File.ReadAllText(indexPath);
// 正则 require\(String.raw`.*`\);
string pattern = @"require\(String.raw`.*`\);";
string replacement = $"require(String.raw`{GetLiteLoaderPath()}`);";
if (Regex.IsMatch(content, pattern))
{
content = Regex.Replace(content, pattern, replacement);
}
else
{
content = replacement + "\n" + content;
}
File.WriteAllText(indexPath, content);
}
public override void AfterPatchFail()
{
try
{
string indexPath = GetIndexJsPath();
string content = File.ReadAllText(indexPath);
string pattern = @"require\(String.raw`.*`\);\n";
if (Regex.IsMatch(content, pattern))
{
content = Regex.Replace(content, pattern, "");
File.WriteAllText(indexPath, content);
}
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
public new bool Restore()
{
AfterPatchFail();
return base.Restore();
}
}
}

View File

@ -10,6 +10,15 @@ namespace RevokeMsgPatcher.Modifier
{
this.config = config;
}
public override void AfterPatchSuccess()
{
}
public override void AfterPatchFail()
{
}
/// <summary>
/// 自动寻找获取微信安装路径
/// </summary>

View File

@ -14,6 +14,14 @@ namespace RevokeMsgPatcher.Modifier
this.config = config;
}
public override void AfterPatchSuccess()
{
}
public override void AfterPatchFail()
{
}
/// <summary>
/// 自动寻找获取微信安装路径
/// </summary>

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
//[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7")]
[assembly: AssemblyFileVersion("1.7")]
[assembly: AssemblyVersion("1.8")]
[assembly: AssemblyFileVersion("1.8")]

File diff suppressed because one or more lines are too long