C# Class OpenStack.Net.UriUtility

Provides static utility methods for encoding and decoding text within RFC 3986 URIs.
Show file Open project: crowdy/OpenStack-ConoHa

Public Methods

Method Description
AddQueryParameter ( Uri uri, string parameter, string value ) : Uri

Add a query parameter with the specified name and value to a URI.

This method always adds a new query parameter to the end of the query string, even if the URI already contains one or more query parameters with the specified parameter name.

If necessary, characters in the parameter name are percent-encoded to conform to the requirements of a varname defined by RFC 6570.

RemoveQueryParameter ( Uri uri, string parameter ) : Uri

Remove all query parameters matching a particular parameter name from a URI.

This method handles percent-encoded octets as UTF-8 encoded characters in both the parameter argument and the query string.

SetQueryParameter ( Uri uri, string parameter, string value ) : Uri

Sets a URI query parameter to a specific value, adding or replacing the existing value as appropriate.

This method is a convenience method for calling RemoveQueryParameter followed by AddQueryParameter.

UriDecode ( string text ) : string

Decodes the text of a URI by unescaping any percent-encoded character sequences and then evaluating the result using the default Encoding.UTF8 encoding.

This method calls UriDecode(string, Encoding) using the default Encoding.UTF8 encoding.

UriDecode ( string text, System.Text.Encoding encoding ) : string

Decodes the text of a URI by unescaping any percent-encoded character sequences and then evaluating the result using the specified encoding.

UriEncode ( string text, UriPart uriPart ) : string

Encodes text for inclusion in a URI using the Encoding.UTF8 encoding.

This method calls UriEncode(string, UriPart, Encoding) using the default Encoding.UTF8 encoding.

UriEncode ( string text, UriPart uriPart, System.Text.Encoding encoding ) : string

Encodes text for inclusion in a URI.

Private Methods

Method Description
UriEncodeAny ( string text, System.Text.Encoding encoding ) : string
UriEncodeAnyUrl ( string text, System.Text.Encoding encoding ) : string
UriEncodeFragment ( string text, System.Text.Encoding encoding ) : string
UriEncodeHost ( string text, System.Text.Encoding encoding ) : string
UriEncodePath ( string text, System.Text.Encoding encoding ) : string
UriEncodePathSegment ( string text, System.Text.Encoding encoding ) : string
UriEncodeQuery ( string text, System.Text.Encoding encoding ) : string
UriEncodeQueryValue ( string text, System.Text.Encoding encoding ) : string
UriUtility ( ) : System

Method Details

AddQueryParameter() public static method

Add a query parameter with the specified name and value to a URI.

This method always adds a new query parameter to the end of the query string, even if the URI already contains one or more query parameters with the specified parameter name.

If necessary, characters in the parameter name are percent-encoded to conform to the requirements of a varname defined by RFC 6570.

/// If is . /// -or- /// If is . /// -or- /// If is . /// If is empty.
public static AddQueryParameter ( Uri uri, string parameter, string value ) : Uri
uri System.Uri The URI to add a query parameter to.
parameter string The name of the query parameter to add.
value string The value of the query parameter.
return System.Uri

RemoveQueryParameter() public static method

Remove all query parameters matching a particular parameter name from a URI.

This method handles percent-encoded octets as UTF-8 encoded characters in both the parameter argument and the query string.

/// If is . /// -or- /// If is . /// If is empty.
public static RemoveQueryParameter ( Uri uri, string parameter ) : Uri
uri System.Uri The URI.
parameter string The name of the parameter to remove.
return System.Uri

SetQueryParameter() public static method

Sets a URI query parameter to a specific value, adding or replacing the existing value as appropriate.

This method is a convenience method for calling RemoveQueryParameter followed by AddQueryParameter.

/// If is . /// -or- /// If is . /// -or- /// If is . /// If is empty.
public static SetQueryParameter ( Uri uri, string parameter, string value ) : Uri
uri System.Uri The URI to add a query parameter to.
parameter string The name of the query parameter to add or update.
value string The value of the query parameter.
return System.Uri

UriDecode() public static method

Decodes the text of a URI by unescaping any percent-encoded character sequences and then evaluating the result using the default Encoding.UTF8 encoding.

This method calls UriDecode(string, Encoding) using the default Encoding.UTF8 encoding.

If is .
public static UriDecode ( string text ) : string
text string The encoded URI.
return string

UriDecode() public static method

Decodes the text of a URI by unescaping any percent-encoded character sequences and then evaluating the result using the specified encoding.
If is .
public static UriDecode ( string text, System.Text.Encoding encoding ) : string
text string The encoded URI.
encoding System.Text.Encoding The encoding to use for Unicode characters in the URI. If this value is , the encoding will be used.
return string

UriEncode() public static method

Encodes text for inclusion in a URI using the Encoding.UTF8 encoding.

This method calls UriEncode(string, UriPart, Encoding) using the default Encoding.UTF8 encoding.

If is . If is not a valid .
public static UriEncode ( string text, UriPart uriPart ) : string
text string The text to encode for inclusion in a URI.
uriPart UriPart A value indicating where in the URI the specified text will be included.
return string

UriEncode() public static method

Encodes text for inclusion in a URI.
If is . If is not a valid .
public static UriEncode ( string text, UriPart uriPart, System.Text.Encoding encoding ) : string
text string The text to encode for inclusion in a URI.
uriPart UriPart A value indicating where in the URI the specified text will be included.
encoding System.Text.Encoding The encoding to use for Unicode characters in the URI. If this value is , the encoding will be used.
return string