| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建MPT |
| | | /// 创建Mpt |
| | | /// </summary> |
| | | public static string CreateMpt(string sourcePath, ref string err) |
| | | { |
| | | string time = TimeStr; |
| | | string targetPath = Path.Combine(Tools.TempDir, time); |
| | | |
| | | try |
| | | { |
| | | string targetPath = Path.Combine(Tools.TempDir, time); |
| | | if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); |
| | | |
| | | MoveFilesToTemp(sourcePath, targetPath); |
| | | 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(cmd, false, false); |
| | | if (File.Exists(MptPath)) |
| | | { |
| | | return MoveMpt(MptPath, sourcePath); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | |
| | | } |
| | | finally |
| | | { |
| | | if (Directory.Exists(targetPath)) Directory.Delete(targetPath, true); |
| | | ending(time); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Tools.ExecCmd(list, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移动Mpt文件 |
| | | /// </summary> |
| | | private static string MoveMpt(string mpt, string targetPath) |
| | | { |
| | | string path = Path.Combine(targetPath, "Mpt"); |
| | | if (!Directory.Exists(path)) Directory.CreateDirectory(path); |
| | | |
| | | FileInfo fi = new FileInfo(mpt); |
| | | string newMpt = Path.Combine(path, fi.Name); |
| | | File.Move(mpt, newMpt); |
| | | |
| | | string mIdx = mpt.Replace(".mpt", ".mIdx"); |
| | | if (File.Exists(mIdx)) File.Move(mIdx, newMpt.Replace(".mpt", ".mIdx")); |
| | | |
| | | string Strmi = mpt.Replace(".mpt", ".Strmi"); |
| | | if (File.Exists(Strmi)) File.Move(Strmi, newMpt.Replace(".mpt", ".Strmi")); |
| | | |
| | | return newMpt; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 收尾工作 |
| | | /// </summary> |
| | | private static void ending(string time) |
| | | { |
| | | try |
| | | { |
| | | string targetPath = Path.Combine(Tools.TempDir, time); |
| | | if (!Directory.Exists(targetPath)) return; |
| | | |
| | | // |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | } |
| | | } |
| | | } |
| | | } |