mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2025-05-23 05:46:07 +08:00
处理文件不存在但是希望打补丁的情况
This commit is contained in:
parent
8b63257bb4
commit
344f2f7e75
|
@ -106,7 +106,14 @@ namespace RevokeMsgPatcher.Modifier
|
|||
string content = File.ReadAllText(indexPath);
|
||||
// 正则 require\(String.raw`.*`\);
|
||||
string pattern = @"require\(String.raw`.*`\);";
|
||||
string replacement = $"require(String.raw`{GetLiteLoaderPath()}`);";
|
||||
string liteLoaderPath = GetLiteLoaderPath();
|
||||
if (!File.Exists(liteLoaderPath))
|
||||
{
|
||||
MessageBox.Show("LiteLoaderQQNT文件夹不存在,仅安装QQNT去验证补丁", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string replacement = $"require(String.raw`{liteLoaderPath}`);";
|
||||
if (Regex.IsMatch(content, pattern))
|
||||
{
|
||||
content = Regex.Replace(content, pattern, replacement);
|
||||
|
|
Loading…
Reference in New Issue
Block a user