From 2243ebc70d4168f03ae94b3487bd0c542bdeea35 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 09 十一月 2022 12:19:35 +0800
Subject: [PATCH] 1

---
 ExportMap/cs/ExportUtil.cs     |  106 +++++++++++++++++++++++++++++++----
 ExportMap/Models/ExportArgs.cs |    9 ++
 ExportMap/Web.config           |    8 +-
 3 files changed, 105 insertions(+), 18 deletions(-)

diff --git a/ExportMap/Models/ExportArgs.cs b/ExportMap/Models/ExportArgs.cs
index fc67e59..9571437 100644
--- a/ExportMap/Models/ExportArgs.cs
+++ b/ExportMap/Models/ExportArgs.cs
@@ -82,6 +82,9 @@
         /// </summary>
         public int dpi { set; get; }
 
+        /// <summary>
+        /// 璁剧疆榛樿鍊�
+        /// </summary>
         public void SetDefault()
         {
             if (string.IsNullOrWhiteSpace(title)) title = "绠¢亾鍩虹澶ф暟鎹钩鍙�";
@@ -91,9 +94,13 @@
             if (string.IsNullOrWhiteSpace(date)) date = DateTime.Now.ToString("yyyy.MM.dd");
 
             this.dpi = GetDpi(this.pageSize);
-            imgPath = "";
         }
 
+        /// <summary>
+        /// 鑾峰彇DPI
+        /// </summary>
+        /// <param name="page">椤甸潰澶у皬</param>
+        /// <returns>DPI</returns>
         public int GetDpi(string page)
         {
             if (string.IsNullOrWhiteSpace(page)) return 300;
diff --git a/ExportMap/Web.config b/ExportMap/Web.config
index 8dadc48..a6873e3 100644
--- a/ExportMap/Web.config
+++ b/ExportMap/Web.config
@@ -1,10 +1,10 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
 <configuration>
 	<appSettings>
-		<add key="lfServer" value="http://192.168.20.39:12316/"/>
-		<add key="sourceFolder" value="Sources" />
-		<!--<add key="pgConn" value="Server=127.0.0.1;Port=5432;Database={0};User Id=postgres;Password=postgres;"/>-->
-    <add key="pgConn" value="Server=192.168.20.39;Port=5433;Database=langfang;User Id=postgres;Password=postgres;" />
+    <!-- 192.168.20.39,127.0.0.1 -->
+		<add key="lfServer" value="http://127.0.0.1:12316/"/>
+    <add key="exportFolder" value="D:\LF\export"/>
+    <add key="pgConn" value="Server=127.0.0.1;Port=5432;Database=langfang;User Id=postgres;Password=postgres;" />
 		<add key="webpages:Version" value="3.0.0.0" />
 		<add key="webpages:Enabled" value="false" />
 		<add key="ClientValidationEnabled" value="true" />
diff --git a/ExportMap/cs/ExportUtil.cs b/ExportMap/cs/ExportUtil.cs
index 416575a..a6ee8a2 100644
--- a/ExportMap/cs/ExportUtil.cs
+++ b/ExportMap/cs/ExportUtil.cs
@@ -8,25 +8,24 @@
 
 namespace LFServer.cs
 {
-    public class ExportUtil
+    public static class ExportUtil
     {
+        /// <summary>
+        /// 鍩虹洰褰�
+        /// </summary>
         public static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
 
-        private static string py;
-
-        public string GetPy
-        {
-            get
-            {
-                if (py == null) py = Path.Combine(BaseDir, "Sources\\render.py");
-
-                return py;
-            }
-        }
+        /// <summary>
+        /// 鏈�澶ф枃浠舵暟
+        /// </summary>
+        public const int MaxFileCount = 2000;
 
         private static string sourcesPath;
 
-        public string GetSourcesPath
+        /// <summary>
+        /// 鑾峰彇璧勬簮鐩綍
+        /// </summary>
+        public static string SourcesPath
         {
             get
             {
@@ -37,6 +36,80 @@
 
                 return sourcesPath;
             }
+        }
+
+        private static string pyFile;
+
+        /// <summary>
+        /// 鑾峰彇Python鏂囦欢
+        /// </summary>
+        public static string PyFile
+        {
+            get
+            {
+                if (string.IsNullOrWhiteSpace(pyFile))
+                {
+                    pyFile = Path.Combine(SourcesPath, "render.py");
+                }
+
+                return pyFile;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇涓婃湡瀛楃涓�
+        /// </summary>
+        public static string DateStr
+        {
+            get
+            {
+                return DateTime.Now.ToString("yyyyMMddHHmmss");
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍑哄浘鐩綍
+        /// </summary>
+        public static string ExportFolder
+        {
+            get
+            {
+                return ConfigurationManager.AppSettings["exportFolder"];
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍑哄浘瀛愮洰褰�
+        /// </summary>
+        public static string GetExportSubFolder()
+        {
+            string root = ExportFolder;
+            if (!Directory.Exists(root))
+            {
+                Directory.CreateDirectory(root);
+            }
+
+            int i = 1;
+            while (true)
+            {
+                string subFolder = Path.Combine(root, i.ToString());
+                if (!Directory.Exists(subFolder))
+                {
+                    Directory.CreateDirectory(subFolder);
+                    break;
+                }
+
+                DirectoryInfo dir = new DirectoryInfo(subFolder);
+                FileInfo[] files = dir.GetFiles();
+                if (files == null || files.Length < MaxFileCount)
+                {
+                    break;
+                }
+
+                i++;
+            }
+
+            return i.ToString();
         }
 
         /// <summary>
@@ -66,5 +139,12 @@
             {
             }
         }
+
+        public static void Generate()
+        {
+            string date = DateStr;
+
+
+        }
     }
 }

--
Gitblit v1.9.3