Skip to content

Commit

Permalink
Change prefix char.
Browse files Browse the repository at this point in the history
  • Loading branch information
randy-armstrong committed Nov 2, 2024
1 parent dfb20ca commit 4405e37
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions Stack/Opc.Ua.Core/Types/Encoders/JsonDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ public Variant ReadVariant(string fieldName)
try
{
m_stack.Push(value);
BuiltInType builtInType = (value.ContainsKey("@Type"))? (BuiltInType)ReadByte("@Type") : (BuiltInType)ReadByte("Type");
BuiltInType builtInType = (value.ContainsKey("uaType"))? (BuiltInType)ReadByte("uaType") : (BuiltInType)ReadByte("Type");
return ReadVariantFromObject("Body", builtInType, value);
}
finally
Expand Down Expand Up @@ -1371,9 +1371,9 @@ public DataValue ReadDataValue(string fieldName)
{
m_stack.Push(value);

if (value.ContainsKey("@Type"))
if (value.ContainsKey("uaType"))
{
var builtInType = (BuiltInType)ReadByte("@Type");
var builtInType = (BuiltInType)ReadByte("uaType");
dv.WrappedValue = ReadVariantFromObject("Value", builtInType, value);
}
else
Expand Down Expand Up @@ -1418,7 +1418,7 @@ public ExtensionObject ReadExtensionObject(string fieldName)
m_stack.Push(value);

bool inlineValues = true;
ExpandedNodeId typeId = ReadExpandedNodeId("@TypeId");
ExpandedNodeId typeId = ReadExpandedNodeId("uaTypeId");

if (typeId == null)
{
Expand All @@ -1440,17 +1440,17 @@ public ExtensionObject ReadExtensionObject(string fieldName)
typeId = absoluteId;
}

byte encoding = ReadByte((inlineValues) ? "@Encoding" : "Encoding");
byte encoding = ReadByte((inlineValues) ? "uaEncoding" : "Encoding");

if (encoding == (byte)ExtensionObjectEncoding.Binary)
{
var bytes = ReadByteString((inlineValues) ? "@Body" : "Body");
var bytes = ReadByteString((inlineValues) ? "uaBody" : "Body");
return new ExtensionObject(typeId, bytes ?? Array.Empty<byte>());
}

if (encoding == (byte)ExtensionObjectEncoding.Xml)
{
var xml = ReadXmlElement((inlineValues) ? "@Body" : "Body");
var xml = ReadXmlElement((inlineValues) ? "uaBody" : "Body");
if (xml == null)
{
return extension;
Expand All @@ -1460,7 +1460,7 @@ public ExtensionObject ReadExtensionObject(string fieldName)

if (encoding == (byte)ExtensionObjectEncoding.Json)
{
var json = ReadString((inlineValues) ? "@Body" : "Body");
var json = ReadString((inlineValues) ? "uaBody" : "Body");
if (string.IsNullOrEmpty(json))
{
return extension;
Expand Down
14 changes: 7 additions & 7 deletions Stack/Opc.Ua.Core/Types/Encoders/JsonEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ public void WriteVariant(string fieldName, Variant value)
encodingByte = (byte)BuiltInType.Int32;
}

WriteByte((EncodingToUse != JsonEncodingType.Reversible) ? "@Type" : "Type", encodingByte);
WriteByte((EncodingToUse != JsonEncodingType.Reversible) ? "uaType" : "Type", encodingByte);
fieldName = "Body";
}

Expand Down Expand Up @@ -1533,7 +1533,7 @@ private void WriteVariantIntoObject(string fieldName, Variant value)
encodingByte = (byte)BuiltInType.Int32;
}

WriteByte("@Type", encodingByte);
WriteByte("uaType", encodingByte);
}

if (m_commaRequired)
Expand Down Expand Up @@ -1656,7 +1656,7 @@ public void WriteExtensionObject(string fieldName, ExtensionObject value)

if (EncodingToUse == JsonEncodingType.Compact)
{
WriteNodeId("@TypeId", localTypeId);
WriteNodeId("uaTypeId", localTypeId);

if (encodeable != null)
{
Expand All @@ -1671,13 +1671,13 @@ public void WriteExtensionObject(string fieldName, ExtensionObject value)
}
else if (value.Encoding == ExtensionObjectEncoding.Binary)
{
WriteByte("@Encoding", (byte)ExtensionObjectEncoding.Binary);
WriteByteString("@Body", value.Body as byte[]);
WriteByte("uaEncoding", (byte)ExtensionObjectEncoding.Binary);
WriteByteString("uaBody", value.Body as byte[]);
}
else if (value.Encoding == ExtensionObjectEncoding.Xml)
{
WriteByte("@Encoding",(byte)ExtensionObjectEncoding.Xml);
WriteXmlElement("@Body", value.Body as XmlElement);
WriteByte("uaEncoding",(byte)ExtensionObjectEncoding.Xml);
WriteXmlElement("uaBody", value.Body as XmlElement);
}
}

Expand Down

0 comments on commit 4405e37

Please sign in to comment.