From fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 17:59:45 +0800
Subject: [PATCH] feat: 集成CAN驱动/模拟器 + 仪器仪表注册/硬件调试模块
---
SimpleUtil/HMI.Simple.Util/ParameterUtil.cs | 73 +++++++++++++++++++++++++++++++-----
1 files changed, 62 insertions(+), 11 deletions(-)
diff --git a/SimpleUtil/HMI.Simple.Util/ParameterUtil.cs b/SimpleUtil/HMI.Simple.Util/ParameterUtil.cs
index ae461c2..8e1054e 100644
--- a/SimpleUtil/HMI.Simple.Util/ParameterUtil.cs
+++ b/SimpleUtil/HMI.Simple.Util/ParameterUtil.cs
@@ -59,21 +59,72 @@
private static void WriteParameterData(SequenceContext context, ParameterData data)
{
string prefix = "SystemSetting";
- if (data.Type == "Bool")
+
+ if (data.IsArray)
{
- context.StationGlobals.SetValBoolean($"{prefix}.{data.Name}", 1, bool.Parse(data.Value));
- }
- else if (data.Type == "Int")
- {
- context.StationGlobals.SetValNumber($"{prefix}.{data.Name}", 1, int.Parse(data.Value));
- }
- else if (data.Type == "Double")
- {
- context.StationGlobals.SetValNumber($"{prefix}.{data.Name}", 1, double.Parse(data.Value));
+ PropertyValueTypes type;
+ if (data.Type == "Bool")
+ {
+ type = PropertyValueTypes.PropValType_Boolean;
+ }
+ else if (data.Type == "Int")
+ {
+ type = PropertyValueTypes.PropValType_Number;
+ }
+ else if (data.Type == "Double")
+ {
+ type = PropertyValueTypes.PropValType_Number;
+ }
+ else
+ {
+ type = PropertyValueTypes.PropValType_String;
+ }
+ string[] arr = data.Value?.Split(',') ?? new string[0];
+ if (arr.Length > 0)
+ {
+ context.StationGlobals.DeleteSubProperty($"{prefix}.{data.Name}", 2);
+
+ context.StationGlobals.NewSubProperty($"{prefix}.{data.Name}", type, true, null, 1);
+ context.StationGlobals.GetPropertyObject($"{prefix}.{data.Name}", 0).SetNumElements(arr.Length);
+ for (int i = 0; i < arr.Length; i++)
+ {
+ if (type == PropertyValueTypes.PropValType_String)
+ {
+ context.StationGlobals.SetValString($"{prefix}.{data.Name}[{i}]", 0, arr[i]);
+ }
+ if (data.Type == "Int")
+ {
+ context.StationGlobals.SetValNumber($"{prefix}.{data.Name}[{i}]", 0, int.Parse(arr[i]));
+ }
+ if (data.Type == "Double")
+ {
+ context.StationGlobals.SetValNumber($"{prefix}.{data.Name}[{i}]", 0, double.Parse(arr[i]));
+ }
+ if (data.Type == "Bool")
+ {
+ context.StationGlobals.SetValBoolean($"{prefix}.{data.Name}[{i}]", 0, bool.Parse(arr[i]));
+ }
+ }
+ }
}
else
{
- context.StationGlobals.SetValString($"{prefix}.{data.Name}", 1, data.Value);
+ if (data.Type == "Bool")
+ {
+ context.StationGlobals.SetValBoolean($"{prefix}.{data.Name}", 1, bool.Parse(data.Value));
+ }
+ else if (data.Type == "Int")
+ {
+ context.StationGlobals.SetValNumber($"{prefix}.{data.Name}", 1, int.Parse(data.Value));
+ }
+ else if (data.Type == "Double")
+ {
+ context.StationGlobals.SetValNumber($"{prefix}.{data.Name}", 1, double.Parse(data.Value));
+ }
+ else
+ {
+ context.StationGlobals.SetValString($"{prefix}.{data.Name}", 1, data.Value);
+ }
}
}
--
Gitblit v1.9.1