|
@@ -11,6 +11,7 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Windows.Forms;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
+using System.Threading;
|
|
|
|
|
|
namespace Client.Start
|
|
|
{
|
|
@@ -19,7 +20,7 @@ namespace Client.Start
|
|
|
|
|
|
public class RevitCmdExecutor : IRevitCommandExcutor
|
|
|
{
|
|
|
- public string ExecuteCmd(string revitCmd, string param, HashSet<string> filePathList)
|
|
|
+ public string ExecuteCmd(string revitCmd, string param, HashSet<string> filePathList, string taskId)
|
|
|
{
|
|
|
string msg = null;
|
|
|
try
|
|
@@ -36,7 +37,7 @@ namespace Client.Start
|
|
|
process.StartInfo.RedirectStandardInput = true;
|
|
|
process.StartInfo.RedirectStandardOutput = true;
|
|
|
process.StartInfo.RedirectStandardError = true;
|
|
|
- string resultFilePath = GetReusltFileName();
|
|
|
+ string resultFilePath = GetReusltFileName(taskId, revitCmd);
|
|
|
string newParam = AddResultFileNameToParam(param, resultFilePath);
|
|
|
Console.WriteLine(filePathList.First());
|
|
|
|
|
@@ -45,11 +46,32 @@ namespace Client.Start
|
|
|
"\"" + newParam + "\"" + " " +
|
|
|
"\"" + filePathList.First() + "\"";
|
|
|
process.Start();
|
|
|
+ process.WaitForExit();
|
|
|
|
|
|
- process.WaitForExit(60*60*1000);
|
|
|
-
|
|
|
- if(!process.HasExited)
|
|
|
- process.Kill();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Thread.Sleep(15000);
|
|
|
msg = ReadResultString(resultFilePath);
|
|
|
|
|
|
Console.WriteLine(DateTime.Now + " 命令执行完成:" + revitCmd);
|
|
@@ -94,10 +116,11 @@ namespace Client.Start
|
|
|
|
|
|
|
|
|
|
|
|
- private string GetReusltFileName()
|
|
|
+ private string GetReusltFileName(string taskId, string revitCmd)
|
|
|
{
|
|
|
string localPath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
|
|
- string fileName = "Result_" + Guid.NewGuid().ToString() + ".txt";
|
|
|
+
|
|
|
+ string fileName = "Result_" + taskId + revitCmd + ".txt";
|
|
|
return Path.Combine(localPath, "RevitService", fileName);
|
|
|
}
|
|
|
|