// Token: 0x0600002C RID: 44 RVA: 0x00002E14 File Offset: 0x00001E14 protected void SetUrl(URL url) { if (url == null) { throw new ArgumentNullException("url"); } if (this.m_server != null) { throw new AlreadyConnectedException(); } this.m_url = (URL)url.Clone(); string text = ""; if (this.m_url.HostName != null) { text = this.m_url.HostName.ToLower(); if (text == "localhost" || text == "127.0.0.1") { text = ""; } } if (this.m_url.Port != 0) { text += string.Format(".{0}", this.m_url.Port); } if (text != "") { text += "."; } if (this.m_url.Scheme != "http") { string text2 = this.m_url.Path; int num = text2.LastIndexOf('/'); if (num != -1) { text2 = text2.Substring(0, num); } text += text2; } else { string text3 = this.m_url.Path; int num2 = text3.LastIndexOf('.'); if (num2 != -1) { text3 = text3.Substring(0, num2); } while (text3.IndexOf('/') != -1) { text3 = text3.Replace('/', '-'); } text += text3; } this.m_name = text; }
/// <summary> /// Updates the URL for the server. /// </summary> protected void SetUrl(URL url) { if (url == null) { throw new ArgumentNullException("url"); } // cannot change the URL if the remote server is already instantiated. if (m_server != null) { throw new AlreadyConnectedException(); } // copy the url. m_url = (URL)url.Clone(); // construct a name for the server. string name = ""; // use the host name as a base. if (m_url.HostName != null) { name = m_url.HostName.ToLower(); // suppress localhoat and loopback as explicit hostnames. if (name == "localhost" || name == "127.0.0.1") { name = ""; } } // append the port. if (m_url.Port != 0) { name += String.Format(".{0}", m_url.Port); } // add a separator. if (name != "") { name += "."; } // use the prog id as the name. if (m_url.Scheme != UrlScheme.HTTP) { string progID = m_url.Path; int index = progID.LastIndexOf('/'); if (index != -1) { progID = progID.Substring(0, index); } name += progID; } // use full path without the extension as the name. else { string path = m_url.Path; // strip the file extension. int index = path.LastIndexOf('.'); if (index != -1) { path = path.Substring(0, index); } // replace slashes with dashes. while (path.IndexOf('/') != -1) { path = path.Replace('/', '-'); } name += path; } // save the generated name. m_name = name; }