导表修改

This commit is contained in:
2025-10-09 23:58:11 +08:00
parent 547d234ad3
commit 520d4f37bd
8 changed files with 95 additions and 305 deletions

View File

@@ -21,14 +21,14 @@ public sealed class ExcelExporter
public ExportType ExportType;
private readonly string _excelProgramPath;
private readonly string _versionFilePath;
// public VersionInfo VersionInfo; // 存储 Excel 文件的版本信息。
private readonly Regex _regexName = new Regex("^[a-zA-Z][a-zA-Z0-9_]*$"); // 用于验证 Excel 表名的正则表达式。
private readonly HashSet<string> _loadFiles = [".xlsx", ".xlsm", ".csv"]; // 加载的支持文件扩展名。
private readonly ConcurrentDictionary<string, ExcelTable> _excelTables =
new ConcurrentDictionary<string, ExcelTable>(); // 存储解析后的 Excel 表。
/// <summary>
/// 导表支持的数据类型集合。
/// </summary>
@@ -635,6 +635,12 @@ public sealed class ExcelExporter
var colInfos = isServer ? table.ServerColInfos : table.ClientColInfos;
var exportPath = isServer ? App.Config.ServerPath : App.Config.ClientPath;
var csNamespace = isServer ? App.Config.ServerNamespace : App.Config.ClientNamespace;
if (string.IsNullOrEmpty(csNamespace))
{
csNamespace = "NB";
}
if (colInfos.Count <= 0)
{
return;
@@ -723,7 +729,7 @@ public sealed class ExcelExporter
FileHelper.CreateDirectory(exportPath);
}
var content = template.Replace("(namespace)", "Fantasy")
var content = template.Replace("(namespace)", csNamespace)
.Replace("(ConfigName)", csName)
.Replace("(Fields)", fileBuilder.ToString());
File.WriteAllText(Path.Combine(exportPath, $"{csName}.cs"), content);