/// <summary> /// Exports a server index. /// </summary> private uint ImportServerIndex(uint serverIndex, StringTable serverUris) { // nothing special required for indexes 0. if (serverIndex <= 0) { return serverIndex; } // return a bad value if parameters are bad. if (serverUris == null || this.ServerUris == null || this.ServerUris.Length <= serverIndex - 1) { return UInt16.MaxValue; } // find or append uri. return serverUris.GetIndexOrAppend(this.ServerUris[serverIndex - 1]); }
/// <summary> /// Initializes the mapper. /// </summary> /// <param name="localNamespaceUris"></param> /// <param name="remoteNamespaceUris"></param> public void Initialize(StringTable localNamespaceUris, StringTable remoteNamespaceUris, string applicationUri) { m_localNamespaceIndexes = new int[remoteNamespaceUris.Count]; for (int ii = 1; ii < remoteNamespaceUris.Count; ii++) { string namespaceUri = remoteNamespaceUris.GetString((uint)ii); bool isTypeSystemUri = false; if (TypeSystemNamespaceUris != null) { for (int jj = 0; jj < TypeSystemNamespaceUris.Length; jj++) { if (TypeSystemNamespaceUris[jj] == namespaceUri) { isTypeSystemUri = true; break; } } } if (!isTypeSystemUri) { namespaceUri = applicationUri + ":" + namespaceUri; } m_localNamespaceIndexes[ii] = localNamespaceUris.GetIndexOrAppend(namespaceUri); } m_remoteNamespaceIndexes = new int[localNamespaceUris.Count]; for (int ii = 0; ii < m_localNamespaceIndexes.Length; ii++) { if (m_remoteNamespaceIndexes.Length > m_localNamespaceIndexes[ii]) { m_remoteNamespaceIndexes[m_localNamespaceIndexes[ii]] = ii; } } }