コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }