From c80a20113b16f70a8bc5d33bc68e8739ac4d33d6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 27 六月 2023 16:32:28 +0800 Subject: [PATCH] 1 --- ExportMap/cs/TBUtils.cs | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ExportMap/cs/TBUtils.cs b/ExportMap/cs/TBUtils.cs index 6ea9c69..eb85942 100644 --- a/ExportMap/cs/TBUtils.cs +++ b/ExportMap/cs/TBUtils.cs @@ -75,7 +75,7 @@ } finally { - ending(time); + ending(time, sourcePath); } } @@ -97,15 +97,15 @@ /// </summary> private static void MoveFilesToTemp(string sourcePath, string targetPath) { - 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")); + MoveFolder(Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�"), Path.Combine(targetPath, "img")); + MoveFolder(Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷"), Path.Combine(targetPath, "dem")); + MoveFolder(Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿"), Path.Combine(targetPath, "shp")); } /// <summary> - /// 澶嶅埗鐩綍 + /// 绉诲姩鐩綍 /// </summary> - private static void CopyFolder(string sourcePath, string targetPath) + private static void MoveFolder(string sourcePath, string targetPath) { if (!Directory.Exists(targetPath)) Directory.CreateDirectory(targetPath); @@ -191,19 +191,34 @@ /// <summary> /// 鏀跺熬宸ヤ綔 /// </summary> - private static void ending(string time) + private static void ending(string time, string sourcePath) { try { - string targetPath = Path.Combine(Tools.TempDir, time); - if (!Directory.Exists(targetPath)) return; + string path = Path.Combine(Tools.TempDir, time); + if (!Directory.Exists(path)) return; - // + string img = GetFilePath(Path.Combine(path, "img"), "*.tif"); + if (null != img) MoveFile(img, Path.Combine(sourcePath, "鏁板瓧姝e皠褰卞儚鍥�")); + + string dem = GetFilePath(Path.Combine(path, "dem"), "*.tif"); + if (null != dem) MoveFile(dem, Path.Combine(sourcePath, "鏁板瓧楂樼▼妯″瀷")); + + MoveFolder(Path.Combine(path, "shp"), Path.Combine(sourcePath, "涓嚎瑁佸壀鑼冨洿")); } catch (Exception ex) { LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); } } + + /// <summary> + /// 绉诲姩鏂囦欢 + /// </summary> + private static void MoveFile(string file, string targetPath) + { + FileInfo fi = new FileInfo(file); + File.Move(file, Path.Combine(targetPath, fi.Name)); + } } } -- Gitblit v1.9.3