diff --git a/I4AASNodeManager.cs b/I4AASNodeManager.cs index 2ee83d2..489e71f 100644 --- a/I4AASNodeManager.cs +++ b/I4AASNodeManager.cs @@ -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);