【修复】修复读取vector2,3,4类型数据时,未检查数据过多的问题,例如 vector2类型填了'1,2,4'
parent
b2014ab7bb
commit
13ee28835a
|
|
@ -251,14 +251,11 @@ namespace Luban.Job.Cfg.DataCreators
|
||||||
|
|
||||||
public DType Accept(TBytes type, Sheet sheet, TitleRow row)
|
public DType Accept(TBytes type, Sheet sheet, TitleRow row)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DType Accept(TText type, Sheet sheet, TitleRow row)
|
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 (string.IsNullOrEmpty(row.SelfTitle.SepOr(type.GetTag("sep"))))
|
||||||
{
|
{
|
||||||
if (row.CellCount != 2)
|
if (row.CellCount != 2)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,10 @@ namespace Luban.Job.Cfg.Utils
|
||||||
public static DType CreateVector(TVector2 type, string x)
|
public static DType CreateVector(TVector2 type, string x)
|
||||||
{
|
{
|
||||||
var values = SplitVectorString(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])));
|
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)
|
public static DType CreateVector(TVector3 type, string x)
|
||||||
{
|
{
|
||||||
var values = SplitVectorString(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])));
|
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)
|
public static DType CreateVector(TVector4 type, string x)
|
||||||
{
|
{
|
||||||
var values = SplitVectorString(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])));
|
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)
|
//public static DDateTime CreateDateTime(string x, TimeZoneInfo timeZoneInfo)
|
||||||
//{
|
//{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue