EGDL2 2.1
Loading...
Searching...
No Matches
WebSocketSharp.Ext Class Reference

Provides a set of static methods for the websocket-sharp. More...

Static Public Member Functions

static bool Contains (this string value, params char[] chars)
 Determines whether the specified string contains any of characters in the specified array of char.
 
static bool Contains (this NameValueCollection collection, string name)
 Determines whether the specified NameValueCollection contains the entry with the specified name .
 
static bool Contains (this NameValueCollection collection, string name, string value)
 Determines whether the specified NameValueCollection contains the entry with the specified both name and value .
 
static void Emit (this EventHandler eventHandler, object sender, EventArgs e)
 Emits the specified EventHandler delegate if it isn't null.
 
static void Emit< TEventArgs > (this EventHandler< TEventArgs > eventHandler, object sender, TEventArgs e)
 Emits the specified EventHandler<TEventArgs> delegate if it isn't null.
 
static CookieCollection GetCookies (this NameValueCollection headers, bool response)
 Gets the collection of the HTTP cookies from the specified HTTP headers .
 
static string GetDescription (this HttpStatusCode code)
 Gets the description of the specified HTTP status code .
 
static string GetName (this string nameAndValue, string separator)
 Gets the name from the specified string that contains a pair of name and value separated by a separator string.
 
static KeyValuePair< string, string > GetNameAndValue (this string nameAndValue, string separator)
 Gets the name and value from the specified string that contains a pair of name and value separated by a separator string.
 
static string GetStatusDescription (this int code)
 Gets the description of the specified HTTP status code .
 
static string GetValue (this string nameAndValue, string separator)
 Gets the value from the specified string that contains a pair of name and value separated by a separator string.
 
static bool IsCloseStatusCode (this ushort value)
 Determines whether the specified ushort is in the allowable range of the WebSocket close status code.
 
static bool IsEnclosedIn (this string value, char c)
 Determines whether the specified string is enclosed in the specified char.
 
static bool IsHostOrder (this ByteOrder order)
 Determines whether the specified ByteOrder is host (this computer architecture) byte order.
 
static bool IsLocal (this System.Net.IPAddress address)
 Determines whether the specified System.Net.IPAddress represents the local IP address.
 
static bool IsNullOrEmpty (this string value)
 Determines whether the specified string is null or empty.
 
static bool IsPredefinedScheme (this string value)
 Determines whether the specified string is a predefined scheme.
 
static bool IsUpgradeTo (this HttpListenerRequest request, string protocol)
 Determines whether the specified HttpListenerRequest is an HTTP Upgrade request to switch to the specified protocol .
 
static bool MaybeUri (this string value)
 Determines whether the specified string is a URI string.
 
static T[] SubArray< T > (this T[] array, int startIndex, int length)
 Retrieves a sub-array from the specified array . A sub-array starts at the specified element position.
 
static void Times (this int n, Action act)
 Executes the specified Action delegate n times.
 
static void Times (this long n, Action act)
 Executes the specified Action delegate n times.
 
static void Times (this uint n, Action act)
 Executes the specified Action delegate n times.
 
static void Times (this ulong n, Action act)
 Executes the specified Action delegate n times.
 
static void Times (this int n, Action< int > act)
 Executes the specified Action<int> delegate n times.
 
static void Times (this long n, Action< long > act)
 Executes the specified Action<long> delegate n times.
 
static void Times (this uint n, Action< uint > act)
 Executes the specified Action<uint> delegate n times.
 
static void Times (this ulong n, Action< ulong > act)
 Executes the specified Action<ulong> delegate n times.
 
static T To< T > (this byte[] src, ByteOrder srcOrder)
 Converts the specified array of byte to the specified type data.
 
static byte[] ToByteArray< T > (this T value, ByteOrder order)
 Converts the specified value to an array of byte.
 
static byte[] ToHostOrder (this byte[] src, ByteOrder srcOrder)
 Converts the order of the specified array of byte to the host byte order.
 
static string ToString< T > (this T[] array, string separator)
 Converts the specified array to a string that concatenates the each element of array across the specified separator .
 
static Uri ToUri (this string uriString)
 Converts the specified string to a Uri.
 
static string UrlDecode (this string value)
 URL-decodes the specified string.
 
static string UrlEncode (this string value)
 URL-encodes the specified string.
 
static void WriteContent (this HttpListenerResponse response, byte[] content)
 Writes the specified content data with the specified HttpListenerResponse.
 

Detailed Description

Provides a set of static methods for the websocket-sharp.

Member Function Documentation

◆ Contains() [1/3]

static bool WebSocketSharp.Ext.Contains ( this NameValueCollection collection,
string name )
inlinestatic

Determines whether the specified NameValueCollection contains the entry with the specified name .

Returns
true if collection contains the entry with name ; otherwise, false.
Parameters
collectionA NameValueCollection to test.
nameA string that represents the key of the entry to find.

◆ Contains() [2/3]

static bool WebSocketSharp.Ext.Contains ( this NameValueCollection collection,
string name,
string value )
inlinestatic

Determines whether the specified NameValueCollection contains the entry with the specified both name and value .

Returns
true if collection contains the entry with both name and value ; otherwise, false.
Parameters
collectionA NameValueCollection to test.
nameA string that represents the key of the entry to find.
valueA string that represents the value of the entry to find.

◆ Contains() [3/3]

static bool WebSocketSharp.Ext.Contains ( this string value,
params char[] chars )
inlinestatic

Determines whether the specified string contains any of characters in the specified array of char.

Returns
true if value contains any of chars ; otherwise, false.
Parameters
valueA string to test.
charsAn array of char that contains characters to find.

◆ Emit()

static void WebSocketSharp.Ext.Emit ( this EventHandler eventHandler,
object sender,
EventArgs e )
inlinestatic

Emits the specified EventHandler delegate if it isn't null.

Parameters
eventHandlerA EventHandler to emit.
senderAn object from which emits this eventHandler .
eA EventArgs that contains no event data.

◆ Emit< TEventArgs >()

static void WebSocketSharp.Ext.Emit< TEventArgs > ( this EventHandler< TEventArgs > eventHandler,
object sender,
TEventArgs e )
inlinestatic

Emits the specified EventHandler<TEventArgs> delegate if it isn't null.

Parameters
eventHandlerAn EventHandler<TEventArgs> to emit.
senderAn object from which emits this eventHandler .
eA TEventArgs that represents the event data.
Template Parameters
TEventArgsThe type of the event data generated by the event.
Type Constraints
TEventArgs :EventArgs 

◆ GetCookies()

static CookieCollection WebSocketSharp.Ext.GetCookies ( this NameValueCollection headers,
bool response )
inlinestatic

Gets the collection of the HTTP cookies from the specified HTTP headers .

Returns
A CookieCollection that receives a collection of the HTTP cookies.
Parameters
headersA NameValueCollection that contains a collection of the HTTP headers.
responsetrue if headers is a collection of the response headers; otherwise, false.

◆ GetDescription()

static string WebSocketSharp.Ext.GetDescription ( this HttpStatusCode code)
inlinestatic

Gets the description of the specified HTTP status code .

Returns
A string that represents the description of the HTTP status code.
Parameters
codeOne of HttpStatusCode enum values, indicates the HTTP status codes.

◆ GetName()

static string WebSocketSharp.Ext.GetName ( this string nameAndValue,
string separator )
inlinestatic

Gets the name from the specified string that contains a pair of name and value separated by a separator string.

Returns
A string that represents the name if any; otherwise, null.
Parameters
nameAndValueA string that contains a pair of name and value separated by a separator string.
separatorA string that represents a separator string.

◆ GetNameAndValue()

static KeyValuePair< string, string > WebSocketSharp.Ext.GetNameAndValue ( this string nameAndValue,
string separator )
inlinestatic

Gets the name and value from the specified string that contains a pair of name and value separated by a separator string.

Returns
A KeyValuePair<string, string> that represents the name and value if any.
Parameters
nameAndValueA string that contains a pair of name and value separated by a separator string.
separatorA string that represents a separator string.

◆ GetStatusDescription()

static string WebSocketSharp.Ext.GetStatusDescription ( this int code)
inlinestatic

Gets the description of the specified HTTP status code .

Returns
A string that represents the description of the HTTP status code.
Parameters
codeAn int that represents the HTTP status code.

◆ GetValue()

static string WebSocketSharp.Ext.GetValue ( this string nameAndValue,
string separator )
inlinestatic

Gets the value from the specified string that contains a pair of name and value separated by a separator string.

Returns
A string that represents the value if any; otherwise, null.
Parameters
nameAndValueA string that contains a pair of name and value separated by a separator string.
separatorA string that represents a separator string.

◆ IsCloseStatusCode()

static bool WebSocketSharp.Ext.IsCloseStatusCode ( this ushort value)
inlinestatic

Determines whether the specified ushort is in the allowable range of the WebSocket close status code.

Not allowable ranges are the followings.

  • Numbers in the range 0-999 are not used.
  • Numbers greater than 4999 are out of the reserved close status code ranges.
Returns
true if value is in the allowable range of the WebSocket close status code; otherwise, false.
Parameters
valueA ushort to test.

◆ IsEnclosedIn()

static bool WebSocketSharp.Ext.IsEnclosedIn ( this string value,
char c )
inlinestatic

Determines whether the specified string is enclosed in the specified char.

Returns
true if value is enclosed in c ; otherwise, false.
Parameters
valueA string to test.
cA char that represents the character to find.

◆ IsHostOrder()

static bool WebSocketSharp.Ext.IsHostOrder ( this ByteOrder order)
inlinestatic

Determines whether the specified ByteOrder is host (this computer architecture) byte order.

Returns
true if order is host byte order; otherwise, false.
Parameters
orderOne of the ByteOrder enum values, to test.

◆ IsLocal()

static bool WebSocketSharp.Ext.IsLocal ( this System::Net::IPAddress address)
inlinestatic

Determines whether the specified System.Net.IPAddress represents the local IP address.

Returns
true if address represents the local IP address; otherwise, false.
Parameters
addressA System.Net.IPAddress to test.
Exceptions
ArgumentNullExceptionaddress is null.

◆ IsNullOrEmpty()

static bool WebSocketSharp.Ext.IsNullOrEmpty ( this string value)
inlinestatic

Determines whether the specified string is null or empty.

Returns
true if value is null or empty; otherwise, false.
Parameters
valueA string to test.

◆ IsPredefinedScheme()

static bool WebSocketSharp.Ext.IsPredefinedScheme ( this string value)
inlinestatic

Determines whether the specified string is a predefined scheme.

Returns
true if value is a predefined scheme; otherwise, false.
Parameters
valueA string to test.
Here is the caller graph for this function:

◆ IsUpgradeTo()

static bool WebSocketSharp.Ext.IsUpgradeTo ( this HttpListenerRequest request,
string protocol )
inlinestatic

Determines whether the specified HttpListenerRequest is an HTTP Upgrade request to switch to the specified protocol .

Returns
true if request is an HTTP Upgrade request to switch to protocol ; otherwise, false.
Parameters
requestA HttpListenerRequest that represents the HTTP request.
protocolA string that represents the protocol name.
Exceptions
ArgumentNullExceptionrequest is null. -or- protocol is null.
ArgumentExceptionprotocol is empty.

◆ MaybeUri()

static bool WebSocketSharp.Ext.MaybeUri ( this string value)
inlinestatic

Determines whether the specified string is a URI string.

Returns
true if value may be a URI string; otherwise, false.
Parameters
valueA string to test.
Here is the call graph for this function:

◆ SubArray< T >()

static T[] WebSocketSharp.Ext.SubArray< T > ( this T[] array,
int startIndex,
int length )
inlinestatic

Retrieves a sub-array from the specified array . A sub-array starts at the specified element position.

Returns
An array of T that receives a sub-array, or an empty array of T if any problems with the parameters.
Parameters
arrayAn array of T that contains the data to retrieve a sub-array.
startIndexAn int that contains the zero-based starting position of a sub-array in array .
lengthAn int that contains the number of elements to retrieve a sub-array.
Template Parameters
TThe type of elements in the array .

◆ Times() [1/8]

static void WebSocketSharp.Ext.Times ( this int n,
Action act )
inlinestatic

Executes the specified Action delegate n times.

Parameters
nAn int is the number of times to execute.
actAn Action delegate that references the method(s) to execute.
Here is the caller graph for this function:

◆ Times() [2/8]

static void WebSocketSharp.Ext.Times ( this int n,
Action< int > act )
inlinestatic

Executes the specified Action<int> delegate n times.

Parameters
nAn int is the number of times to execute.
actAn Action<int> delegate that references the method(s) to execute. An int parameter to pass to the method(s) is the zero-based count of iteration.

◆ Times() [3/8]

static void WebSocketSharp.Ext.Times ( this long n,
Action act )
inlinestatic

Executes the specified Action delegate n times.

Parameters
nA long is the number of times to execute.
actAn Action delegate that references the method(s) to execute.

◆ Times() [4/8]

static void WebSocketSharp.Ext.Times ( this long n,
Action< long > act )
inlinestatic

Executes the specified Action<long> delegate n times.

Parameters
nA long is the number of times to execute.
actAn Action<long> delegate that references the method(s) to execute. A long parameter to pass to the method(s) is the zero-based count of iteration.

◆ Times() [5/8]

static void WebSocketSharp.Ext.Times ( this uint n,
Action act )
inlinestatic

Executes the specified Action delegate n times.

Parameters
nA uint is the number of times to execute.
actAn Action delegate that references the method(s) to execute.

◆ Times() [6/8]

static void WebSocketSharp.Ext.Times ( this uint n,
Action< uint > act )
inlinestatic

Executes the specified Action<uint> delegate n times.

Parameters
nA uint is the number of times to execute.
actAn Action<uint> delegate that references the method(s) to execute. A uint parameter to pass to the method(s) is the zero-based count of iteration.

◆ Times() [7/8]

static void WebSocketSharp.Ext.Times ( this ulong n,
Action act )
inlinestatic

Executes the specified Action delegate n times.

Parameters
nA ulong is the number of times to execute.
actAn Action delegate that references the method(s) to execute.

◆ Times() [8/8]

static void WebSocketSharp.Ext.Times ( this ulong n,
Action< ulong > act )
inlinestatic

Executes the specified Action<ulong> delegate n times.

Parameters
nA ulong is the number of times to execute.
actAn Action<ulong> delegate that references the method(s) to execute. A ulong parameter to pass to this method(s) is the zero-based count of iteration.

◆ To< T >()

static T WebSocketSharp.Ext.To< T > ( this byte[] src,
ByteOrder srcOrder )
inlinestatic

Converts the specified array of byte to the specified type data.

Returns
A T converted from src , or a default value of T if src is an empty array of byte or if the type of T isn't bool, char, double, float, int, long, short, uint, ulong, or ushort.
Parameters
srcAn array of byte to convert.
srcOrderOne of the ByteOrder enum values, indicates the byte order of src .
Template Parameters
TThe type of the return. The T must be a value type.
Exceptions
ArgumentNullExceptionsrc is null.
Type Constraints
T :struct 

◆ ToByteArray< T >()

static byte[] WebSocketSharp.Ext.ToByteArray< T > ( this T value,
ByteOrder order )
inlinestatic

Converts the specified value to an array of byte.

Returns
An array of byte converted from value .
Parameters
valueA T to convert.
orderOne of the ByteOrder enum values, indicates the byte order of the return.
Template Parameters
TThe type of value . The T must be a value type.
Type Constraints
T :struct 

◆ ToHostOrder()

static byte[] WebSocketSharp.Ext.ToHostOrder ( this byte[] src,
ByteOrder srcOrder )
inlinestatic

Converts the order of the specified array of byte to the host byte order.

Returns
An array of byte converted from src .
Parameters
srcAn array of byte to convert.
srcOrderOne of the ByteOrder enum values, indicates the byte order of src .
Exceptions
ArgumentNullExceptionsrc is null.

◆ ToString< T >()

static string WebSocketSharp.Ext.ToString< T > ( this T[] array,
string separator )
inlinestatic

Converts the specified array to a string that concatenates the each element of array across the specified separator .

Returns
A string converted from array , or String.Empty if array is empty.
Parameters
arrayAn array of T to convert.
separatorA string that represents the separator string.
Template Parameters
TThe type of elements in array .
Exceptions
ArgumentNullExceptionarray is null.
Here is the call graph for this function:

◆ ToUri()

static Uri WebSocketSharp.Ext.ToUri ( this string uriString)
inlinestatic

Converts the specified string to a Uri.

Returns
A Uri converted from uriString , or null if uriString isn't successfully converted.
Parameters
uriStringA string to convert.

◆ UrlDecode()

static string WebSocketSharp.Ext.UrlDecode ( this string value)
inlinestatic

URL-decodes the specified string.

Returns
A string that receives the decoded string, or the value if it's null or empty.
Parameters
valueA string to decode.

◆ UrlEncode()

static string WebSocketSharp.Ext.UrlEncode ( this string value)
inlinestatic

URL-encodes the specified string.

Returns
A string that receives the encoded string, or value if it's null or empty.
Parameters
valueA string to encode.

◆ WriteContent()

static void WebSocketSharp.Ext.WriteContent ( this HttpListenerResponse response,
byte[] content )
inlinestatic

Writes the specified content data with the specified HttpListenerResponse.

Parameters
responseA HttpListenerResponse that represents the HTTP response used to write the content data.
contentAn array of byte that represents the content data to write.
Exceptions
ArgumentNullExceptionresponse is null.

The documentation for this class was generated from the following file: