[new] 新增表格对##group的支持
[new] 新增表格对##group的支持 Co-authored-by: Tianbao Lin <kteong1012@outlook.com>main
parent
14faa26565
commit
30a4ce12db
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -15,6 +16,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
public string Type { get; set; }
|
||||
|
||||
public string Desc { get; set; }
|
||||
public string Groups { get; set; }
|
||||
}
|
||||
|
||||
class RawSheetTableDefInfo
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
"desc",
|
||||
"comment",
|
||||
"column",
|
||||
"group",
|
||||
};
|
||||
|
||||
private const char s_sep = '#';
|
||||
|
|
@ -450,6 +451,10 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
{
|
||||
return IsRowTagEqual(row, "##type");
|
||||
}
|
||||
private static bool IsGroupRow(List<Cell> row)
|
||||
{
|
||||
return IsRowTagEqual(row, "##group");
|
||||
}
|
||||
|
||||
private static bool IsHeaderRow(List<Cell> row)
|
||||
{
|
||||
|
|
@ -577,7 +582,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
{
|
||||
descRow = cells.Count > 1 ? cells.Skip(1).FirstOrDefault(row => IsRowTagEqual(row, "##")) : null;
|
||||
}
|
||||
|
||||
List<Cell> groupRow = cells.Find(row => IsGroupRow(row));
|
||||
var fields = new Dictionary<string, FieldInfo>();
|
||||
foreach (var subTitle in title.SubTitleList)
|
||||
{
|
||||
|
|
@ -617,6 +622,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
Name = subTitle.Name,
|
||||
Tags = subTitle.Tags,
|
||||
Type = typeRow[subTitle.FromIndex].Value?.ToString() ?? "",
|
||||
Groups = groupRow?[subTitle.FromIndex].Value?.ToString() ?? "",
|
||||
Desc = desc,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,9 +367,7 @@ namespace Luban.Job.Cfg.Defs
|
|||
}
|
||||
|
||||
cf.Comment = f.Desc;
|
||||
|
||||
cf.Type = attrs[0];
|
||||
|
||||
for (int i = 1; i < attrs.Length; i++)
|
||||
{
|
||||
var pair = attrs[i].Split('=', 2);
|
||||
|
|
@ -411,6 +409,11 @@ namespace Luban.Job.Cfg.Defs
|
|||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(f.Groups))
|
||||
{
|
||||
cf.Groups = f.Groups.Split(',').Select(s => s.Trim()).Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
|
||||
}
|
||||
|
||||
cb.Fields.Add(cf);
|
||||
}
|
||||
return cb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue