From 2bdf37bae40dd37a90363679be3245cad797769a Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 24 十月 2023 17:35:19 +0800
Subject: [PATCH] 测试TB生成MPT功能

---
 ExportMap/cs/TBUtils.cs |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/ExportMap/cs/TBUtils.cs b/ExportMap/cs/TBUtils.cs
index 604bb37..e5398d6 100644
--- a/ExportMap/cs/TBUtils.cs
+++ b/ExportMap/cs/TBUtils.cs
@@ -49,7 +49,6 @@
         public static string CreateMpt(string sourcePath, ref string err)
         {
             string time = TimeStr;
-
             try
             {
                 if (isBusy) throw new Exception("宸叉湁涓�涓敓鎴怣pt鐨勪换鍔℃鍦ㄦ墽琛�");
@@ -62,9 +61,10 @@
                 string tbp = GetNewTbp(time);
                 string js = GetNewJs(time, tbp, targetPath);
 
-                string cmd = string.Format("\"C:\\Program Files\\Skyline\\TerraBuilder\\TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
                 ReloadTB();
-                err = Tools.ExecCmdForWin(new List<string> { cmd });
+                //string cmd = string.Format("\"C:\\Program Files\\Skyline\\TerraBuilder\\TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
+                //err = Tools.ExecCmd(new List<string> { cmd });
+                err = Tools.ExecExe("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\"", string.Format("-script \"{0}\"", js));
                 isBusy = false;
 
                 return File.Exists(MptPath) ? MoveMpt(MptPath, sourcePath) : null;
@@ -83,6 +83,37 @@
         }
 
         /// <summary>
+        /// 娴嬭瘯
+        /// </summary>
+        public static bool Test(ref string err)
+        {
+            string time = TimeStr;
+            try
+            {
+                if (isBusy) throw new Exception("宸叉湁涓�涓敓鎴怣pt鐨勪换鍔℃鍦ㄦ墽琛�");
+
+                isBusy = true;
+                string js = "E:/terrait/TianJin/ExportMap/ExportMap/TerraBuilder/tb.js";
+                File.Copy("E:/terrait/TianJin/ExportMap/ExportMap/TerraBuilder/tb.tbp", "E:/terrait/TianJin/ExportMap/ExportMap/TerraBuilder/tb01.tbp", true);
+
+                //string cmd = string.Format("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\" -script \"{0}\"", js); // -DisablePrint
+                ReloadTB();
+                //err = Tools.ExecCmdForWin(new List<string> { cmd });
+                err = Tools.ExecExe("\"C:/Program Files/Skyline/TerraBuilder/TerraBuilder.exe\"", string.Format("-script \"{0}\"", js), false);
+                isBusy = false;
+
+                return File.Exists("D:/LF/data/mpt/tb.mpt");
+            }
+            catch (Exception ex)
+            {
+                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
+                err = ex.Message;
+                isBusy = false;
+                return false;
+            }
+        }
+
+        /// <summary>
         /// 鑾峰彇鏂癟bp鏂囦欢
         /// </summary>
         private static string GetNewTbp(string time)

--
Gitblit v1.9.3