WechatModifier.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using RevokeMsgPatcher.Model;
  2. using RevokeMsgPatcher.Utils;
  3. namespace RevokeMsgPatcher.Modifier
  4. {
  5. class WechatModifier : AppModifier
  6. {
  7. public WechatModifier(App config)
  8. {
  9. this.config = config;
  10. }
  11. /// <summary>
  12. /// 自动寻找获取微信安装路径
  13. /// </summary>
  14. /// <returns></returns>
  15. public override string FindInstallPath()
  16. {
  17. string installPath = PathUtil.FindInstallPathFromRegistry("Wechat");
  18. if (!IsAllFilesExist(installPath))
  19. {
  20. foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\Wechat"))
  21. {
  22. if (IsAllFilesExist(defaultPath))
  23. {
  24. return defaultPath;
  25. }
  26. }
  27. }
  28. else
  29. {
  30. return installPath;
  31. }
  32. return null;
  33. }
  34. /// <summary>
  35. /// 获取整个APP的当前版本
  36. /// </summary>
  37. /// <returns></returns>
  38. public override string GetVersion()
  39. {
  40. if (editors != null && editors.Count > 0)
  41. {
  42. foreach (FileHexEditor editor in editors)
  43. {
  44. if (editor.FileName == "WeChatWin.dll")
  45. {
  46. return editor.FileVersion;
  47. }
  48. }
  49. }
  50. return "";
  51. }
  52. //public override bool ValidateAndInitialize(string installPath)
  53. //{
  54. // // 判断是否是安装路径
  55. // if (!IsAllBinaryFilesExist(installPath))
  56. // {
  57. // return false;
  58. // }
  59. // // 初始化十六进制文件编辑器
  60. // // 并寻找与之配对的版本修改信息
  61. // InitEditors(installPath);
  62. // return true;
  63. //}
  64. }
  65. }