[Modify] Polish it
This commit is contained in:
parent
974f6dc1d7
commit
ea831f0dd8
@ -152,17 +152,14 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
internal static byte[] Append (this ushort code, string reason)
|
internal static byte[] Append (this ushort code, string reason)
|
||||||
{
|
{
|
||||||
using (var buff = new MemoryStream ()) {
|
var ret = code.InternalToByteArray (ByteOrder.Big);
|
||||||
var bytes = code.InternalToByteArray (ByteOrder.Big);
|
|
||||||
buff.Write (bytes, 0, 2);
|
|
||||||
if (reason != null && reason.Length > 0) {
|
if (reason != null && reason.Length > 0) {
|
||||||
bytes = Encoding.UTF8.GetBytes (reason);
|
var buff = new List<byte> (ret);
|
||||||
buff.Write (bytes, 0, bytes.Length);
|
buff.AddRange (Encoding.UTF8.GetBytes (reason));
|
||||||
|
ret = buff.ToArray ();
|
||||||
}
|
}
|
||||||
|
|
||||||
buff.Close ();
|
return ret;
|
||||||
return buff.ToArray ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string CheckIfAvailable (
|
internal static string CheckIfAvailable (
|
||||||
|
Loading…
Reference in New Issue
Block a user