/// <summary>parses an iiop-addr string</summary> private void ParseIiopAddr(string iiopAddr, int protocolPrefixLength) { // version part int hostIndex; int atIndex = iiopAddr.IndexOf('@', protocolPrefixLength); if (atIndex >= 0) { // version spec string versionPart = iiopAddr.Substring(protocolPrefixLength, atIndex - protocolPrefixLength); string[] versionParts = versionPart.Split(new char[] { '.' }, 2); try { byte major = System.Byte.Parse(versionParts[0]); if (versionParts.Length != 2) { throw new BAD_PARAM(9, CompletionStatus.Completed_No); } byte minor = System.Byte.Parse(versionParts[1]); m_version = new GiopVersion(major, minor); } catch (Exception) { throw new BAD_PARAM(9, CompletionStatus.Completed_No); } hostIndex = atIndex + 1; } else { m_version = new GiopVersion(1, 0); // default hostIndex = protocolPrefixLength; } // host, port part int commaIndex = iiopAddr.IndexOf(':', hostIndex); if (commaIndex >= 0) { m_host = iiopAddr.Substring(hostIndex, commaIndex - hostIndex); try { m_port = System.Int32.Parse(iiopAddr.Substring(commaIndex + 1)); } catch (Exception) { throw new BAD_PARAM(9, CompletionStatus.Completed_No); } } else { m_host = iiopAddr.Substring(hostIndex); } if (StringConversions.IsBlank(m_host)) { m_host = "localhost"; } }
/// <summary> /// maps a CLS namespace to a module hirarchy /// </summary> // used for generator public static string[] MapNamespaceNameToIdlModules(string clsNamespace) { string[] modules; if ((clsNamespace != null) && !StringConversions.IsBlank(clsNamespace)) { modules = clsNamespace.Split('.'); } else { modules = new string[0]; } for (int i = 0; i < modules.Length; i++) { modules[i] = MapClsNameToIdlName(modules[i]); } return(modules); }