[change] DataUtil由GBK编码改为UTF8

main
walon 2023-06-23 12:21:24 +08:00
parent 803145e267
commit de075ca7d9
1 changed files with 9 additions and 9 deletions

View File

@ -30,7 +30,7 @@ namespace Luban.Job.Cfg.Utils
var values = SplitVectorString(x); var values = SplitVectorString(x);
if (values.Length != 2) if (values.Length != 2)
{ {
throw new Exception($"'{x}' 不是合法vector2类型数据"); 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])));
@ -41,7 +41,7 @@ namespace Luban.Job.Cfg.Utils
var values = SplitVectorString(x); var values = SplitVectorString(x);
if (values.Length != 3) if (values.Length != 3)
{ {
throw new Exception($"'{x}' 不是合法vector3类型数据"); 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])));
@ -52,7 +52,7 @@ namespace Luban.Job.Cfg.Utils
var values = SplitVectorString(x); var values = SplitVectorString(x);
if (values.Length != 4) if (values.Length != 4)
{ {
throw new Exception($"'{x}' 不是合法vector4类型数据"); 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])));
} }
@ -164,11 +164,11 @@ namespace Luban.Job.Cfg.Utils
{ {
if (key == null || text == null) if (key == null || text == null)
{ {
throw new Exception("text的key或text属性不能为null"); throw new Exception("text的key或text属性不能为null");
} }
if (key == "" && text != "") if (key == "" && text != "")
{ {
throw new Exception($"text key为空, 但text:'{text}'不为空"); throw new Exception($"text key为空, 但text:'{text}'不为空");
} }
} }
@ -244,16 +244,16 @@ namespace Luban.Job.Cfg.Utils
{ {
if (string.IsNullOrEmpty(subType)) if (string.IsNullOrEmpty(subType))
{ {
throw new Exception($"module:'{bean.Namespace}' 多态数据type不能为空"); throw new Exception($"module:'{bean.Namespace}' 多态数据type不能为空");
} }
DefBean defType = bean.GetHierarchyChildren().Cast<DefBean>().Where(c => c.Alias == subType || c.Name == subType || c.FullName == subType).FirstOrDefault(); DefBean defType = bean.GetHierarchyChildren().Cast<DefBean>().Where(c => c.Alias == subType || c.Name == subType || c.FullName == subType).FirstOrDefault();
if (defType == null) if (defType == null)
{ {
throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 不是合法类型"); throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 不是合法类型");
} }
if (defType.IsAbstractType) if (defType.IsAbstractType)
{ {
throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 是抽象类. 不能创建实例"); throw new Exception($"module:'{bean.Namespace}' type:'{subType}' 是抽象类. 不能创建实例");
} }
return defType; return defType;
} }
@ -271,7 +271,7 @@ namespace Luban.Job.Cfg.Utils
case "0": case "0":
case "n": case "n":
case "no": return false; case "no": return false;
default: throw new InvalidExcelDataException($"{s} 不是 bool 类型的值 (true|1|y|yes 或 false|0|n|no)"); default: throw new InvalidExcelDataException($"{s} 不是 bool 类型的值 (true|1|y|yes 或 false|0|n|no)");
} }
} }