【优化】调整&与#的分割语法。除了定义字段的非type以外的属性用&,其他地方都用#。
parent
66e07830d0
commit
0b63b1fcb3
|
|
@ -90,6 +90,8 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
"##",
|
||||
};
|
||||
|
||||
private const char s_sep = '#';
|
||||
|
||||
private static void ValidateTitles(List<List<Cell>> rows)
|
||||
{
|
||||
foreach (var row in rows)
|
||||
|
|
@ -166,7 +168,11 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
{
|
||||
break;
|
||||
}
|
||||
var tags = rowTag.Substring(2).Split('&').Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToList();
|
||||
if (rowTag.Substring(2).IndexOf('&') >= 0)
|
||||
{
|
||||
throw new Exception($"excel标题头不再使用'&'作为分割符,请改为'{s_sep}'");
|
||||
}
|
||||
var tags = rowTag.Substring(2).Split(s_sep).Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToList();
|
||||
if (tags.Contains("field") || tags.Contains("var") || tags.Contains("+"))
|
||||
{
|
||||
rowIndex = i;
|
||||
|
|
@ -214,7 +220,11 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
|
||||
public static (string Name, Dictionary<string, string> Tags) ParseNameAndMetaAttrs(string nameAndAttrs)
|
||||
{
|
||||
var attrs = nameAndAttrs.Split('&');
|
||||
if (nameAndAttrs.Contains('&'))
|
||||
{
|
||||
throw new Exception($"excel标题头不再使用'&'作为分割符,请改为'{s_sep}'");
|
||||
}
|
||||
var attrs = nameAndAttrs.Split(s_sep);
|
||||
|
||||
string titleName = attrs[0];
|
||||
var tags = new Dictionary<string, string>();
|
||||
|
|
@ -372,7 +382,11 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
|||
{
|
||||
return false;
|
||||
}
|
||||
foreach (var attr in metaStr.Substring(2).Split('&'))
|
||||
if (metaStr.Substring(2).Contains('&'))
|
||||
{
|
||||
throw new Exception($"excel标题头不再使用'&'作为分割符,请改为'{s_sep}'");
|
||||
}
|
||||
foreach (var attr in metaStr.Substring(2).Split(s_sep))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(attr))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -355,8 +355,7 @@ namespace Luban.Job.Cfg.Defs
|
|||
case "range":
|
||||
case "sep":
|
||||
{
|
||||
cf.Type = cf.Type + "#(" + attrs[i] + ")";
|
||||
break;
|
||||
throw new Exception($"table:'{table.Name}' file:{file.OriginFile} title:'{name}' attr:'{attrName}' 属于type的属性,必须用#分割,尝试'{cf.Type}#{attrs[i]}'");
|
||||
}
|
||||
case "group":
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue