[Modify] Polish it
This commit is contained in:
parent
72685d62de
commit
009c10cc4f
@ -3082,12 +3082,14 @@ namespace WebSocketSharp
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public bool Ping (string message)
|
public bool Ping (string message)
|
||||||
{
|
{
|
||||||
if (message == null)
|
if (message.IsNullOrEmpty ())
|
||||||
throw new ArgumentNullException ("message");
|
return ping (EmptyBytes);
|
||||||
|
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
if (!message.TryGetUTF8EncodedBytes (out bytes))
|
if (!message.TryGetUTF8EncodedBytes (out bytes)) {
|
||||||
throw new ArgumentException ("It could not be UTF-8-encoded.", "message");
|
var msg = "It could not be UTF-8-encoded.";
|
||||||
|
throw new ArgumentException (msg, "message");
|
||||||
|
}
|
||||||
|
|
||||||
if (bytes.Length > 125) {
|
if (bytes.Length > 125) {
|
||||||
var msg = "Its size is greater than 125 bytes.";
|
var msg = "Its size is greater than 125 bytes.";
|
||||||
|
Loading…
Reference in New Issue
Block a user