diff --git a/src/PluginNodes/UserDefinedPluginNodes.cs b/src/PluginNodes/UserDefinedPluginNodes.cs index 623619f..8bf68ff 100644 --- a/src/PluginNodes/UserDefinedPluginNodes.cs +++ b/src/PluginNodes/UserDefinedPluginNodes.cs @@ -182,35 +182,15 @@ public void CreateBaseVariable(NodeState parent, ConfigNode node) _plcNodeManager.CreateBaseVariable(parent, node.NodeId, node.Name, new NodeId((uint)nodeDataType), node.ValueRank, accessLevel, node.Description, NamespaceType.OpcPlcApplications, node?.Value); } - private static object UpdateArrayValue(ConfigNode node, JArray jArrayValue) - { - object arrayValue = jArrayValue; - - if (node.DataType == "String") - { - arrayValue = jArrayValue.ToObject(); - } - - if (node.DataType == "Boolean") - { - arrayValue = jArrayValue.ToObject(); - } - - if (node.DataType == "Float") - { - arrayValue = jArrayValue.ToObject(); - } - - if (node.DataType == "UInt32") - { - arrayValue = jArrayValue.ToObject(); - } - - if (node.DataType == "Int32") - { - arrayValue = jArrayValue.ToObject(); - } - - return arrayValue; + private static object UpdateArrayValue(ConfigNode node, JArray jArrayValue) + { + return node.DataType switch { + "String" => jArrayValue.ToObject(), + "Boolean" => jArrayValue.ToObject(), + "Float" => jArrayValue.ToObject(), + "UInt32" => jArrayValue.ToObject(), + "Int32" => jArrayValue.ToObject(), + _ => throw new NotImplementedException($"Node type not implemented: {node.DataType}."), + }; } }