| | |
| | | public static string CreateMpt(string sourcePath, ref string err) |
| | | { |
| | | string time = TimeStr; |
| | | |
| | | try |
| | | { |
| | | if (isBusy) throw new Exception("已有一个生成Mpt的任务正在执行"); |
| | |
| | | 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.ExecCmd(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; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 测试 |
| | | /// </summary> |
| | | public static bool Test(ref string err) |
| | | { |
| | | string time = TimeStr; |
| | | try |
| | | { |
| | | if (isBusy) throw new Exception("已有一个生成Mpt的任务正在执行"); |
| | | |
| | | isBusy = true; |
| | | string js = Path.Combine(SourcesPath, "tb.js"); |
| | | |
| | | string newTbp = Path.Combine(Tools.TempDir, time, time + ".tbp"); |
| | | File.Copy(Path.Combine(SourcesPath, "tb.tbp"), Path.Combine(SourcesPath, "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(MptPath); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | err = ex.Message; |
| | | isBusy = false; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取新Tbp文件 |
| | | /// </summary> |
| | | private static string GetNewTbp(string time) |