using System; using System.Text; namespace System { /// Provides a custom constructor for uniform resource identifiers (URIs) and modifies URIs for the class. /// 2 // Token: 0x020002FD RID: 765 public class UriBuilder { /// Initializes a new instance of the class. // Token: 0x06001BB9 RID: 7097 RVA: 0x00067C4C File Offset: 0x00065E4C public UriBuilder() : this(global::System.Uri.UriSchemeHttp, "localhost") { } /// Initializes a new instance of the class with the specified URI. /// A URI string. /// /// is null. /// /// is a zero length string or contains only spaces.-or- The parsing routine detected a scheme in an invalid form.-or- The parser detected more than two consecutive slashes in a URI that does not use the "file" scheme.-or- is not a valid URI. // Token: 0x06001BBA RID: 7098 RVA: 0x00067C60 File Offset: 0x00065E60 public UriBuilder(string uri) : this(new global::System.Uri(uri)) { } /// Initializes a new instance of the class with the specified instance. /// An instance of the class. /// /// is null. // Token: 0x06001BBB RID: 7099 RVA: 0x00067C70 File Offset: 0x00065E70 public UriBuilder(global::System.Uri uri) { this.scheme = uri.Scheme; this.host = uri.Host; this.port = uri.Port; this.path = uri.AbsolutePath; this.query = uri.Query; this.fragment = uri.Fragment; this.username = uri.UserInfo; int num = this.username.IndexOf(':'); if (num != -1) { this.password = this.username.Substring(num + 1); this.username = this.username.Substring(0, num); } else { this.password = string.Empty; } this.modified = true; } /// Initializes a new instance of the class with the specified scheme and host. /// An Internet access protocol. /// A DNS-style domain name or IP address. // Token: 0x06001BBC RID: 7100 RVA: 0x00067D2C File Offset: 0x00065F2C public UriBuilder(string schemeName, string hostName) { this.Scheme = schemeName; this.Host = hostName; this.port = -1; this.Path = string.Empty; this.query = string.Empty; this.fragment = string.Empty; this.username = string.Empty; this.password = string.Empty; this.modified = true; } /// Initializes a new instance of the class with the specified scheme, host, and port. /// An Internet access protocol. /// A DNS-style domain name or IP address. /// An IP port number for the service. /// /// is less than 0 or greater than 65,535. // Token: 0x06001BBD RID: 7101 RVA: 0x00067D94 File Offset: 0x00065F94 public UriBuilder(string scheme, string host, int portNumber) : this(scheme, host) { this.Port = portNumber; } /// Initializes a new instance of the class with the specified scheme, host, port number, and path. /// An Internet access protocol. /// A DNS-style domain name or IP address. /// An IP port number for the service. /// The path to the Internet resource. /// /// is less than 0 or greater than 65,535. // Token: 0x06001BBE RID: 7102 RVA: 0x00067DA8 File Offset: 0x00065FA8 public UriBuilder(string scheme, string host, int port, string pathValue) : this(scheme, host, port) { this.Path = pathValue; } /// Initializes a new instance of the class with the specified scheme, host, port number, path and query string or fragment identifier. /// An Internet access protocol. /// A DNS-style domain name or IP address. /// An IP port number for the service. /// The path to the Internet resource. /// A query string or fragment identifier. /// /// is neither null nor , nor does a valid fragment identifier begin with a number sign (#), nor a valid query string begin with a question mark (?). /// /// is less than 0 or greater than 65,535. // Token: 0x06001BBF RID: 7103 RVA: 0x00067DBC File Offset: 0x00065FBC public UriBuilder(string scheme, string host, int port, string pathValue, string extraValue) : this(scheme, host, port, pathValue) { if (extraValue == null || extraValue.Length == 0) { return; } if (extraValue[0] == '#') { this.Fragment = extraValue.Remove(0, 1); } else { if (extraValue[0] != '?') { throw new ArgumentException("extraValue"); } this.Query = extraValue.Remove(0, 1); } } /// Gets or sets the fragment portion of the URI. /// The fragment portion of the URI. The fragment identifier ("#") is added to the beginning of the fragment. /// 2 // Token: 0x17000869 RID: 2153 // (get) Token: 0x06001BC0 RID: 7104 RVA: 0x00067E3C File Offset: 0x0006603C // (set) Token: 0x06001BC1 RID: 7105 RVA: 0x00067E44 File Offset: 0x00066044 public string Fragment { get { return this.fragment; } set { this.fragment = value; if (this.fragment == null) { this.fragment = string.Empty; } else if (this.fragment.Length > 0) { this.fragment = "#" + value.Replace("%23", "#"); } this.modified = true; } } /// Gets or sets the Domain Name System (DNS) host name or IP address of a server. /// The DNS host name or IP address of the server. /// 1 // Token: 0x1700086A RID: 2154 // (get) Token: 0x06001BC2 RID: 7106 RVA: 0x00067EAC File Offset: 0x000660AC // (set) Token: 0x06001BC3 RID: 7107 RVA: 0x00067EB4 File Offset: 0x000660B4 public string Host { get { return this.host; } set { this.host = ((value != null) ? value : string.Empty); this.modified = true; } } /// Gets or sets the password associated with the user that accesses the URI. /// The password of the user that accesses the URI. /// 1 // Token: 0x1700086B RID: 2155 // (get) Token: 0x06001BC4 RID: 7108 RVA: 0x00067ED4 File Offset: 0x000660D4 // (set) Token: 0x06001BC5 RID: 7109 RVA: 0x00067EDC File Offset: 0x000660DC public string Password { get { return this.password; } set { this.password = ((value != null) ? value : string.Empty); this.modified = true; } } /// Gets or sets the path to the resource referenced by the URI. /// The path to the resource referenced by the URI. /// 1 // Token: 0x1700086C RID: 2156 // (get) Token: 0x06001BC6 RID: 7110 RVA: 0x00067EFC File Offset: 0x000660FC // (set) Token: 0x06001BC7 RID: 7111 RVA: 0x00067F04 File Offset: 0x00066104 public string Path { get { return this.path; } set { if (value == null || value.Length == 0) { this.path = "/"; } else { this.path = global::System.Uri.EscapeString(value.Replace('\\', '/'), false, true, true); } this.modified = true; } } /// Gets or sets the port number of the URI. /// The port number of the URI. /// The port cannot be set to a value less than 0 or greater than 65,535. /// 1 // Token: 0x1700086D RID: 2157 // (get) Token: 0x06001BC8 RID: 7112 RVA: 0x00067F54 File Offset: 0x00066154 // (set) Token: 0x06001BC9 RID: 7113 RVA: 0x00067F5C File Offset: 0x0006615C public int Port { get { return this.port; } set { if (value < -1) { throw new ArgumentOutOfRangeException("value"); } this.port = value; this.modified = true; } } /// Gets or sets any query information included in the URI. /// The query information included in the URI. /// 1 // Token: 0x1700086E RID: 2158 // (get) Token: 0x06001BCA RID: 7114 RVA: 0x00067F8C File Offset: 0x0006618C // (set) Token: 0x06001BCB RID: 7115 RVA: 0x00067F94 File Offset: 0x00066194 public string Query { get { return this.query; } set { if (value == null || value.Length == 0) { this.query = string.Empty; } else { this.query = "?" + value; } this.modified = true; } } /// Gets or sets the scheme name of the URI. /// The scheme of the URI. /// The scheme cannot be set to an invalid scheme name. /// 1 // Token: 0x1700086F RID: 2159 // (get) Token: 0x06001BCC RID: 7116 RVA: 0x00067FD0 File Offset: 0x000661D0 // (set) Token: 0x06001BCD RID: 7117 RVA: 0x00067FD8 File Offset: 0x000661D8 public string Scheme { get { return this.scheme; } set { if (value == null) { value = string.Empty; } int num = value.IndexOf(':'); if (num != -1) { value = value.Substring(0, num); } this.scheme = value.ToLower(); this.modified = true; } } /// Gets the instance constructed by the specified instance. /// A that contains the URI constructed by the . /// The URI constructed by the properties is invalid. /// 1 // Token: 0x17000870 RID: 2160 // (get) Token: 0x06001BCE RID: 7118 RVA: 0x00068020 File Offset: 0x00066220 public global::System.Uri Uri { get { if (!this.modified) { return this.uri; } this.uri = new global::System.Uri(this.ToString(), true); this.modified = false; return this.uri; } } /// The user name associated with the user that accesses the URI. /// The user name of the user that accesses the URI. /// 1 // Token: 0x17000871 RID: 2161 // (get) Token: 0x06001BCF RID: 7119 RVA: 0x00068054 File Offset: 0x00066254 // (set) Token: 0x06001BD0 RID: 7120 RVA: 0x0006805C File Offset: 0x0006625C public string UserName { get { return this.username; } set { this.username = ((value != null) ? value : string.Empty); this.modified = true; } } /// Compares an existing instance with the contents of the for equality. /// true if represents the same as the constructed by this instance; otherwise, false. /// The object to compare with the current instance. /// 2 // Token: 0x06001BD1 RID: 7121 RVA: 0x0006807C File Offset: 0x0006627C public override bool Equals(object rparam) { return rparam != null && this.Uri.Equals(rparam.ToString()); } /// Returns the hash code for the URI. /// The hash code generated for the URI. /// 2 /// /// /// // Token: 0x06001BD2 RID: 7122 RVA: 0x0006809C File Offset: 0x0006629C public override int GetHashCode() { return this.Uri.GetHashCode(); } /// Returns the display string for the specified instance. /// The string that contains the unescaped display string of the . /// 1 /// /// /// // Token: 0x06001BD3 RID: 7123 RVA: 0x000680AC File Offset: 0x000662AC public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(this.scheme); stringBuilder.Append("://"); if (this.username != string.Empty) { stringBuilder.Append(this.username); if (this.password != string.Empty) { stringBuilder.Append(":" + this.password); } stringBuilder.Append('@'); } stringBuilder.Append(this.host); if (this.port > 0) { stringBuilder.Append(":" + this.port); } if (this.path != string.Empty && stringBuilder[stringBuilder.Length - 1] != '/' && this.path.Length > 0 && this.path[0] != '/') { stringBuilder.Append('/'); } stringBuilder.Append(this.path); stringBuilder.Append(this.query); stringBuilder.Append(this.fragment); return stringBuilder.ToString(); } // Token: 0x04001610 RID: 5648 private string scheme; // Token: 0x04001611 RID: 5649 private string host; // Token: 0x04001612 RID: 5650 private int port; // Token: 0x04001613 RID: 5651 private string path; // Token: 0x04001614 RID: 5652 private string query; // Token: 0x04001615 RID: 5653 private string fragment; // Token: 0x04001616 RID: 5654 private string username; // Token: 0x04001617 RID: 5655 private string password; // Token: 0x04001618 RID: 5656 private global::System.Uri uri; // Token: 0x04001619 RID: 5657 private bool modified; } }