From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。

---
 HotelPms.SourceFactory/Util/EnumFactory.cs |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/HotelPms.SourceFactory/Util/EnumFactory.cs b/HotelPms.SourceFactory/Util/EnumFactory.cs
new file mode 100644
index 0000000..10a12fa
--- /dev/null
+++ b/HotelPms.SourceFactory/Util/EnumFactory.cs
@@ -0,0 +1,50 @@
+using HotelPms.Share.Windows.Util;
+using HotelPms.SourceFactory.Table;
+using System.Text;
+
+namespace HotelPms.SourceFactory.Util;
+
+public class EnumFactory
+{
+    public static string Create(string path, int sheetIndex)
+    {
+        StringBuilder text = new();
+        using NPOIExcel excel = new(path);
+        excel.SetCurrentSheet(sheetIndex);
+        bool start = false; 
+        for (int i = 0; i < excel.Sheet.LastRowNum; i++)
+        {
+            string line = excel.GetCellString($"B{i+1}");
+            if(line.Length > 0 && line.Substring(0,1) == "■")
+            {
+                int p1 = line.IndexOf('(');
+                int p2 = line.IndexOf(')');
+                string name = line.Substring(p1 + 1, p2 - p1 - 1);
+                text.Append(Environment.NewLine);
+                text.AppendLine($"public enum {name} : int");
+                text.AppendLine("{");
+                start = true;
+            }
+            else
+            {                
+                if (start) 
+                {
+                    string itemLine = excel.GetCellString($"C{i + 1}").Trim();
+                    if (itemLine.Length == 0) { text.AppendLine("}"); start = false; }
+                    else if (itemLine == "名称") { continue; }
+                    else
+                    {
+                        text.AppendLine($"[Description(\"{excel.GetCellString($"R{i + 1}").Trim()}\")]");
+                        text.AppendLine($"{itemLine} = {excel.GetCellInt($"O{i + 1}")},");
+                    }                   
+                }
+
+            }
+
+        }
+
+        return text.ToString(); 
+    }
+
+}
+

--
Gitblit v1.10.0