Modified ByteOrder enum values to PascalCase values
This commit is contained in:
parent
2e853fca63
commit
46fc6f927f
@ -165,15 +165,15 @@ namespace Example1
|
|||||||
int ch_num = buffer_array.GetLength(0);
|
int ch_num = buffer_array.GetLength(0);
|
||||||
int buffer_length = buffer_array.GetLength(1);
|
int buffer_length = buffer_array.GetLength(1);
|
||||||
|
|
||||||
msg.AddRange(user_id.ToByteArray(ByteOrder.BIG));
|
msg.AddRange(user_id.ToByteArray(ByteOrder.Big));
|
||||||
msg.Add((byte)ch_num);
|
msg.Add((byte)ch_num);
|
||||||
msg.AddRange(((uint)buffer_length).ToByteArray(ByteOrder.BIG));
|
msg.AddRange(((uint)buffer_length).ToByteArray(ByteOrder.Big));
|
||||||
|
|
||||||
ch_num.Times(i =>
|
ch_num.Times(i =>
|
||||||
{
|
{
|
||||||
buffer_length.Times(j =>
|
buffer_length.Times(j =>
|
||||||
{
|
{
|
||||||
msg.AddRange(buffer_array[i, j].ToByteArray(ByteOrder.BIG));
|
msg.AddRange(buffer_array[i, j].ToByteArray(ByteOrder.Big));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ namespace Example1
|
|||||||
|
|
||||||
private AudioMessage parseAudioMessage(byte[] data)
|
private AudioMessage parseAudioMessage(byte[] data)
|
||||||
{
|
{
|
||||||
uint user_id = data.SubArray(0, 4).To<uint>(ByteOrder.BIG);
|
uint user_id = data.SubArray(0, 4).To<uint>(ByteOrder.Big);
|
||||||
byte ch_num = data.SubArray(4, 1)[0];
|
byte ch_num = data.SubArray(4, 1)[0];
|
||||||
uint buffer_length = data.SubArray(5, 4).To<uint>(ByteOrder.BIG);
|
uint buffer_length = data.SubArray(5, 4).To<uint>(ByteOrder.Big);
|
||||||
float[,] buffer_array = new float[ch_num, buffer_length];
|
float[,] buffer_array = new float[ch_num, buffer_length];
|
||||||
|
|
||||||
int offset = 9;
|
int offset = 9;
|
||||||
@ -205,7 +205,7 @@ namespace Example1
|
|||||||
{
|
{
|
||||||
buffer_length.Times(j =>
|
buffer_length.Times(j =>
|
||||||
{
|
{
|
||||||
buffer_array[i, j] = data.SubArray(offset, 4).To<float>(ByteOrder.BIG);
|
buffer_array[i, j] = data.SubArray(offset, 4).To<float>(ByteOrder.Big);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2013 sta.blockhead
|
* Copyright (c) 2012-2014 sta.blockhead
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
@ -38,10 +38,10 @@ namespace WebSocketSharp {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates a Little-endian.
|
/// Indicates a Little-endian.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LITTLE,
|
Little,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates a Big-endian.
|
/// Indicates a Big-endian.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BIG
|
Big
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace WebSocketSharp
|
|||||||
private static ushort getCodeFrom (byte [] data)
|
private static ushort getCodeFrom (byte [] data)
|
||||||
{
|
{
|
||||||
return data.Length > 1
|
return data.Length > 1
|
||||||
? data.SubArray (0, 2).ToUInt16 (ByteOrder.BIG)
|
? data.SubArray (0, 2).ToUInt16 (ByteOrder.Big)
|
||||||
: (ushort) CloseStatusCode.NO_STATUS_CODE;
|
: (ushort) CloseStatusCode.NO_STATUS_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ namespace WebSocketSharp
|
|||||||
internal static byte [] Append (this ushort code, string reason)
|
internal static byte [] Append (this ushort code, string reason)
|
||||||
{
|
{
|
||||||
using (var buffer = new MemoryStream ()) {
|
using (var buffer = new MemoryStream ()) {
|
||||||
var tmp = code.ToByteArrayInternally (ByteOrder.BIG);
|
var tmp = code.ToByteArrayInternally (ByteOrder.Big);
|
||||||
buffer.Write (tmp, 0, 2);
|
buffer.Write (tmp, 0, 2);
|
||||||
if (reason != null && reason.Length > 0) {
|
if (reason != null && reason.Length > 0) {
|
||||||
tmp = Encoding.UTF8.GetBytes (reason);
|
tmp = Encoding.UTF8.GetBytes (reason);
|
||||||
@ -1277,7 +1277,7 @@ namespace WebSocketSharp
|
|||||||
{
|
{
|
||||||
// true : !(true ^ true) or !(false ^ false)
|
// true : !(true ^ true) or !(false ^ false)
|
||||||
// false: !(true ^ false) or !(false ^ true)
|
// false: !(true ^ false) or !(false ^ true)
|
||||||
return !(BitConverter.IsLittleEndian ^ (order == ByteOrder.LITTLE));
|
return !(BitConverter.IsLittleEndian ^ (order == ByteOrder.Little));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -88,7 +88,7 @@ namespace WebSocketSharp
|
|||||||
internal bool ContainsReservedCloseStatusCode {
|
internal bool ContainsReservedCloseStatusCode {
|
||||||
get {
|
get {
|
||||||
return ApplicationData.Length > 1
|
return ApplicationData.Length > 1
|
||||||
? ApplicationData.SubArray (0, 2).ToUInt16 (ByteOrder.BIG).IsReserved ()
|
? ApplicationData.SubArray (0, 2).ToUInt16 (ByteOrder.Big).IsReserved ()
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ namespace WebSocketSharp.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
_services.Stop (
|
_services.Stop (
|
||||||
((ushort) CloseStatusCode.SERVER_ERROR).ToByteArrayInternally (ByteOrder.BIG), true);
|
((ushort) CloseStatusCode.SERVER_ERROR).ToByteArrayInternally (ByteOrder.Big), true);
|
||||||
|
|
||||||
_listener.Abort ();
|
_listener.Abort ();
|
||||||
_state = ServerState.Stop;
|
_state = ServerState.Stop;
|
||||||
|
@ -466,7 +466,7 @@ namespace WebSocketSharp.Server
|
|||||||
|
|
||||||
_listener.Stop ();
|
_listener.Stop ();
|
||||||
_services.Stop (
|
_services.Stop (
|
||||||
((ushort) CloseStatusCode.SERVER_ERROR).ToByteArrayInternally (ByteOrder.BIG), true);
|
((ushort) CloseStatusCode.SERVER_ERROR).ToByteArrayInternally (ByteOrder.Big), true);
|
||||||
|
|
||||||
_state = ServerState.Stop;
|
_state = ServerState.Stop;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ namespace WebSocketSharp.Server
|
|||||||
|
|
||||||
if (host.Sessions.State == ServerState.Start)
|
if (host.Sessions.State == ServerState.Start)
|
||||||
host.Sessions.Stop (
|
host.Sessions.Stop (
|
||||||
((ushort) CloseStatusCode.AWAY).ToByteArrayInternally (ByteOrder.BIG), true);
|
((ushort) CloseStatusCode.AWAY).ToByteArrayInternally (ByteOrder.Big), true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,8 +102,8 @@ namespace WebSocketSharp
|
|||||||
ExtPayloadLen = payloadLen < 126
|
ExtPayloadLen = payloadLen < 126
|
||||||
? new byte []{}
|
? new byte []{}
|
||||||
: payloadLen == 126
|
: payloadLen == 126
|
||||||
? ((ushort) dataLen).ToByteArrayInternally (ByteOrder.BIG)
|
? ((ushort) dataLen).ToByteArrayInternally (ByteOrder.Big)
|
||||||
: dataLen.ToByteArrayInternally (ByteOrder.BIG);
|
: dataLen.ToByteArrayInternally (ByteOrder.Big);
|
||||||
|
|
||||||
/* MaskingKey */
|
/* MaskingKey */
|
||||||
|
|
||||||
@ -451,8 +451,8 @@ namespace WebSocketSharp
|
|||||||
ulong dataLen = payloadLen < 126
|
ulong dataLen = payloadLen < 126
|
||||||
? payloadLen
|
? payloadLen
|
||||||
: payloadLen == 126
|
: payloadLen == 126
|
||||||
? extPayloadLen.ToUInt16 (ByteOrder.BIG)
|
? extPayloadLen.ToUInt16 (ByteOrder.Big)
|
||||||
: extPayloadLen.ToUInt64 (ByteOrder.BIG);
|
: extPayloadLen.ToUInt64 (ByteOrder.Big);
|
||||||
|
|
||||||
byte [] data = null;
|
byte [] data = null;
|
||||||
if (dataLen > 0)
|
if (dataLen > 0)
|
||||||
@ -502,9 +502,9 @@ namespace WebSocketSharp
|
|||||||
var ext = frame.ExtPayloadLen;
|
var ext = frame.ExtPayloadLen;
|
||||||
var size = ext.Length;
|
var size = ext.Length;
|
||||||
var extLen = size == 2
|
var extLen = size == 2
|
||||||
? ext.ToUInt16 (ByteOrder.BIG).ToString ()
|
? ext.ToUInt16 (ByteOrder.Big).ToString ()
|
||||||
: size == 8
|
: size == 8
|
||||||
? ext.ToUInt64 (ByteOrder.BIG).ToString ()
|
? ext.ToUInt64 (ByteOrder.Big).ToString ()
|
||||||
: String.Empty;
|
: String.Empty;
|
||||||
|
|
||||||
/* Masking Key */
|
/* Masking Key */
|
||||||
@ -677,7 +677,7 @@ Extended Payload Len: {7}
|
|||||||
header = (header << 4) + (int) Opcode;
|
header = (header << 4) + (int) Opcode;
|
||||||
header = (header << 1) + (int) Mask;
|
header = (header << 1) + (int) Mask;
|
||||||
header = (header << 7) + (int) PayloadLen;
|
header = (header << 7) + (int) PayloadLen;
|
||||||
buffer.Write (((ushort) header).ToByteArrayInternally (ByteOrder.BIG), 0, 2);
|
buffer.Write (((ushort) header).ToByteArrayInternally (ByteOrder.Big), 0, 2);
|
||||||
|
|
||||||
if (PayloadLen > 125)
|
if (PayloadLen > 125)
|
||||||
buffer.Write (ExtPayloadLen, 0, ExtPayloadLen.Length);
|
buffer.Write (ExtPayloadLen, 0, ExtPayloadLen.Length);
|
||||||
|
Loading…
Reference in New Issue
Block a user