/// <summary> /// Reads an ExpandedNodeId from the stream. /// </summary> public ExpandedNodeId ReadExpandedNodeId(string fieldName) { ExpandedNodeId value = new ExpandedNodeId(); if (BeginField(fieldName, true)) { PushNamespace(Namespaces.OpcUaXsd); value.IdentifierText = ReadString("Identifier"); PopNamespace(); EndField(fieldName); } if (m_namespaceMappings != null && m_namespaceMappings.Length > value.NamespaceIndex) { value.SetNamespaceIndex(m_namespaceMappings[value.NamespaceIndex]); } if (m_serverMappings != null && m_serverMappings.Length > value.ServerIndex) { value.SetServerIndex(m_serverMappings[value.NamespaceIndex]); } return value; }
/// <summary> /// Reads an ExpandedNodeId from the stream. /// </summary> public ExpandedNodeId ReadExpandedNodeId(string fieldName) { byte encodingByte = m_reader.ReadByte(); ExpandedNodeId value = new ExpandedNodeId(); NodeId body = new NodeId(); ReadNodeIdBody(encodingByte, body); value.InnerNodeId = body; string namespaceUri = null; uint serverIndex = 0; // read the namespace uri if present. if ((encodingByte & 0x80) != 0) { namespaceUri = ReadString(null); value.SetNamespaceUri(namespaceUri); } // read the server index if present. if ((encodingByte & 0x40) != 0) { serverIndex = ReadUInt32(null); value.SetServerIndex(serverIndex); } if (m_namespaceMappings != null && m_namespaceMappings.Length > value.NamespaceIndex) { value.SetNamespaceIndex(m_namespaceMappings[value.NamespaceIndex]); } if (m_serverMappings != null && m_serverMappings.Length > value.ServerIndex) { value.SetServerIndex(m_serverMappings[value.NamespaceIndex]); } return value; }