Skip to content

Commit 5565593

Browse files
Allow ValueRank of -2 to be added to Aml file (#123)
1 parent 74900a6 commit 5565593

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

NodeSetToAML.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
using UAObject = MarkdownProcessor.NodeSet.UAObject;
4242
using UAType = MarkdownProcessor.NodeSet.UAType;
4343
using UAVariable = MarkdownProcessor.NodeSet.UAVariable;
44+
using UAVariableType = MarkdownProcessor.NodeSet.UAVariableType;
4445
using DataTypeField = MarkdownProcessor.NodeSet.DataTypeField;
4546
using Aml.Engine.Adapter;
4647
using System.Xml.Linq;
@@ -53,7 +54,6 @@
5354
using System.Reflection;
5455
using System.Xml;
5556
using Opc2Aml;
56-
using Newtonsoft.Json.Linq;
5757

5858

5959
namespace MarkdownProcessor
@@ -604,6 +604,15 @@ private void AddBaseNodeClassAttributes( AttributeSequence seq, UANode uanode)
604604
{
605605
AddModifyAttribute(seq, "IsAbstract", "Boolean", uaType.IsAbstract);
606606
}
607+
608+
UAVariableType uaVariableType = uanode as UAVariableType;
609+
if (uaVariableType != null)
610+
{
611+
if (uaVariableType.ValueRank != -1)
612+
{
613+
AddModifyAttribute(seq, "ValueRank", "Int32", uaVariableType.ValueRank);
614+
}
615+
}
607616
}
608617

609618
private void BuildLocalizedTextAttribute(
@@ -714,8 +723,6 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str
714723
{
715724
if (bListOf == false && val.TypeInfo != null) // look for reasons not to add the attribute because missing == default value
716725
{
717-
if (name == "ValueRank" && val == -2 )
718-
return null;
719726
if (name == "IsSource" && val == false)
720727
return null;
721728
if (name == "Symmetric" && val == false)

SystemTest/TestAttributes.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public class TestAttributes
4343
[DataRow("IsAbstract", "2881", "false",
4444
true, true, DisplayName = "AcknowledgeableConditionType should not be Abstract")]
4545

46+
[DataRow("ValueRank", "62", "-2",
47+
true, true, DisplayName = "BaseVariableType ValueRank -2")]
48+
[DataRow("ValueRank", "58", "",
49+
false, true, DisplayName = "BaseObjectType No ValueRank")]
50+
[DataRow("ValueRank", "18773", "-1",
51+
true, true, DisplayName = "CartesianCoordinates LengthUnit ValueRank -1")]
52+
4653
public void TestAttribute(string attribute, string nodeId,
4754
string expected, bool expectedToBeFound, bool foundationRoot = false)
4855
{

0 commit comments

Comments
 (0)