From 13ee28835a182f54613f203b338d01382897ac99 Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 16 Feb 2022 20:43:19 +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=E8=AF=BB=E5=8F=96vector2,3,4=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E6=9C=AA=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=87=E5=A4=9A=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BE=8B=E5=A6=82=20vector2=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=A1=AB=E4=BA=86'1,2,4'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/DataCreators/SheetDataCreator.cs | 5 +---- src/Luban.Job.Cfg/Source/Utils/DataUtil.cs | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Luban.Job.Cfg/Source/DataCreators/SheetDataCreator.cs b/src/Luban.Job.Cfg/Source/DataCreators/SheetDataCreator.cs index 6940319..f8f1dad 100644 --- a/src/Luban.Job.Cfg/Source/DataCreators/SheetDataCreator.cs +++ b/src/Luban.Job.Cfg/Source/DataCreators/SheetDataCreator.cs @@ -251,14 +251,11 @@ namespace Luban.Job.Cfg.DataCreators public DType Accept(TBytes type, Sheet sheet, TitleRow row) { - throw new NotImplementedException(); + throw new NotSupportedException(); } public DType Accept(TText type, Sheet sheet, TitleRow row) { - //var s = row.AsStream(row.SelfTitle.Sep); - //return type.Apply(ExcelStreamDataCreator.Ins, s); - if (string.IsNullOrEmpty(row.SelfTitle.SepOr(type.GetTag("sep")))) { if (row.CellCount != 2) diff --git a/src/Luban.Job.Cfg/Source/Utils/DataUtil.cs b/src/Luban.Job.Cfg/Source/Utils/DataUtil.cs index af15d54..0303dff 100644 --- a/src/Luban.Job.Cfg/Source/Utils/DataUtil.cs +++ b/src/Luban.Job.Cfg/Source/Utils/DataUtil.cs @@ -26,7 +26,10 @@ namespace Luban.Job.Cfg.Utils public static DType CreateVector(TVector2 type, string x) { var values = SplitVectorString(x); - + if (values.Length != 2) + { + throw new Exception($"'{x}' 不是合法vector2类型数据"); + } return new DVector2(new System.Numerics.Vector2(float.Parse(values[0]), float.Parse(values[1]))); } @@ -34,7 +37,10 @@ namespace Luban.Job.Cfg.Utils public static DType CreateVector(TVector3 type, string x) { var values = SplitVectorString(x); - + if (values.Length != 3) + { + throw new Exception($"'{x}' 不是合法vector3类型数据"); + } return new DVector3(new System.Numerics.Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]))); } @@ -42,9 +48,19 @@ namespace Luban.Job.Cfg.Utils public static DType CreateVector(TVector4 type, string x) { var values = SplitVectorString(x); + if (values.Length != 4) + { + throw new Exception($"'{x}' 不是合法vector4类型数据"); + } return new DVector4(new System.Numerics.Vector4(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]), float.Parse(values[3]))); } + public static DType CreateBytes(string x) + { + string[] ss = SplitVectorString(x); + return new DBytes(ss.Select(s => byte.Parse(s)).ToArray()); + } + //public static DDateTime CreateDateTime(string x, TimeZoneInfo timeZoneInfo) //{