管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-06-27 c80a20113b16f70a8bc5d33bc68e8739ac4d33d6
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, "数字正射影像图"), Path.Combine(targetPath, "img"));
            CopyFolder(Path.Combine(sourcePath, "数字高程模型"), Path.Combine(targetPath, "dem"));
            CopyFolder(Path.Combine(sourcePath, "中线裁剪范围"), Path.Combine(targetPath, "shp"));
            MoveFolder(Path.Combine(sourcePath, "数字正射影像图"), 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, "数字正射影像图"));
                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));
        }
    }
}