[#] 修改当前备份逻辑,相同版本dll只做一次备份!

原因: 可选功能补丁允许在非原版dll上做多次安装补丁操作。
This commit is contained in:
huiyadanli
2020-07-19 17:06:32 +08:00
parent fed166fa2b
commit 5ed38573de
4 changed files with 39 additions and 18 deletions
+2 -1
View File
@@ -345,6 +345,7 @@ namespace RevokeMsgPatcher.Modifier
bool success = editor.Patch();
if (!success)
{
// 此处还原逻辑不可能进入
editor.Restore();
}
else
@@ -369,7 +370,7 @@ namespace RevokeMsgPatcher.Modifier
{
foreach (FileHexEditor editor in editors)
{
if (!File.Exists(editor.FileBakPath))
if (!File.Exists(editor.FileBakPath) || editor.FileVersion != editor.BackupFileVersion)
{
return false;
}
+13 -1
View File
@@ -80,7 +80,19 @@ namespace RevokeMsgPatcher.Modifier
/// </summary>
public void Backup()
{
File.Copy(FilePath, FileBakPath, true);
// 不覆盖同版本的备份文件
if (File.Exists(FileBakPath))
{
if (FileVersion != BackupFileVersion)
{
File.Copy(FilePath, FileBakPath, true);
}
}
else
{
File.Copy(FilePath, FileBakPath, true);
}
}
/// <summary>