diff --git a/RevokeMsgPatcher/Modifier/QQLiteModifier.cs b/RevokeMsgPatcher/Modifier/QQLiteModifier.cs
index 45af711..1ef039e 100644
--- a/RevokeMsgPatcher/Modifier/QQLiteModifier.cs
+++ b/RevokeMsgPatcher/Modifier/QQLiteModifier.cs
@@ -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
///
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 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;
}
diff --git a/RevokeMsgPatcher/Modifier/QQModifier.cs b/RevokeMsgPatcher/Modifier/QQModifier.cs
index e52dde8..b82958b 100644
--- a/RevokeMsgPatcher/Modifier/QQModifier.cs
+++ b/RevokeMsgPatcher/Modifier/QQModifier.cs
@@ -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
///
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 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;
}
diff --git a/RevokeMsgPatcher/Modifier/WechatModifier.cs b/RevokeMsgPatcher/Modifier/WechatModifier.cs
index 690baaa..1a92ad7 100644
--- a/RevokeMsgPatcher/Modifier/WechatModifier.cs
+++ b/RevokeMsgPatcher/Modifier/WechatModifier.cs
@@ -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
///
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 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
///
private string GetRealInstallPath(string basePath)
{
+ if (basePath == null)
+ {
+ return null;
+ }
if (IsAllFilesExist(basePath))
{
return basePath;
diff --git a/RevokeMsgPatcher/Program.cs b/RevokeMsgPatcher/Program.cs
index 5046c55..58667bb 100644
--- a/RevokeMsgPatcher/Program.cs
+++ b/RevokeMsgPatcher/Program.cs
@@ -61,7 +61,7 @@ namespace RevokeMsgPatcher
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ex.Message + "\n" + ex.StackTrace.Trim(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endif
}
@@ -69,12 +69,12 @@ namespace RevokeMsgPatcher
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
- MessageBox.Show(e.Exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(e.Exception.Message + "\n" + e.Exception.StackTrace.Trim(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- MessageBox.Show((e.ExceptionObject as Exception).Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show((e.ExceptionObject as Exception).Message + "\n" + (e.ExceptionObject as Exception).StackTrace.Trim(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}