ソースを参照

进程工具不再判断文件是否存在(改判断导致msi-exe无法运行)

yuzhengyang 6 年 前
コミット
23526f6cba
1 ファイル変更11 行追加17 行削除
  1. 11 17
      Azylee.Utils/Azylee.Core/ProcessUtils/ProcessTool.cs

+ 11 - 17
Azylee.Utils/Azylee.Core/ProcessUtils/ProcessTool.cs

@@ -38,15 +38,12 @@ namespace Azylee.Core.ProcessUtils
         /// <returns></returns>
         public static bool Start(string file, string args = "")
         {
-            if (File.Exists(file))
+            try
             {
-                try
-                {
-                    Process.Start(file, args);
-                    return true;
-                }
-                catch { }
+                Process.Start(file, args);
+                return true;
             }
+            catch { }
             return false;
         }
         /// <summary>
@@ -57,16 +54,13 @@ namespace Azylee.Core.ProcessUtils
         {
             try
             {
-                if (File.Exists(file))
-                {
-                    Process p = new Process();
-                    p.StartInfo.FileName = file;
-                    p.StartInfo.Arguments = args;
-                    p.StartInfo.UseShellExecute = true;
-                    p.Start();
-                    p.WaitForInputIdle(3000);
-                    return true;
-                }
+                Process p = new Process();
+                p.StartInfo.FileName = file;
+                p.StartInfo.Arguments = args;
+                p.StartInfo.UseShellExecute = true;
+                p.Start();
+                p.WaitForInputIdle(3000);
+                return true;
             }
             catch (Exception ex) { }
             return false;