Modified Ext.cs, PayloadData.cs, WsFrame.cs
This commit is contained in:
@@ -174,8 +174,8 @@ namespace WebSocketSharp {
|
||||
|
||||
internal static void CopyTo(this Stream src, Stream dest, bool setDefaultPosition)
|
||||
{
|
||||
int readLen;
|
||||
int bufferLen = 256;
|
||||
var readLen = 0;
|
||||
var bufferLen = 256;
|
||||
var buffer = new byte[bufferLen];
|
||||
while ((readLen = src.Read(buffer, 0, bufferLen)) > 0)
|
||||
{
|
||||
@@ -321,6 +321,76 @@ namespace WebSocketSharp {
|
||||
: String.Format("\"{0}\"", value.Replace("\"", "\\\""));
|
||||
}
|
||||
|
||||
internal static byte[] ReadBytesInternal(this Stream stream, int length)
|
||||
{
|
||||
var buffer = new byte[length];
|
||||
var readLen = stream.Read(buffer, 0, length);
|
||||
if (readLen <= 0)
|
||||
return new byte[]{};
|
||||
|
||||
var tmpLen = 0;
|
||||
while (readLen < length)
|
||||
{
|
||||
tmpLen = stream.Read(buffer, readLen, length - readLen);
|
||||
if (tmpLen <= 0)
|
||||
break;
|
||||
|
||||
readLen += tmpLen;
|
||||
}
|
||||
|
||||
return readLen == length
|
||||
? buffer
|
||||
: buffer.SubArray(0, readLen);
|
||||
}
|
||||
|
||||
internal static byte[] ReadBytesInternal(this Stream stream, long length, int bufferLength)
|
||||
{
|
||||
var count = length / bufferLength;
|
||||
var rem = length % bufferLength;
|
||||
using (var readData = new MemoryStream())
|
||||
{
|
||||
var readLen = 0;
|
||||
var bufferLen = 0;
|
||||
var tmpLen = 0;
|
||||
Func<byte[], bool> read = buffer =>
|
||||
{
|
||||
bufferLen = buffer.Length;
|
||||
readLen = stream.Read(buffer, 0, bufferLen);
|
||||
if (readLen <= 0)
|
||||
return false;
|
||||
|
||||
while (readLen < bufferLen)
|
||||
{
|
||||
tmpLen = stream.Read(buffer, readLen, bufferLen - readLen);
|
||||
if (tmpLen <= 0)
|
||||
break;
|
||||
|
||||
readLen += tmpLen;
|
||||
}
|
||||
|
||||
readData.Write(buffer, 0, readLen);
|
||||
return readLen == bufferLen;
|
||||
};
|
||||
|
||||
var readBuffer = new byte[bufferLength];
|
||||
var readEnd = false;
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
if (!read(readBuffer))
|
||||
{
|
||||
readEnd = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!readEnd && rem > 0)
|
||||
read(new byte[rem]);
|
||||
|
||||
readData.Close();
|
||||
return readData.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
internal static string RemovePrefix(this string value, params string[] prefixes)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -1073,28 +1143,6 @@ namespace WebSocketSharp {
|
||||
return uriString.Substring(0, p).IsPredefinedScheme();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether two specified <see cref="string"/> objects don't have the same value.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the value of <paramref name="expected"/> parameter isn't the same as the value of <paramref name="actual"/> parameter; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
/// <param name="expected">
|
||||
/// The first <see cref="string"/> to compare.
|
||||
/// </param>
|
||||
/// <param name="actual">
|
||||
/// The second <see cref="string"/> to compare.
|
||||
/// </param>
|
||||
/// <param name="ignoreCase">
|
||||
/// A <see cref="bool"/> that indicates a case-sensitive or insensitive comparison. (<c>true</c> indicates a case-insensitive comparison.)
|
||||
/// </param>
|
||||
public static bool NotEqual(this string expected, string actual, bool ignoreCase)
|
||||
{
|
||||
return String.Compare(expected, actual, ignoreCase) != 0
|
||||
? true
|
||||
: false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a block of bytes from the specified <see cref="Stream"/>
|
||||
/// and returns the read data in an array of <see cref="byte"/>.
|
||||
@@ -1110,46 +1158,9 @@ namespace WebSocketSharp {
|
||||
/// </param>
|
||||
public static byte[] ReadBytes(this Stream stream, int length)
|
||||
{
|
||||
if (stream == null || length <= 0)
|
||||
return new byte[]{};
|
||||
|
||||
var buffer = new byte[length];
|
||||
var readLen = stream.Read(buffer, 0, length);
|
||||
if (readLen <= 0)
|
||||
return new byte[]{};
|
||||
|
||||
var tmpLen = 0;
|
||||
while (readLen < length)
|
||||
{
|
||||
tmpLen = stream.Read(buffer, readLen, length - readLen);
|
||||
if (tmpLen <= 0)
|
||||
break;
|
||||
|
||||
readLen += tmpLen;
|
||||
}
|
||||
|
||||
return readLen == length
|
||||
? buffer
|
||||
: readLen > 0
|
||||
? buffer.SubArray(0, readLen)
|
||||
: new byte[]{};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a block of bytes from the specified stream and returns the read data in an array of <see cref="byte"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An array of <see cref="byte"/> that receives the read data.
|
||||
/// </returns>
|
||||
/// <param name="stream">
|
||||
/// A <see cref="Stream"/> that contains the data to read.
|
||||
/// </param>
|
||||
/// <param name="length">
|
||||
/// A <see cref="long"/> that contains the number of bytes to read.
|
||||
/// </param>
|
||||
public static byte[] ReadBytes(this Stream stream, long length)
|
||||
{
|
||||
return stream.ReadBytes(length, 1024);
|
||||
return stream == null || length < 1
|
||||
? new byte[]{}
|
||||
: stream.ReadBytesInternal(length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1165,64 +1176,13 @@ namespace WebSocketSharp {
|
||||
/// <param name="length">
|
||||
/// A <see cref="long"/> that contains the number of bytes to read.
|
||||
/// </param>
|
||||
/// <param name="bufferLength">
|
||||
/// An <see cref="int"/> that contains the buffer size in bytes of each internal read.
|
||||
/// </param>
|
||||
public static byte[] ReadBytes(this Stream stream, long length, int bufferLength)
|
||||
public static byte[] ReadBytes(this Stream stream, long length)
|
||||
{
|
||||
if (stream == null || length <= 0)
|
||||
return new byte[]{};
|
||||
|
||||
if (bufferLength <= 0)
|
||||
bufferLength = 1024;
|
||||
|
||||
var count = length / bufferLength;
|
||||
var rem = length % bufferLength;
|
||||
if (count == 0)
|
||||
return stream.ReadBytes((int)rem);
|
||||
|
||||
using (var readData = new MemoryStream())
|
||||
{
|
||||
var readLen = 0;
|
||||
var bufferLen = 0;
|
||||
var tmpLen = 0;
|
||||
Func<byte[], bool> read = buffer =>
|
||||
{
|
||||
bufferLen = buffer.Length;
|
||||
readLen = stream.Read(buffer, 0, bufferLen);
|
||||
if (readLen <= 0)
|
||||
return false;
|
||||
|
||||
while (readLen < bufferLen)
|
||||
{
|
||||
tmpLen = stream.Read(buffer, readLen, bufferLen - readLen);
|
||||
if (tmpLen <= 0)
|
||||
break;
|
||||
|
||||
readLen += tmpLen;
|
||||
}
|
||||
|
||||
readData.Write(buffer, 0, readLen);
|
||||
return readLen == bufferLen;
|
||||
};
|
||||
|
||||
var readBuffer = new byte[bufferLength];
|
||||
var cont = true;
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
if (!read(readBuffer))
|
||||
{
|
||||
cont = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cont && rem > 0)
|
||||
read(new byte[rem]);
|
||||
|
||||
readData.Close();
|
||||
return readData.ToArray();
|
||||
}
|
||||
return stream == null || length < 1
|
||||
? new byte[]{}
|
||||
: length > 1024
|
||||
? stream.ReadBytesInternal(length, 1024)
|
||||
: stream.ReadBytesInternal((int)length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -72,12 +72,6 @@ namespace WebSocketSharp {
|
||||
|
||||
public PayloadData(byte[] extData, byte[] appData, bool masked)
|
||||
{
|
||||
if (extData.IsNull())
|
||||
throw new ArgumentNullException("extData");
|
||||
|
||||
if (appData.IsNull())
|
||||
throw new ArgumentNullException("appData");
|
||||
|
||||
if ((ulong)extData.LongLength + (ulong)appData.LongLength > MaxLength)
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"The length of 'extData' plus 'appData' must be less than MaxLength.");
|
||||
@@ -107,7 +101,9 @@ namespace WebSocketSharp {
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsMasked { get; private set; }
|
||||
internal bool IsMasked {
|
||||
get; private set;
|
||||
}
|
||||
|
||||
internal ulong Length {
|
||||
get {
|
||||
@@ -119,9 +115,13 @@ namespace WebSocketSharp {
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public byte[] ExtensionData { get; private set; }
|
||||
public byte[] ExtensionData {
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public byte[] ApplicationData { get; private set; }
|
||||
public byte[] ApplicationData {
|
||||
get; private set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -152,12 +152,6 @@ namespace WebSocketSharp {
|
||||
|
||||
public void Mask(byte[] maskingKey)
|
||||
{
|
||||
if (maskingKey.IsNull())
|
||||
throw new ArgumentNullException("maskingKey");
|
||||
|
||||
if (maskingKey.Length != 4)
|
||||
throw new ArgumentOutOfRangeException("maskingKey", "The length must be 4.");
|
||||
|
||||
if (ExtensionData.LongLength > 0)
|
||||
mask(ExtensionData, maskingKey);
|
||||
|
||||
|
@@ -36,12 +36,6 @@ namespace WebSocketSharp {
|
||||
|
||||
internal class WsFrame : IEnumerable<byte>
|
||||
{
|
||||
#region Private Const Fields
|
||||
|
||||
private const int _readBufferLen = 1024;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Constructors
|
||||
|
||||
private WsFrame()
|
||||
@@ -70,26 +64,47 @@ namespace WebSocketSharp {
|
||||
public WsFrame(
|
||||
Fin fin, Opcode opcode, Mask mask, PayloadData payloadData, bool compressed)
|
||||
{
|
||||
if (payloadData.IsNull())
|
||||
throw new ArgumentNullException("payloadData");
|
||||
|
||||
if (isControl(opcode) && payloadData.Length > 125)
|
||||
throw new ArgumentOutOfRangeException("payloadData",
|
||||
"The control frame must have a payload length of 125 bytes or less.");
|
||||
|
||||
if (!isFinal(fin) && isControl(opcode))
|
||||
throw new ArgumentException("The control frame must not be fragmented.");
|
||||
|
||||
if (isControl(opcode) && compressed)
|
||||
throw new ArgumentException("The control frame must not be compressed.");
|
||||
|
||||
Fin = fin;
|
||||
Rsv1 = isData(opcode) && compressed ? Rsv.ON : Rsv.OFF;
|
||||
Rsv2 = Rsv.OFF;
|
||||
Rsv3 = Rsv.OFF;
|
||||
Opcode = opcode;
|
||||
Mask = mask;
|
||||
PayloadData = payloadData;
|
||||
|
||||
init();
|
||||
/* PayloadLen */
|
||||
|
||||
ulong dataLen = payloadData.Length;
|
||||
var payloadLen = dataLen < 126
|
||||
? (byte)dataLen
|
||||
: dataLen < 0x010000
|
||||
? (byte)126
|
||||
: (byte)127;
|
||||
|
||||
PayloadLen = payloadLen;
|
||||
|
||||
/* ExtPayloadLen */
|
||||
|
||||
ExtPayloadLen = payloadLen < 126
|
||||
? new byte[]{}
|
||||
: payloadLen == 126
|
||||
? ((ushort)dataLen).ToByteArray(ByteOrder.BIG)
|
||||
: dataLen.ToByteArray(ByteOrder.BIG);
|
||||
|
||||
/* MaskingKey */
|
||||
|
||||
var masking = mask == Mask.MASK;
|
||||
var maskingKey = masking
|
||||
? createMaskingKey()
|
||||
: new byte[]{};
|
||||
|
||||
MaskingKey = maskingKey;
|
||||
|
||||
/* PayloadData */
|
||||
|
||||
if (masking)
|
||||
payloadData.Mask(maskingKey);
|
||||
|
||||
PayloadData = payloadData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -215,6 +230,36 @@ namespace WebSocketSharp {
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static WsFrame createCloseFrame(WebSocketException exception)
|
||||
{
|
||||
using (var buffer = new MemoryStream())
|
||||
{
|
||||
var code = (ushort)exception.Code;
|
||||
var msg = exception.Message;
|
||||
buffer.Write(code.ToByteArray(ByteOrder.BIG), 0, 2);
|
||||
if (msg.Length != 0)
|
||||
{
|
||||
var tmp = Encoding.UTF8.GetBytes(msg);
|
||||
buffer.Write(tmp, 0, tmp.Length);
|
||||
}
|
||||
|
||||
buffer.Close();
|
||||
var payload = new PayloadData(buffer.ToArray());
|
||||
var frame = new WsFrame(Fin.FINAL, Opcode.CLOSE, Mask.UNMASK, payload);
|
||||
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] createMaskingKey()
|
||||
{
|
||||
var key = new byte[4];
|
||||
var rand = new Random();
|
||||
rand.NextBytes(key);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
private static void dump(WsFrame frame)
|
||||
{
|
||||
var len = frame.Length;
|
||||
@@ -285,17 +330,6 @@ namespace WebSocketSharp {
|
||||
Console.WriteLine(footerFmt, String.Empty);
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
Rsv2 = Rsv.OFF;
|
||||
Rsv3 = Rsv.OFF;
|
||||
setPayloadLen(PayloadData.Length);
|
||||
if (IsMasked)
|
||||
maskPayloadData();
|
||||
else
|
||||
MaskingKey = new byte[]{};
|
||||
}
|
||||
|
||||
private static bool isBinary(Opcode opcode)
|
||||
{
|
||||
return opcode == Opcode.BINARY;
|
||||
@@ -313,12 +347,12 @@ namespace WebSocketSharp {
|
||||
|
||||
private static bool isControl(Opcode opcode)
|
||||
{
|
||||
return isClose(opcode) || isPing(opcode) || isPong(opcode);
|
||||
return opcode == Opcode.CLOSE || opcode == Opcode.PING || opcode == Opcode.PONG;
|
||||
}
|
||||
|
||||
private static bool isData(Opcode opcode)
|
||||
{
|
||||
return isText(opcode) || isBinary(opcode);
|
||||
return opcode == Opcode.TEXT || opcode == Opcode.BINARY;
|
||||
}
|
||||
|
||||
private static bool isFinal(Fin fin)
|
||||
@@ -346,26 +380,106 @@ namespace WebSocketSharp {
|
||||
return opcode == Opcode.TEXT;
|
||||
}
|
||||
|
||||
private void maskPayloadData()
|
||||
{
|
||||
var key = new byte[4];
|
||||
var rand = new Random();
|
||||
rand.NextBytes(key);
|
||||
|
||||
MaskingKey = key;
|
||||
PayloadData.Mask(key);
|
||||
}
|
||||
|
||||
private static WsFrame parse(byte[] header, Stream stream, bool unmask)
|
||||
{
|
||||
if (header.IsNull() || header.Length != 2)
|
||||
if (header == null || header.Length != 2)
|
||||
return null;
|
||||
|
||||
var frame = readHeader(header);
|
||||
readExtPayloadLen(stream, frame);
|
||||
readMaskingKey(stream, frame);
|
||||
readPayloadData(stream, frame, unmask);
|
||||
/* Header */
|
||||
|
||||
// FIN
|
||||
var fin = (header[0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE;
|
||||
// RSV1
|
||||
var rsv1 = (header[0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
|
||||
// RSV2
|
||||
var rsv2 = (header[0] & 0x20) == 0x20 ? Rsv.ON : Rsv.OFF;
|
||||
// RSV3
|
||||
var rsv3 = (header[0] & 0x10) == 0x10 ? Rsv.ON : Rsv.OFF;
|
||||
// Opcode
|
||||
var opcode = (Opcode)(header[0] & 0x0f);
|
||||
// MASK
|
||||
var mask = (header[1] & 0x80) == 0x80 ? Mask.MASK : Mask.UNMASK;
|
||||
// Payload len
|
||||
var payloadLen = (byte)(header[1] & 0x7f);
|
||||
|
||||
if (isControl(opcode) && payloadLen > 125)
|
||||
throw new WebSocketException(CloseStatusCode.INCONSISTENT_DATA,
|
||||
"The payload length of a control frame must be 125 bytes or less.");
|
||||
|
||||
var frame = new WsFrame {
|
||||
Fin = fin,
|
||||
Rsv1 = rsv1,
|
||||
Rsv2 = rsv2,
|
||||
Rsv3 = rsv3,
|
||||
Opcode = opcode,
|
||||
Mask = mask,
|
||||
PayloadLen = payloadLen
|
||||
};
|
||||
|
||||
/* Extended Payload Length */
|
||||
|
||||
var extLen = payloadLen < 126
|
||||
? 0
|
||||
: payloadLen == 126
|
||||
? 2
|
||||
: 8;
|
||||
|
||||
var extPayloadLen = extLen > 0
|
||||
? stream.ReadBytesInternal(extLen)
|
||||
: new byte[]{};
|
||||
|
||||
if (extLen > 0 && extPayloadLen.Length != extLen)
|
||||
throw new IOException();
|
||||
|
||||
frame.ExtPayloadLen = extPayloadLen;
|
||||
|
||||
/* Masking Key */
|
||||
|
||||
var masked = mask == Mask.MASK ? true : false;
|
||||
var maskingKey = masked
|
||||
? stream.ReadBytesInternal(4)
|
||||
: new byte[]{};
|
||||
|
||||
if (masked && maskingKey.Length != 4)
|
||||
throw new IOException();
|
||||
|
||||
frame.MaskingKey = maskingKey;
|
||||
|
||||
/* Payload Data */
|
||||
|
||||
ulong dataLen = payloadLen < 126
|
||||
? payloadLen
|
||||
: payloadLen == 126
|
||||
? extPayloadLen.To<ushort>(ByteOrder.BIG)
|
||||
: extPayloadLen.To<ulong>(ByteOrder.BIG);
|
||||
|
||||
byte[] data = null;
|
||||
if (dataLen > 0)
|
||||
{
|
||||
if (payloadLen > 126 && dataLen > PayloadData.MaxLength)
|
||||
throw new WebSocketException(CloseStatusCode.TOO_BIG);
|
||||
|
||||
data = dataLen > 1024
|
||||
? stream.ReadBytesInternal((long)dataLen, 1024)
|
||||
: stream.ReadBytesInternal((int)dataLen);
|
||||
|
||||
if (data.LongLength != (long)dataLen)
|
||||
throw new IOException();
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new byte[]{};
|
||||
}
|
||||
|
||||
var payloadData = new PayloadData(data, masked);
|
||||
if (masked && unmask)
|
||||
{
|
||||
payloadData.Mask(maskingKey);
|
||||
frame.Mask = Mask.UNMASK;
|
||||
frame.MaskingKey = new byte[]{};
|
||||
}
|
||||
|
||||
frame.PayloadData = payloadData;
|
||||
return frame;
|
||||
}
|
||||
|
||||
@@ -406,136 +520,6 @@ namespace WebSocketSharp {
|
||||
format, frame.Fin, frame.Rsv1, frame.Rsv2, frame.Rsv3, opcode, frame.Mask, frame.PayloadLen, extPayloadLen, maskingKey, payloadData);
|
||||
}
|
||||
|
||||
private static void readExtPayloadLen(Stream stream, WsFrame frame)
|
||||
{
|
||||
int length = frame.PayloadLen <= 125
|
||||
? 0
|
||||
: frame.PayloadLen == 126
|
||||
? 2
|
||||
: 8;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
frame.ExtPayloadLen = new byte[]{};
|
||||
return;
|
||||
}
|
||||
|
||||
var extPayloadLen = stream.ReadBytes(length);
|
||||
if (extPayloadLen.Length != length)
|
||||
throw new IOException();
|
||||
|
||||
frame.ExtPayloadLen = extPayloadLen;
|
||||
}
|
||||
|
||||
private static WsFrame readHeader(byte[] header)
|
||||
{
|
||||
// FIN
|
||||
Fin fin = (header[0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE;
|
||||
// RSV1
|
||||
Rsv rsv1 = (header[0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
|
||||
// RSV2
|
||||
Rsv rsv2 = (header[0] & 0x20) == 0x20 ? Rsv.ON : Rsv.OFF;
|
||||
// RSV3
|
||||
Rsv rsv3 = (header[0] & 0x10) == 0x10 ? Rsv.ON : Rsv.OFF;
|
||||
// Opcode
|
||||
Opcode opcode = (Opcode)(header[0] & 0x0f);
|
||||
// MASK
|
||||
Mask mask = (header[1] & 0x80) == 0x80 ? Mask.MASK : Mask.UNMASK;
|
||||
// Payload len
|
||||
byte payloadLen = (byte)(header[1] & 0x7f);
|
||||
|
||||
return new WsFrame {
|
||||
Fin = fin,
|
||||
Rsv1 = rsv1,
|
||||
Rsv2 = rsv2,
|
||||
Rsv3 = rsv3,
|
||||
Opcode = opcode,
|
||||
Mask = mask,
|
||||
PayloadLen = payloadLen
|
||||
};
|
||||
}
|
||||
|
||||
private static void readMaskingKey(Stream stream, WsFrame frame)
|
||||
{
|
||||
if (!isMasked(frame.Mask))
|
||||
{
|
||||
frame.MaskingKey = new byte[]{};
|
||||
return;
|
||||
}
|
||||
|
||||
var maskingKey = stream.ReadBytes(4);
|
||||
if (maskingKey.Length != 4)
|
||||
throw new IOException();
|
||||
|
||||
frame.MaskingKey = maskingKey;
|
||||
}
|
||||
|
||||
private static void readPayloadData(Stream stream, WsFrame frame, bool unmask)
|
||||
{
|
||||
ulong length = frame.PayloadLen <= 125
|
||||
? frame.PayloadLen
|
||||
: frame.PayloadLen == 126
|
||||
? frame.ExtPayloadLen.To<ushort>(ByteOrder.BIG)
|
||||
: frame.ExtPayloadLen.To<ulong>(ByteOrder.BIG);
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
frame.PayloadData = new PayloadData();
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.PayloadLen > 126 && length > PayloadData.MaxLength)
|
||||
throw new WebSocketException(CloseStatusCode.TOO_BIG);
|
||||
|
||||
var buffer = length <= (ulong)_readBufferLen
|
||||
? stream.ReadBytes((int)length)
|
||||
: stream.ReadBytes((long)length, _readBufferLen);
|
||||
|
||||
if (buffer.LongLength != (long)length)
|
||||
throw new IOException();
|
||||
|
||||
var masked = isMasked(frame.Mask);
|
||||
var payloadData = masked
|
||||
? new PayloadData(buffer, true)
|
||||
: new PayloadData(buffer);
|
||||
|
||||
if (masked && unmask)
|
||||
{
|
||||
payloadData.Mask(frame.MaskingKey);
|
||||
frame.Mask = Mask.UNMASK;
|
||||
frame.MaskingKey = new byte[]{};
|
||||
}
|
||||
|
||||
frame.PayloadData = payloadData;
|
||||
}
|
||||
|
||||
private void setPayloadLen(ulong length)
|
||||
{
|
||||
if (length < 126)
|
||||
{
|
||||
PayloadLen = (byte)length;
|
||||
ExtPayloadLen = new byte[]{};
|
||||
return;
|
||||
}
|
||||
|
||||
if (length < 0x010000)
|
||||
{
|
||||
PayloadLen = (byte)126;
|
||||
ExtPayloadLen = ((ushort)length).ToByteArray(ByteOrder.BIG);
|
||||
return;
|
||||
}
|
||||
|
||||
PayloadLen = (byte)127;
|
||||
ExtPayloadLen = length.ToByteArray(ByteOrder.BIG);
|
||||
}
|
||||
|
||||
private void unmaskPayloadData()
|
||||
{
|
||||
PayloadData.Mask(MaskingKey);
|
||||
Mask = Mask.UNMASK;
|
||||
MaskingKey = new byte[]{};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -574,12 +558,16 @@ namespace WebSocketSharp {
|
||||
WsFrame frame = null;
|
||||
try
|
||||
{
|
||||
var header = stream.ReadBytes(2);
|
||||
var header = stream.ReadBytesInternal(2);
|
||||
frame = parse(header, stream, unmask);
|
||||
}
|
||||
catch (WebSocketException ex)
|
||||
{
|
||||
frame = createCloseFrame(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!error.IsNull())
|
||||
if (error != null)
|
||||
error(ex);
|
||||
}
|
||||
|
||||
@@ -605,25 +593,27 @@ namespace WebSocketSharp {
|
||||
WsFrame frame = null;
|
||||
try
|
||||
{
|
||||
int readLen = stream.EndRead(ar);
|
||||
if (readLen != 2)
|
||||
var readLen = stream.EndRead(ar);
|
||||
if (readLen > 0)
|
||||
{
|
||||
if (readLen == 1)
|
||||
header[1] = (byte)stream.ReadByte();
|
||||
else
|
||||
header = null;
|
||||
}
|
||||
|
||||
frame = parse(header, stream, unmask);
|
||||
frame = parse(header, stream, unmask);
|
||||
}
|
||||
}
|
||||
catch (WebSocketException ex)
|
||||
{
|
||||
frame = createCloseFrame(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!error.IsNull())
|
||||
if (error != null)
|
||||
error(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!completed.IsNull())
|
||||
if (completed != null)
|
||||
completed(frame);
|
||||
}
|
||||
};
|
||||
@@ -641,27 +631,35 @@ namespace WebSocketSharp {
|
||||
|
||||
public byte[] ToByteArray()
|
||||
{
|
||||
var buffer = new List<byte>();
|
||||
using (var buffer = new MemoryStream())
|
||||
{
|
||||
int header = (int)Fin;
|
||||
header = (header << 1) + (int)Rsv1;
|
||||
header = (header << 1) + (int)Rsv2;
|
||||
header = (header << 1) + (int)Rsv3;
|
||||
header = (header << 4) + (int)Opcode;
|
||||
header = (header << 1) + (int)Mask;
|
||||
header = (header << 7) + (int)PayloadLen;
|
||||
buffer.Write(((ushort)header).ToByteArray(ByteOrder.BIG), 0, 2);
|
||||
|
||||
int header = (int)Fin;
|
||||
header = (header << 1) + (int)Rsv1;
|
||||
header = (header << 1) + (int)Rsv2;
|
||||
header = (header << 1) + (int)Rsv3;
|
||||
header = (header << 4) + (int)Opcode;
|
||||
header = (header << 1) + (int)Mask;
|
||||
header = (header << 7) + (int)PayloadLen;
|
||||
buffer.AddRange(((ushort)header).ToByteArray(ByteOrder.BIG));
|
||||
if (PayloadLen > 125)
|
||||
buffer.Write(ExtPayloadLen, 0, ExtPayloadLen.Length);
|
||||
|
||||
if (PayloadLen >= 126)
|
||||
buffer.AddRange(ExtPayloadLen);
|
||||
if (Mask == Mask.MASK)
|
||||
buffer.Write(MaskingKey, 0, MaskingKey.Length);
|
||||
|
||||
if (IsMasked)
|
||||
buffer.AddRange(MaskingKey);
|
||||
if (PayloadLen > 0)
|
||||
{
|
||||
var payload = PayloadData.ToByteArray();
|
||||
if (PayloadLen < 127)
|
||||
buffer.Write(payload, 0, payload.Length);
|
||||
else
|
||||
buffer.WriteBytes(payload);
|
||||
}
|
||||
|
||||
if (PayloadLen > 0)
|
||||
buffer.AddRange(PayloadData.ToByteArray());
|
||||
|
||||
return buffer.ToArray();
|
||||
buffer.Close();
|
||||
return buffer.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -383,23 +383,6 @@
|
||||
A <see cref="T:System.String" /> to test.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
Determines whether two specified <see cref="T:System.String" /> objects don't have the same value.
|
||||
</summary>
|
||||
<returns>
|
||||
<c>true</c> if the value of <paramref name="expected" /> parameter isn't the same as the value of <paramref name="actual" /> parameter; otherwise, <c>false</c>.
|
||||
</returns>
|
||||
<param name="expected">
|
||||
The first <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="actual">
|
||||
The second <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="ignoreCase">
|
||||
A <see cref="T:System.Boolean" /> that indicates a case-sensitive or insensitive comparison. (<c>true</c> indicates a case-insensitive comparison.)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int32)">
|
||||
<summary>
|
||||
Reads a block of bytes from the specified <see cref="T:System.IO.Stream" />
|
||||
@@ -416,20 +399,6 @@
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64)">
|
||||
<summary>
|
||||
Reads a block of bytes from the specified stream and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
</summary>
|
||||
<returns>
|
||||
An array of <see cref="T:System.Byte" /> that receives the read data.
|
||||
</returns>
|
||||
<param name="stream">
|
||||
A <see cref="T:System.IO.Stream" /> that contains the data to read.
|
||||
</param>
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32)">
|
||||
<summary>
|
||||
Reads a block of bytes from the specified <see cref="T:System.IO.Stream" />
|
||||
and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
@@ -443,9 +412,6 @@
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
<param name="bufferLength">
|
||||
An <see cref="T:System.Int32" /> that contains the buffer size in bytes of each internal read.
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:WebSocketSharp.Ext.SubArray``1(``0[],System.Int32,System.Int32)">
|
||||
<summary>
|
||||
|
@@ -512,17 +512,6 @@
|
||||
<a href="#M:WebSocketSharp.Ext.MaybeUri(System.String)">MaybeUri</a>
|
||||
</b>(<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
|
||||
Determines whether the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> is a URI string.
|
||||
</blockquote></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div>static </div>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<b>
|
||||
<a href="#M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean)">NotEqual</a>
|
||||
</b>(<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
|
||||
Determines whether two specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> objects don't have the same value.
|
||||
</blockquote></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
@@ -545,17 +534,6 @@
|
||||
<b>
|
||||
<a href="#M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64)">ReadBytes</a>
|
||||
</b>(<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int64">long</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[]</nobr><blockquote>
|
||||
Reads a block of bytes from the specified stream and returns the read data in an array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>.
|
||||
</blockquote></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div>static </div>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<b>
|
||||
<a href="#M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32)">ReadBytes</a>
|
||||
</b>(<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int64">long</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[]</nobr><blockquote>
|
||||
Reads a block of bytes from the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a>
|
||||
and returns the read data in an array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>.
|
||||
</blockquote></td>
|
||||
@@ -1778,49 +1756,6 @@
|
||||
<b>Namespace: </b>WebSocketSharp<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
<h3 id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean)">NotEqual Method</h3>
|
||||
<blockquote id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean):member">
|
||||
<p class="Summary">
|
||||
Determines whether two specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> objects don't have the same value.
|
||||
</p>
|
||||
<h2>Syntax</h2>
|
||||
<div class="Signature">public static <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>NotEqual</b> (<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> expected, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> actual, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> ignoreCase)</div>
|
||||
<h4 class="Subsection">Parameters</h4>
|
||||
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean):Parameters">
|
||||
<dl>
|
||||
<dt>
|
||||
<i>expected</i>
|
||||
</dt>
|
||||
<dd>
|
||||
The first <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to compare.
|
||||
</dd>
|
||||
<dt>
|
||||
<i>actual</i>
|
||||
</dt>
|
||||
<dd>
|
||||
The second <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to compare.
|
||||
</dd>
|
||||
<dt>
|
||||
<i>ignoreCase</i>
|
||||
</dt>
|
||||
<dd>
|
||||
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> that indicates a case-sensitive or insensitive comparison. (<tt>true</tt> indicates a case-insensitive comparison.)
|
||||
</dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
<h4 class="Subsection">Returns</h4>
|
||||
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean):Returns">
|
||||
<tt>true</tt> if the value of <i>expected</i> parameter isn't the same as the value of <i>actual</i> parameter; otherwise, <tt>false</tt>.
|
||||
</blockquote>
|
||||
<h2 class="Section">Remarks</h2>
|
||||
<div class="SectionBox" id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean):Remarks">
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</div>
|
||||
<h2 class="Section">Requirements</h2>
|
||||
<div class="SectionBox" id="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean):Version Information">
|
||||
<b>Namespace: </b>WebSocketSharp<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
<h3 id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int32)">ReadBytes Method</h3>
|
||||
<blockquote id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int32):member">
|
||||
<p class="Summary">
|
||||
@@ -1862,7 +1797,8 @@
|
||||
<h3 id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64)">ReadBytes Method</h3>
|
||||
<blockquote id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64):member">
|
||||
<p class="Summary">
|
||||
Reads a block of bytes from the specified stream and returns the read data in an array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>.
|
||||
Reads a block of bytes from the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a>
|
||||
and returns the read data in an array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>.
|
||||
</p>
|
||||
<h2>Syntax</h2>
|
||||
<div class="Signature">public static <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[] <b>ReadBytes</b> (<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a> stream, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int64">long</a> length)</div>
|
||||
@@ -1896,50 +1832,6 @@
|
||||
<b>Namespace: </b>WebSocketSharp<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
<h3 id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32)">ReadBytes Method</h3>
|
||||
<blockquote id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32):member">
|
||||
<p class="Summary">
|
||||
Reads a block of bytes from the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a>
|
||||
and returns the read data in an array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>.
|
||||
</p>
|
||||
<h2>Syntax</h2>
|
||||
<div class="Signature">public static <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[] <b>ReadBytes</b> (<i>this</i> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a> stream, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int64">long</a> length, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> bufferLength)</div>
|
||||
<h4 class="Subsection">Parameters</h4>
|
||||
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32):Parameters">
|
||||
<dl>
|
||||
<dt>
|
||||
<i>stream</i>
|
||||
</dt>
|
||||
<dd>
|
||||
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.Stream">System.IO.Stream</a> that contains the data to read.
|
||||
</dd>
|
||||
<dt>
|
||||
<i>length</i>
|
||||
</dt>
|
||||
<dd>
|
||||
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int64">long</a> that contains the number of bytes to read.
|
||||
</dd>
|
||||
<dt>
|
||||
<i>bufferLength</i>
|
||||
</dt>
|
||||
<dd>
|
||||
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> that contains the buffer size in bytes of each internal read.
|
||||
</dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
<h4 class="Subsection">Returns</h4>
|
||||
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32):Returns">
|
||||
An array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a> that receives the read data.
|
||||
</blockquote>
|
||||
<h2 class="Section">Remarks</h2>
|
||||
<div class="SectionBox" id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32):Remarks">
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</div>
|
||||
<h2 class="Section">Requirements</h2>
|
||||
<div class="SectionBox" id="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32):Version Information">
|
||||
<b>Namespace: </b>WebSocketSharp<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
<h3 id="M:WebSocketSharp.Ext.SubArray``1(``0[],System.Int32,System.Int32)">SubArray<T> Generic Method</h3>
|
||||
<blockquote id="M:WebSocketSharp.Ext.SubArray``1(``0[],System.Int32,System.Int32):member">
|
||||
<p class="Summary">
|
||||
|
@@ -721,37 +721,6 @@
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="NotEqual">
|
||||
<MemberSignature Language="C#" Value="public static bool NotEqual (this string expected, string actual, bool ignoreCase);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool NotEqual(string expected, string actual, bool ignoreCase) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="expected" Type="System.String" RefType="this" />
|
||||
<Parameter Name="actual" Type="System.String" />
|
||||
<Parameter Name="ignoreCase" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="expected">
|
||||
The first <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="actual">
|
||||
The second <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="ignoreCase">
|
||||
A <see cref="T:System.Boolean" /> that indicates a case-sensitive or insensitive comparison. (<c>true</c> indicates a case-insensitive comparison.)
|
||||
</param>
|
||||
<summary>
|
||||
Determines whether two specified <see cref="T:System.String" /> objects don't have the same value.
|
||||
</summary>
|
||||
<returns>
|
||||
<c>true</c> if the value of <paramref name="expected" /> parameter isn't the same as the value of <paramref name="actual" /> parameter; otherwise, <c>false</c>.
|
||||
</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ReadBytes">
|
||||
<MemberSignature Language="C#" Value="public static byte[] ReadBytes (this System.IO.Stream stream, int length);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig unsigned int8[] ReadBytes(class System.IO.Stream stream, int32 length) cil managed" />
|
||||
@@ -798,37 +767,6 @@
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
<summary>
|
||||
Reads a block of bytes from the specified stream and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
</summary>
|
||||
<returns>
|
||||
An array of <see cref="T:System.Byte" /> that receives the read data.
|
||||
</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ReadBytes">
|
||||
<MemberSignature Language="C#" Value="public static byte[] ReadBytes (this System.IO.Stream stream, long length, int bufferLength);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig unsigned int8[] ReadBytes(class System.IO.Stream stream, int64 length, int32 bufferLength) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Byte[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="stream" Type="System.IO.Stream" RefType="this" />
|
||||
<Parameter Name="length" Type="System.Int64" />
|
||||
<Parameter Name="bufferLength" Type="System.Int32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="stream">
|
||||
A <see cref="T:System.IO.Stream" /> that contains the data to read.
|
||||
</param>
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
<param name="bufferLength">
|
||||
An <see cref="T:System.Int32" /> that contains the buffer size in bytes of each internal read.
|
||||
</param>
|
||||
<summary>
|
||||
Reads a block of bytes from the specified <see cref="T:System.IO.Stream" />
|
||||
and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Overview>
|
||||
<Assemblies>
|
||||
<Assembly Name="websocket-sharp" Version="1.0.2.3113">
|
||||
<Assembly Name="websocket-sharp" Version="1.0.2.41351">
|
||||
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 11 00 00 00 29 17 fb 89 fe c3 91 f7 2b cb 8b e2 61 d2 3f 05 93 6d 65 a8 9e 63 72 a6 f5 d5 2c f2 9d 20 fa 0b c0 70 6a f6 88 7e 8b 90 3f 39 f5 76 c8 48 e0 bb 7b b2 7b ed d3 10 a7 1a 0f 70 98 0f 7f f4 4b 53 09 d2 a5 ef 36 c3 56 b4 aa f0 91 72 63 25 07 89 e0 93 3e 3f 2e f2 b9 73 0e 12 15 5d 43 56 c3 f4 70 a5 89 fe f7 f6 ac 3e 77 c2 d8 d0 84 91 f4 0c d1 f3 8e dc c3 c3 b8 38 3d 0c bf 17 de 20 78 c1 ]</AssemblyPublicKey>
|
||||
<Attributes>
|
||||
<Attribute>
|
||||
@@ -810,39 +810,6 @@
|
||||
<Link Type="WebSocketSharp.Ext" Member="M:WebSocketSharp.Ext.MaybeUri(System.String)" />
|
||||
</Member>
|
||||
</ExtensionMethod>
|
||||
<ExtensionMethod>
|
||||
<Targets>
|
||||
<Target Type="T:System.String" />
|
||||
</Targets>
|
||||
<Member MemberName="NotEqual">
|
||||
<MemberSignature Language="C#" Value="public static bool NotEqual (this string expected, string actual, bool ignoreCase);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool NotEqual(string expected, string actual, bool ignoreCase) cil managed" />
|
||||
<MemberType>ExtensionMethod</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="expected" Type="System.String" RefType="this" />
|
||||
<Parameter Name="actual" Type="System.String" />
|
||||
<Parameter Name="ignoreCase" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="expected">
|
||||
The first <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="actual">
|
||||
The second <see cref="T:System.String" /> to compare.
|
||||
</param>
|
||||
<param name="ignoreCase">
|
||||
A <see cref="T:System.Boolean" /> that indicates a case-sensitive or insensitive comparison. (<c>true</c> indicates a case-insensitive comparison.)
|
||||
</param>
|
||||
<summary>
|
||||
Determines whether two specified <see cref="T:System.String" /> objects don't have the same value.
|
||||
</summary>
|
||||
</Docs>
|
||||
<Link Type="WebSocketSharp.Ext" Member="M:WebSocketSharp.Ext.NotEqual(System.String,System.String,System.Boolean)" />
|
||||
</Member>
|
||||
</ExtensionMethod>
|
||||
<ExtensionMethod>
|
||||
<Targets>
|
||||
<Target Type="T:System.IO.Stream" />
|
||||
@@ -895,45 +862,12 @@
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
<summary>
|
||||
Reads a block of bytes from the specified stream and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
</summary>
|
||||
</Docs>
|
||||
<Link Type="WebSocketSharp.Ext" Member="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64)" />
|
||||
</Member>
|
||||
</ExtensionMethod>
|
||||
<ExtensionMethod>
|
||||
<Targets>
|
||||
<Target Type="T:System.IO.Stream" />
|
||||
</Targets>
|
||||
<Member MemberName="ReadBytes">
|
||||
<MemberSignature Language="C#" Value="public static byte[] ReadBytes (this System.IO.Stream stream, long length, int bufferLength);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig unsigned int8[] ReadBytes(class System.IO.Stream stream, int64 length, int32 bufferLength) cil managed" />
|
||||
<MemberType>ExtensionMethod</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Byte[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="stream" Type="System.IO.Stream" RefType="this" />
|
||||
<Parameter Name="length" Type="System.Int64" />
|
||||
<Parameter Name="bufferLength" Type="System.Int32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="stream">
|
||||
A <see cref="T:System.IO.Stream" /> that contains the data to read.
|
||||
</param>
|
||||
<param name="length">
|
||||
A <see cref="T:System.Int64" /> that contains the number of bytes to read.
|
||||
</param>
|
||||
<param name="bufferLength">
|
||||
An <see cref="T:System.Int32" /> that contains the buffer size in bytes of each internal read.
|
||||
</param>
|
||||
<summary>
|
||||
Reads a block of bytes from the specified <see cref="T:System.IO.Stream" />
|
||||
and returns the read data in an array of <see cref="T:System.Byte" />.
|
||||
</summary>
|
||||
</Docs>
|
||||
<Link Type="WebSocketSharp.Ext" Member="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64,System.Int32)" />
|
||||
<Link Type="WebSocketSharp.Ext" Member="M:WebSocketSharp.Ext.ReadBytes(System.IO.Stream,System.Int64)" />
|
||||
</Member>
|
||||
</ExtensionMethod>
|
||||
<ExtensionMethod>
|
||||
|
Reference in New Issue
Block a user