From eb7ae609e499d5f1faa801299aa17a8cd05d676f Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 27 六月 2023 15:01:07 +0800 Subject: [PATCH] 移动TB文件 --- ExportMap/cs/TBUtils.cs | 27 ++++++++++++++++++--------- ExportMap/export.html | 11 ++++++++++- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ExportMap/cs/TBUtils.cs b/ExportMap/cs/TBUtils.cs index 741fab9..9958009 100644 --- a/ExportMap/cs/TBUtils.cs +++ b/ExportMap/cs/TBUtils.cs @@ -89,18 +89,27 @@ /// </summary> private static void MoveFilesToTemp(string sourcePath, string targetPath) { - string imgPath = Path.Combine(targetPath, "img"); - //if (!Directory.Exists(imgPath)) Directory.CreateDirectory(imgPath); + CopyFolder(Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�"), Path.Combine(targetPath, "img")); + CopyFolder(Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷"), Path.Combine(targetPath, "dem")); + CopyFolder(Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿"), Path.Combine(targetPath, "shp")); + } - string demPath = Path.Combine(targetPath, "dem"); - //if (!Directory.Exists(demPath)) Directory.CreateDirectory(demPath); + /// <summary> + /// 澶嶅埗鐩綍 + /// </summary> + private static void CopyFolder(string sourcePath, string targetPath) + { + if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); - string shpPath = Path.Combine(targetPath, "shp"); - //if (!Directory.Exists(shpPath)) Directory.CreateDirectory(shpPath); + DirectoryInfo di = new DirectoryInfo(sourcePath); - File.Move(Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�"), imgPath); - File.Move(Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷"), demPath); - File.Move(Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿"), shpPath); + FileInfo[] files = di.GetFiles(); + if (null == files || 0 == files.Length) return; + + foreach (FileInfo fi in files) + { + File.Move(fi.FullName, Path.Combine(targetPath, fi.Name)); + } } /// <summary> diff --git a/ExportMap/export.html b/ExportMap/export.html index 9f4cdfd..fc56e07 100644 --- a/ExportMap/export.html +++ b/ExportMap/export.html @@ -10,7 +10,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="js/jquery.1.12.4.js"></script> <script> - var token = "2b03248b-b00c-4bf3-b497-7d8708445495"; + var token = "673e4e0f-5a6e-49e6-bb04-d5991cbc3b7f"; // Ajax function ajax(url, type, data, dataType, contentType, fn) { @@ -160,6 +160,14 @@ console.log(rs); }); } + + // 鐢熸垚Mpt + function createMpt() { + ajax("TB/CreateMpt" + "?token=" + token + "&path=" + encodeURIComponent("D:\\LF\\data\\ANTU\\娴嬬粯锛圗SV锛�"), "GET", null, null, null, function (rs) { + alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); + console.log(rs); + }); + } </script> </head> <body> @@ -184,5 +192,6 @@ <input type="button" value="娴嬭瘯OSGB" onclick="toOsgb();" /> <input type="button" value="娴嬭瘯Las" onclick="toLas();" /> <input type="button" value="娴嬭瘯Laz" onclick="toLaz();" /> + <input type="button" value="鐢熸垚Mpt" onclick="createMpt();" /> </body> </html> -- Gitblit v1.9.3