Эх сурвалжийг харах

添加StarProcess函数,返回执行结果用于其他判断

Jeff Wang 3 жил өмнө
parent
commit
8509dd1d51

+ 31 - 0
FactoryTool_CShare/Business/CommonMethod.cs

@@ -169,6 +169,37 @@ namespace MOKA_Factory_Tools
             return false;
         }
 
+        public static bool StartProcess(string runFilePath, string args, out string outPutMsg)
+        {
+            try
+            {
+                outPutMsg = null;
+                Process process = new Process();
+                ProcessStartInfo startInfo = new ProcessStartInfo(runFilePath, args);
+                startInfo.UseShellExecute = false;
+                process.StartInfo = startInfo;
+                process.StartInfo.RedirectStandardError = true;
+                process.StartInfo.RedirectStandardInput = true;
+                process.StartInfo.RedirectStandardOutput = true;
+                process.StartInfo.CreateNoWindow= true;
+                process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "replace_tv_projects";
+                process.Start();
+                outPutMsg = process.StandardOutput.ReadToEnd();
+                process.WaitForExit();
+                process.Close();
+            }
+            catch(Exception ex)
+            {
+                outPutMsg = null;
+                Log.WriteErrorLog(string.Format("打开进程{0}失败:{1}", runFilePath, ex.Message));
+                return false;
+            }
+
+            Log.WriteInfoLog(string.Format("adb push结果={0}",outPutMsg));
+
+            return true;
+        }
+
         /// <summary>
         /// 获取订单信息
         /// </summary>