Added NightAlert project for travel kit
This commit is contained in:
41
ThirdParty/EngineIoClientDotNet/Src/EngineIoClientDotNet.mono/Parser/Buffer.cs
vendored
Normal file
41
ThirdParty/EngineIoClientDotNet/Src/EngineIoClientDotNet.mono/Parser/Buffer.cs
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace Quobject.EngineIoClientDotNet.Parser
|
||||
{
|
||||
internal class Buffer
|
||||
{
|
||||
|
||||
private Buffer()
|
||||
{
|
||||
}
|
||||
|
||||
public static byte[] Concat(byte[][] list)
|
||||
{
|
||||
int length = 0;
|
||||
foreach (var buf in list)
|
||||
{
|
||||
length += buf.Length;
|
||||
}
|
||||
|
||||
return Concat(list, length);
|
||||
}
|
||||
|
||||
public static byte[] Concat(byte[][] list, int length)
|
||||
{
|
||||
if (list.Length == 0)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
if (list.Length == 1)
|
||||
{
|
||||
return list[0];
|
||||
}
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.Allocate(length);
|
||||
foreach (var buf in list)
|
||||
{
|
||||
buffer.Put(buf);
|
||||
}
|
||||
|
||||
return buffer.Array();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user