Skip to content

Commit

Permalink
Updates for REST prototype.
Browse files Browse the repository at this point in the history
  • Loading branch information
randy-armstrong committed Jan 18, 2024
1 parent 1639190 commit 6c02c35
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Stack/Opc.Ua.Core/Stack/Client/UserIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public string PolicyId
/// <summary cref="IUserIdentity.DisplayName" />
public string DisplayName
{
get { return m_displayName; }
get { return m_displayName; } set { m_displayName = value; }
}

/// <summary cref="IUserIdentity.TokenType" />
Expand Down
28 changes: 28 additions & 0 deletions Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Reflection;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Serialization;

namespace Opc.Ua
{
Expand Down Expand Up @@ -181,6 +182,33 @@ public void SaveAsNodeSet2(ISystemContext context, Stream ostrm, string version)
nodeSet.Write(ostrm);
}

private static T Load<T>(Stream istrm)
{
var settings = new XmlReaderSettings() {
DtdProcessing = DtdProcessing.Prohibit
};

Check warning on line 189 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L187-L189

Added lines #L187 - L189 were not covered by tests

XmlSerializer serializer = new XmlSerializer(typeof(T));

Check warning on line 191 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L191

Added line #L191 was not covered by tests

using (var reader = XmlReader.Create(istrm, settings))

Check warning on line 193 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L193

Added line #L193 was not covered by tests
{
return (T)serializer.Deserialize(reader);

Check warning on line 195 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L195

Added line #L195 was not covered by tests
}
}

Check warning on line 197 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L197

Added line #L197 was not covered by tests

/// <summary>
/// Loads a NodeSet2 into a NodeStateCollection.
/// </summary>
public static NodeStateCollection LoadAsNodeSet2(ISystemContext context, Stream istrm)
{
Opc.Ua.Export.UANodeSet nodeSet = Load<Opc.Ua.Export.UANodeSet>(istrm);

Check warning on line 204 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L204

Added line #L204 was not covered by tests

NodeStateCollection nodes = new NodeStateCollection();
nodeSet.Import(context, nodes);

Check warning on line 207 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L206-L207

Added lines #L206 - L207 were not covered by tests

return nodes;

Check warning on line 209 in Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs

View check run for this annotation

Codecov / codecov/patch

Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs#L209

Added line #L209 was not covered by tests
}

/// <summary>
/// Writes the schema information to a static XML export file.
/// </summary>
Expand Down

0 comments on commit 6c02c35

Please sign in to comment.