Skip to content

Commit 1e705a5

Browse files
authored
Merge pull request #1 from sta/master
Pull from origin repo
2 parents ffa9f3a + a3b4080 commit 1e705a5

File tree

4 files changed

+401
-229
lines changed

4 files changed

+401
-229
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2010-2019 sta.blockhead
3+
Copyright (c) 2010-2020 sta.blockhead
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

websocket-sharp/Ext.cs

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,27 @@ internal static byte[] DecompressToArray (this Stream stream, CompressionMethod
389389
: stream.ToByteArray ();
390390
}
391391

392+
internal static void Emit (
393+
this EventHandler eventHandler, object sender, EventArgs e
394+
)
395+
{
396+
if (eventHandler == null)
397+
return;
398+
399+
eventHandler (sender, e);
400+
}
401+
402+
internal static void Emit<TEventArgs> (
403+
this EventHandler<TEventArgs> eventHandler, object sender, TEventArgs e
404+
)
405+
where TEventArgs : EventArgs
406+
{
407+
if (eventHandler == null)
408+
return;
409+
410+
eventHandler (sender, e);
411+
}
412+
392413
/// <summary>
393414
/// Determines whether the specified <see cref="int"/> equals the specified <see cref="char"/>,
394415
/// and invokes the specified <c>Action&lt;int&gt;</c> delegate at the same time.
@@ -1279,69 +1300,39 @@ Action<Exception> error
12791300
#region Public Methods
12801301

12811302
/// <summary>
1282-
/// Emits the specified <see cref="EventHandler"/> delegate if it isn't <see langword="null"/>.
1283-
/// </summary>
1284-
/// <param name="eventHandler">
1285-
/// A <see cref="EventHandler"/> to emit.
1286-
/// </param>
1287-
/// <param name="sender">
1288-
/// An <see cref="object"/> from which emits this <paramref name="eventHandler"/>.
1289-
/// </param>
1290-
/// <param name="e">
1291-
/// A <see cref="EventArgs"/> that contains no event data.
1292-
/// </param>
1293-
public static void Emit (this EventHandler eventHandler, object sender, EventArgs e)
1294-
{
1295-
if (eventHandler != null)
1296-
eventHandler (sender, e);
1297-
}
1298-
1299-
/// <summary>
1300-
/// Emits the specified <c>EventHandler&lt;TEventArgs&gt;</c> delegate if it isn't
1301-
/// <see langword="null"/>.
1302-
/// </summary>
1303-
/// <param name="eventHandler">
1304-
/// An <c>EventHandler&lt;TEventArgs&gt;</c> to emit.
1305-
/// </param>
1306-
/// <param name="sender">
1307-
/// An <see cref="object"/> from which emits this <paramref name="eventHandler"/>.
1308-
/// </param>
1309-
/// <param name="e">
1310-
/// A <c>TEventArgs</c> that represents the event data.
1311-
/// </param>
1312-
/// <typeparam name="TEventArgs">
1313-
/// The type of the event data generated by the event.
1314-
/// </typeparam>
1315-
public static void Emit<TEventArgs> (
1316-
this EventHandler<TEventArgs> eventHandler, object sender, TEventArgs e)
1317-
where TEventArgs : EventArgs
1318-
{
1319-
if (eventHandler != null)
1320-
eventHandler (sender, e);
1321-
}
1322-
1323-
/// <summary>
1324-
/// Gets the description of the specified HTTP status <paramref name="code"/>.
1303+
/// Gets the description of the specified HTTP status code.
13251304
/// </summary>
13261305
/// <returns>
1327-
/// A <see cref="string"/> that represents the description of the HTTP status code.
1306+
/// A <see cref="string"/> that represents the description of
1307+
/// the HTTP status code.
13281308
/// </returns>
13291309
/// <param name="code">
1330-
/// One of <see cref="HttpStatusCode"/> enum values, indicates the HTTP status code.
1310+
/// <para>
1311+
/// One of the <see cref="HttpStatusCode"/> enum values.
1312+
/// </para>
1313+
/// <para>
1314+
/// It specifies the HTTP status code.
1315+
/// </para>
13311316
/// </param>
13321317
public static string GetDescription (this HttpStatusCode code)
13331318
{
13341319
return ((int) code).GetStatusDescription ();
13351320
}
13361321

13371322
/// <summary>
1338-
/// Gets the description of the specified HTTP status <paramref name="code"/>.
1323+
/// Gets the description of the specified HTTP status code.
13391324
/// </summary>
13401325
/// <returns>
1341-
/// A <see cref="string"/> that represents the description of the HTTP status code.
1326+
/// <para>
1327+
/// A <see cref="string"/> that represents the description of
1328+
/// the HTTP status code.
1329+
/// </para>
1330+
/// <para>
1331+
/// An empty string if the description is not present.
1332+
/// </para>
13421333
/// </returns>
13431334
/// <param name="code">
1344-
/// An <see cref="int"/> that represents the HTTP status code.
1335+
/// An <see cref="int"/> that specifies the HTTP status code.
13451336
/// </param>
13461337
public static string GetStatusDescription (this int code)
13471338
{

0 commit comments

Comments
 (0)