|
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
+using System.Reflection;
|
|
|
+using System.Security.Principal;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
@@ -14,7 +16,8 @@ namespace fis.Win.Dev.Helpers
|
|
|
/// 检查魔盒软件是否已经启动
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public static bool IsExistSonopostApp() {
|
|
|
+ public static bool IsExistSonopostApp()
|
|
|
+ {
|
|
|
var existApp = Process.GetProcessesByName("Sonopost");
|
|
|
return existApp.Any();
|
|
|
}
|
|
@@ -33,10 +36,11 @@ namespace fis.Win.Dev.Helpers
|
|
|
StartInfo =
|
|
|
{
|
|
|
FileName = sonopostPath,
|
|
|
- CreateNoWindow = true,
|
|
|
- UseShellExecute = false,
|
|
|
- RedirectStandardOutput = true,
|
|
|
- RedirectStandardError = true,
|
|
|
+ //CreateNoWindow = true,
|
|
|
+ UseShellExecute = true,
|
|
|
+ //RedirectStandardOutput = true,
|
|
|
+ //RedirectStandardError = true,
|
|
|
+ Verb = "runas",
|
|
|
}
|
|
|
};
|
|
|
process.Start();
|
|
@@ -48,26 +52,27 @@ namespace fis.Win.Dev.Helpers
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
public static bool CloseSonopostApp()
|
|
|
{
|
|
|
-
|
|
|
- Process[] processes = Process.GetProcessesByName("Sonopost");
|
|
|
- if (processes.Length > 0) {
|
|
|
+
|
|
|
+ Process[] processes = Process.GetProcessesByName("Sonopost");
|
|
|
+ if (processes.Length > 0)
|
|
|
+ {
|
|
|
Process process = processes[0];
|
|
|
- try
|
|
|
- {
|
|
|
- process.Kill();
|
|
|
- process.WaitForExit();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
+ try
|
|
|
+ {
|
|
|
+ process.Kill();
|
|
|
+ process.WaitForExit();
|
|
|
}
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
}
|