/// <summary> /// Writes the collection to a stream using the Opc.Ua.Schema.UANodeSet schema. /// </summary> public void SaveAsNodeSet2(ISystemContext context, Stream ostrm, Export.ModelTableEntry model, DateTime lastModified) { Opc.Ua.Export.UANodeSet nodeSet = new Opc.Ua.Export.UANodeSet(); if (lastModified != DateTime.MinValue) { nodeSet.LastModified = lastModified; nodeSet.LastModifiedSpecified = true; } if (model != null) { nodeSet.Models = new Export.ModelTableEntry[] { model }; } for (int ii = 0; ii < s_AliasesToUse.Length; ii++) { nodeSet.AddAlias(context, s_AliasesToUse[ii].Alias, s_AliasesToUse[ii].NodeId); } for (int ii = 0; ii < this.Count; ii++) { nodeSet.Export(context, this[ii]); } nodeSet.Write(ostrm); }
/// <summary> /// Writes the collection to a stream using the Opc.Ua.Schema.UANodeSet schema. /// </summary> public void SaveAsNodeSet2(ISystemContext context, Stream ostrm, string version, bool filterSingleNodeIds) { Opc.Ua.Export.UANodeSet nodeSet = new Opc.Ua.Export.UANodeSet(); nodeSet.LastModified = DateTime.UtcNow; nodeSet.LastModifiedSpecified = true; for (int ii = 0; ii < s_AliasesToUse.Length; ii++) { nodeSet.AddAlias(context, s_AliasesToUse[ii].Alias, s_AliasesToUse[ii].NodeId); } for (int ii = 0; ii < this.Count; ii++) { nodeSet.Export(context, this[ii]); } /* * if (true) * { * var txt = new System.IO.StreamWriter("nodes.txt"); * foreach (var x in nodeSet.Items) * txt.WriteLine(x.NodeId); * txt.Close(); * } */ if (filterSingleNodeIds) { // MIHO: There might be DOUBLE nodeIds in the the set!!!!!!!!!! WTF!!!!!!!!!!!!! // Brutally eliminate them var nodup = new List <Export.UANode>(); foreach (var it in nodeSet.Items) { var found = false; foreach (var it2 in nodup) { if (it.NodeId == it2.NodeId) { found = true; } } if (found) { continue; } nodup.Add(it); } nodeSet.Items = nodup.ToArray(); } nodeSet.Write(ostrm); }
/// <summary> /// Writes the collection to a stream using the Opc.Ua.Schema.UANodeSet schema. /// </summary> public void SaveAsNodeSet2(ISystemContext context, Stream ostrm, string version) { Opc.Ua.Export.UANodeSet nodeSet = new Opc.Ua.Export.UANodeSet(); nodeSet.LastModified = DateTime.UtcNow; nodeSet.LastModifiedSpecified = true; for (int ii = 0; ii < s_AliasesToUse.Length; ii++) { nodeSet.AddAlias(context, s_AliasesToUse[ii].Alias, s_AliasesToUse[ii].NodeId); } for (int ii = 0; ii < this.Count; ii++) { nodeSet.Export(context, this[ii], true); } nodeSet.Write(ostrm); }
/// <summary> /// Writes the collection to a stream using the Opc.Ua.Schema.UANodeSet schema. /// </summary> public void SaveAsNodeSet2( ISystemContext context, Stream ostrm, Export.ModelTableEntry model, DateTime lastModified, bool outputRedundantNames) { Opc.Ua.Export.UANodeSet nodeSet = new Opc.Ua.Export.UANodeSet(); if (lastModified != DateTime.MinValue) { nodeSet.LastModified = lastModified; nodeSet.LastModifiedSpecified = true; } nodeSet.NamespaceUris = (context.NamespaceUris != null) ? context.NamespaceUris.ToArray().Where(x => x != Namespaces.OpcUa).ToArray() : null; nodeSet.ServerUris = (context.ServerUris != null) ? context.ServerUris.ToArray() : null; if (nodeSet.NamespaceUris != null && nodeSet.NamespaceUris.Length == 0) { nodeSet.NamespaceUris = null; } if (nodeSet.ServerUris != null && nodeSet.ServerUris.Length == 0) { nodeSet.ServerUris = null; } if (model != null) { nodeSet.Models = new Export.ModelTableEntry[] { model }; } for (int ii = 0; ii < s_AliasesToUse.Length; ii++) { nodeSet.AddAlias(context, s_AliasesToUse[ii].Alias, s_AliasesToUse[ii].NodeId); } for (int ii = 0; ii < this.Count; ii++) { nodeSet.Export(context, this[ii], outputRedundantNames); } nodeSet.Write(ostrm); }