Skip to content

Commit

Permalink
Bug fix to remove duplicates.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnstee committed Jan 16, 2025
1 parent 6572824 commit cd9577b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion I4AASNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,24 @@ public void SaveNodestateCollectionAsNodeSet2(string filePath, NodeStateCollecti

foreach (NodeState node in nodesToExport)
{
nodeSet.Export(SystemContext, node);
// make sure we don't add duplicates
bool alreadyExists = false;
if (nodeSet.Items != null)
{
foreach (UANode existingNode in nodeSet.Items)
{
if (existingNode.NodeId == node.NodeId.ToString().Replace("ns=2", "ns=1"))
{
alreadyExists = true;
break;
}
}
}

if (!alreadyExists)
{
nodeSet.Export(SystemContext, node);
}
}

nodeSet.Write(stream.BaseStream);
Expand Down

0 comments on commit cd9577b

Please sign in to comment.