[+] 针对微信、QQ特定版本范围的特征码

This commit is contained in:
huiyadanli
2019-12-26 01:05:27 +08:00
parent 818a7e1dbd
commit 000dfa969e
7 changed files with 139 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ namespace RevokeMsgPatcher.Model
/// <summary>
/// 通用的修改特征
/// </summary>
public Dictionary<string, List<ModifyInfo>> FileCommonModifyInfos { get; set; }
public Dictionary<string, List<CommonModifyInfo>> FileCommonModifyInfos { get; set; }
public HashSet<string> GetSupportVersions()
{

View File

@@ -15,7 +15,7 @@ namespace RevokeMsgPatcher.Model
public string EndVersion { get; set; }
public List<Change> Changes { get; set; }
public List<ReplacePattern> ReplacePatterns { get; set; }
public CommonModifyInfo Clone()
{
@@ -23,12 +23,12 @@ namespace RevokeMsgPatcher.Model
o.Name = Name;
o.StartVersion = StartVersion;
o.EndVersion = EndVersion;
List<Change> cs = new List<Change>();
foreach(Change c in Changes)
List<ReplacePattern> cs = new List<ReplacePattern>();
foreach(ReplacePattern c in ReplacePatterns)
{
cs.Add(c.Clone());
}
o.Changes = cs;
o.ReplacePatterns = cs;
return o;
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace RevokeMsgPatcher.Model
{
public class ReplacePattern
{
public byte[] Search { get; set; }
public byte[] Replace { get; set; }
public ReplacePattern Clone()
{
ReplacePattern o = new ReplacePattern();
o.Search = Search;
o.Replace = Replace;
return o;
}
}
}

View File

@@ -62,6 +62,7 @@
<Compile Include="Model\Change.cs" />
<Compile Include="Model\CommonModifyInfo.cs" />
<Compile Include="Model\ModifyInfo.cs" />
<Compile Include="Model\ReplacePattern.cs" />
<Compile Include="Model\TargetInfo.cs" />
<Compile Include="Modifier\AppModifier.cs" />
<Compile Include="Modifier\FileHexEditor.cs" />
@@ -69,6 +70,7 @@
<Compile Include="Modifier\QQModifier.cs" />
<Compile Include="Modifier\TIMModifier.cs" />
<Compile Include="Modifier\WechatModifier.cs" />
<Compile Include="Utils\ByteUtil.cs" />
<Compile Include="Utils\Device.cs" />
<Compile Include="Utils\FileUtil.cs" />
<Compile Include="Utils\GAHelper.cs" />

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RevokeMsgPatcher.Utils
{
public class ByteUtil
{
public static byte[] HexStringToByteArray(string hex)
{
hex = hex.Replace(" ", "");
return Enumerable.Range(0, hex.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
}
public static string ByteArrayToHexString(byte[] data)
{
StringBuilder sb = new StringBuilder(data.Length * 3);
foreach (byte b in data)
{
sb.Append(Convert.ToString(b, 16).PadLeft(2, '0').PadRight(3, ' '));
}
return sb.ToString().ToUpper();
}
}
}