From 82fbdb513f47e2e218c186b0dffc658fb0e94d97 Mon Sep 17 00:00:00 2001 From: walon Date: Sun, 27 Mar 2022 15:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=20?= =?UTF-8?q?=E5=AF=B9=E4=BA=8Egroup=E5=B1=9E=E6=80=A7=E5=A4=B1=E8=AF=AF?= =?UTF-8?q?=E7=94=A8=E4=BA=8Etype=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E5=AF=B9=E4=BA=8Esep=E5=A4=B1=E8=AF=AF=E5=86=99=E6=88=90seq?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Luban.Client/Source/Program.cs | 2 +- .../Source/Defs/DefAssemblyBase.cs | 4 ++-- src/Luban.Job.Common/Source/Utils/DefUtil.cs | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Luban.Client/Source/Program.cs b/src/Luban.Client/Source/Program.cs index b61bc57..f9964d5 100644 --- a/src/Luban.Client/Source/Program.cs +++ b/src/Luban.Client/Source/Program.cs @@ -269,7 +269,7 @@ Options: } else { - s_logger.Error("GenJob fail. err:{err} msg:{msg}", res.ErrCode, res.ErrMsg); + s_logger.Error("GenJob fail. msg:{msg}", res.ErrMsg); if (!string.IsNullOrEmpty(res.StackTrace)) { s_logger.Debug("StackTrace: {}", res.StackTrace); diff --git a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs index 82886b5..b8fd41a 100644 --- a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs @@ -269,7 +269,7 @@ namespace Luban.Job.Common.Defs { string containerTypeAndTags = DefUtil.TrimBracePairs(type.Substring(0, sepIndex)); var elementTypeAndTags = type.Substring(sepIndex + 1); - var (containerType, containerTags) = DefUtil.ParseType(containerTypeAndTags); + var (containerType, containerTags) = DefUtil.ParseTypeAndVaildAttrs(containerTypeAndTags); return CreateContainerType(module, containerType, containerTags, elementTypeAndTags.Trim()); } else @@ -283,7 +283,7 @@ namespace Luban.Job.Common.Defs bool nullable; // 去掉 rawType 两侧的匹配的 () rawType = DefUtil.TrimBracePairs(rawType); - var (type, tags) = DefUtil.ParseType(rawType); + var (type, tags) = DefUtil.ParseTypeAndVaildAttrs(rawType); if (type.EndsWith('?')) { diff --git a/src/Luban.Job.Common/Source/Utils/DefUtil.cs b/src/Luban.Job.Common/Source/Utils/DefUtil.cs index f0e2094..b117865 100644 --- a/src/Luban.Job.Common/Source/Utils/DefUtil.cs +++ b/src/Luban.Job.Common/Source/Utils/DefUtil.cs @@ -183,7 +183,24 @@ namespace Luban.Job.Common.Utils } } - public static bool ParseOrientation(string value) + public static (string, Dictionary) ParseTypeAndVaildAttrs(string s) + { + var (typeStr, attrs) = ParseType(s); + + if (attrs.ContainsKey("group")) + { + throw new Exception("group为保留属性,只能用于table或var定义,是否用错? 如在excel中请使用&group=xxx"); + } + + if (attrs.ContainsKey("seq")) + { + throw new Exception("字段切割应该用'sep',而不是'seq',请检查是否拼写错误"); + } + + return (typeStr, attrs); + } + + public static bool ParseOrientation(string value) { switch (value.Trim()) {