mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2026-09-12 01:00:49 +08:00
[#] 修复微信寻找路径时的 bug #282
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using RevokeMsgPatcher.Model;
|
||||
using RevokeMsgPatcher.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RevokeMsgPatcher.Modifier
|
||||
{
|
||||
@@ -16,20 +18,28 @@ namespace RevokeMsgPatcher.Modifier
|
||||
/// <returns></returns>
|
||||
public override string FindInstallPath()
|
||||
{
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("QQLite");
|
||||
if (!IsAllFilesExist(installPath))
|
||||
try
|
||||
{
|
||||
foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\QQLite"))
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("QQLite");
|
||||
if (!IsAllFilesExist(installPath))
|
||||
{
|
||||
if (IsAllFilesExist(defaultPath))
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\QQLite");
|
||||
foreach (string defaultPath in defaultPathList)
|
||||
{
|
||||
return defaultPath;
|
||||
if (IsAllFilesExist(defaultPath))
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return installPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
return installPath;
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using RevokeMsgPatcher.Model;
|
||||
using RevokeMsgPatcher.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RevokeMsgPatcher.Modifier
|
||||
{
|
||||
@@ -16,20 +18,28 @@ namespace RevokeMsgPatcher.Modifier
|
||||
/// <returns></returns>
|
||||
public override string FindInstallPath()
|
||||
{
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("{052CFB79-9D62-42E3-8A15-DE66C2C97C3E}");
|
||||
if (!IsAllFilesExist(installPath))
|
||||
try
|
||||
{
|
||||
foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\QQ"))
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("{052CFB79-9D62-42E3-8A15-DE66C2C97C3E}");
|
||||
if (!IsAllFilesExist(installPath))
|
||||
{
|
||||
if (IsAllFilesExist(defaultPath))
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\QQ");
|
||||
foreach (string defaultPath in defaultPathList)
|
||||
{
|
||||
return defaultPath;
|
||||
if (IsAllFilesExist(defaultPath))
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return installPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
return installPath;
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using RevokeMsgPatcher.Model;
|
||||
using RevokeMsgPatcher.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace RevokeMsgPatcher.Modifier
|
||||
@@ -18,22 +20,30 @@ namespace RevokeMsgPatcher.Modifier
|
||||
/// <returns></returns>
|
||||
public override string FindInstallPath()
|
||||
{
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("Wechat");
|
||||
string realPath = GetRealInstallPath(installPath);
|
||||
if (string.IsNullOrEmpty(realPath))
|
||||
try
|
||||
{
|
||||
foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\Wechat"))
|
||||
string installPath = PathUtil.FindInstallPathFromRegistry("Wechat");
|
||||
string realPath = GetRealInstallPath(installPath);
|
||||
if (string.IsNullOrEmpty(realPath))
|
||||
{
|
||||
realPath = GetRealInstallPath(defaultPath);
|
||||
if (!string.IsNullOrEmpty(realPath))
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\QQ");
|
||||
foreach (string defaultPath in defaultPathList)
|
||||
{
|
||||
return defaultPath;
|
||||
realPath = GetRealInstallPath(defaultPath);
|
||||
if (!string.IsNullOrEmpty(realPath))
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return realPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
return realPath;
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -45,6 +55,10 @@ namespace RevokeMsgPatcher.Modifier
|
||||
/// <returns></returns>
|
||||
private string GetRealInstallPath(string basePath)
|
||||
{
|
||||
if (basePath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (IsAllFilesExist(basePath))
|
||||
{
|
||||
return basePath;
|
||||
|
||||
Reference in New Issue
Block a user