[+] 支持微信 2.8.0.112,微信新版本带提示防撤回,修复版本判断逻辑,版本更新至0.8

This commit is contained in:
huiyadanli
2020-01-11 02:27:03 +08:00
parent 83c01ae4fc
commit f80c8a2ae6
11 changed files with 118 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
using RevokeMsgPatcher.Matcher;
using RevokeMsgPatcher.Model;
using RevokeMsgPatcher.Utils;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -145,18 +146,7 @@ namespace RevokeMsgPatcher.Modifier
{
try
{
int v = Convert.ToInt32(version.Replace(".", ""));
int s = Convert.ToInt32(start.Replace(".", ""));
int e = 0;
if (string.IsNullOrEmpty(end))
{
e = int.MaxValue;
}
else
{
e = Convert.ToInt32(end.Replace(".", ""));
}
if (v >= s && v <= e)
if (VersionUtil.Compare(version, start) == 1 && VersionUtil.Compare(version, end) <= 0)
{
return true;
}
@@ -179,6 +169,7 @@ namespace RevokeMsgPatcher.Modifier
// editor.FileVersion 在 StartVersion 和 EndVersion 之间
if (IsInVersionRange(editor.FileVersion, commonModifyInfo.StartVersion, commonModifyInfo.EndVersion))
{
Console.WriteLine($"{commonModifyInfo.StartVersion}<{editor.FileVersion}<={commonModifyInfo.EndVersion}");
return commonModifyInfo;
}
}
@@ -312,7 +303,7 @@ namespace RevokeMsgPatcher.Modifier
// 首先验证文件修改器是否没问题
foreach (FileHexEditor editor in editors)
{
if(editor == null)
if (editor == null)
{
throw new Exception("补丁安装失败,原因:文件修改器初始化失败!");
}

View File

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

View File

@@ -61,7 +61,7 @@ namespace RevokeMsgPatcher.Properties {
}
/// <summary>
/// 查找类似 {&quot;Apps&quot;:{&quot;Wechat&quot;:{&quot;Name&quot;:&quot;Wechat&quot;,&quot;FileTargetInfos&quot;:{&quot;WeChatWin.dll&quot;:{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;RelativePath&quot;:&quot;WeChatWin.dll&quot;,&quot;Memo&quot;:null}},&quot;FileModifyInfos&quot;:{&quot;WeChatWin.dll&quot;:[{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.8.0.106&quot;,&quot;SHA1Before&quot;:&quot;e772c81c8a1b79cac77b22dbe67b375fa340ba30&quot;,&quot;SHA1After&quot;:&quot;bcbc491910f07cb995ef154a281450f2d052e90b&quot;,&quot;Changes&quot;:[{&quot;Position&quot;:2658457,&quot;Content&quot;:[235]},{&quot;Position&quot;:8280416,&quot;Content&quot;:[195]}]},{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.8.0.88&quot;,&quot;SHA1Before&quot;:&quot;b34c73e38cfec186890b58caac5fc99623 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 {&quot;Apps&quot;:{&quot;Wechat&quot;:{&quot;Name&quot;:&quot;Wechat&quot;,&quot;FileTargetInfos&quot;:{&quot;WeChatWin.dll&quot;:{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;RelativePath&quot;:&quot;WeChatWin.dll&quot;,&quot;Memo&quot;:null}},&quot;FileModifyInfos&quot;:{&quot;WeChatWin.dll&quot;:[{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.8.0.112&quot;,&quot;SHA1Before&quot;:&quot;7497fc006f061799138aa33419280e41891a7981&quot;,&quot;SHA1After&quot;:&quot;07e681be40af32738d59a9332fe966c83c05e455&quot;,&quot;Changes&quot;:[{&quot;Position&quot;:2682233,&quot;Content&quot;:[235]},{&quot;Position&quot;:8289040,&quot;Content&quot;:[195]}]},{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.8.0.106&quot;,&quot;SHA1Before&quot;:&quot;e772c81c8a1b79cac77b22dbe67b375fa [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string PatchJson {
get {

File diff suppressed because one or more lines are too long

View File

@@ -87,6 +87,7 @@
<Compile Include="Utils\PathUtil.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\VersionUtil.cs" />
<EmbeddedResource Include="FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -23,9 +23,9 @@ namespace RevokeMsgPatcher.Utils
/// </summary>
private static readonly string[] urls = new string[]
{
"https://coding.net/u/huiyadanli/p/RevokeMsgPatcher/git/raw/master/RevokeMsgPatcher.Assistant/Data/0.7/patch.json",
"https://gitee.com/huiyadanli/RevokeMsgPatcher/raw/master/RevokeMsgPatcher.Assistant/Data/0.7/patch.json",
"https://raw.githubusercontent.com/huiyadanli/RevokeMsgPatcher/master/RevokeMsgPatcher.Assistant/Data/0.7/patch.json"
"https://coding.net/u/huiyadanli/p/RevokeMsgPatcher/git/raw/master/RevokeMsgPatcher.Assistant/Data/0.8/patch.json",
"https://gitee.com/huiyadanli/RevokeMsgPatcher/raw/master/RevokeMsgPatcher.Assistant/Data/0.8/patch.json",
"https://raw.githubusercontent.com/huiyadanli/RevokeMsgPatcher/master/RevokeMsgPatcher.Assistant/Data/0.8/patch.json"
};
private static int i = 0;

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RevokeMsgPatcher.Utils
{
public class VersionUtil
{
/// <summary>
/// 版本比较
/// 0 相等
/// 1 大与
/// -1 小于
/// 为空的版本最大
/// </summary>
/// <param name="v1">版本1</param>
/// <param name="v2">版本2</param>
/// <returns></returns>
public static int Compare(string v1, string v2)
{
if (string.IsNullOrEmpty(v1))
{
return 1;
}
if (string.IsNullOrEmpty(v2))
{
return -1;
}
string[] v1s = v1.Split('.');
string[] v2s = v2.Split('.');
int len = Math.Max(v1s.Length, v2s.Length);
for (int i = 0; i < len; i++)
{
int i1 = 0, i2 = 0;
if (i < v1s.Length)
{
i1 = Convert.ToInt32(v1s[i]);
}
if (i < v2s.Length)
{
i2 = Convert.ToInt32(v2s[i]);
}
if (i1 == i2)
{
continue;
}
else if (i1 > i2)
{
return 1;
}
else if (i1 < i2)
{
return -1;
}
}
return 0;
}
}
}