From 142e3ddf935a32a46d40f175c5e95b234cc714ca Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 30 Mar 2022 17:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=BD=93=E5=AD=98=E5=9C=A8namespace=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99=E4=B8=8D=E5=90=8C=E7=9A=84=E7=B1=BB=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=8F=8D=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=88=A0=E9=99=A4=E7=94=9F=E6=88=90=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=96=87=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Defs/DefAssemblyBase.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs index b8fd41a..233a692 100644 --- a/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs +++ b/src/Luban.Job.Common/Source/Defs/DefAssemblyBase.cs @@ -34,7 +34,11 @@ namespace Luban.Job.Common.Defs public Dictionary Types { get; } = new Dictionary(); - private readonly Dictionary _notCaseSenceTypes = new (); + private readonly Dictionary _notCaseSenseTypes = new (); + + private readonly HashSet _namespaces = new(); + + private readonly Dictionary _notCaseSenseNamespaces = new(); public IAgent Agent { get; protected set; } @@ -178,10 +182,17 @@ namespace Luban.Job.Common.Defs throw new Exception($"type:'{fullName}' duplicate"); } - if (!_notCaseSenceTypes.TryAdd(fullName.ToLower(), type)) + if (!_notCaseSenseTypes.TryAdd(fullName.ToLower(), type)) { - throw new Exception($"type:'{fullName}' 和 type:'{_notCaseSenceTypes[fullName.ToLower()].FullName}' 类名小写重复. 在win平台有问题"); + throw new Exception($"type:'{fullName}' 和 type:'{_notCaseSenseTypes[fullName.ToLower()].FullName}' 类名小写重复. 在win平台有问题"); } + + string namespaze = type.Namespace; + if (_namespaces.Add(namespaze) && !_notCaseSenseNamespaces.TryAdd(namespaze.ToLower(), type)) + { + throw new Exception($"type:'{fullName}' 和 type:'{_notCaseSenseNamespaces[namespaze.ToLower()].FullName}' 命名空间小写重复. 在win平台有问题,请修改定义并删除生成的代码目录后再重新生成"); + } + Types.Add(fullName, type); }