This commit is contained in:
2022-04-24 09:05:15 +04:00
commit b26e7c1402
60 changed files with 3887 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
using System;
using NetStack.Serialization;
namespace Ragon.Common
{
public static class BitBufferExtension
{
public static BitBuffer AddBytes(this BitBuffer buffer, byte[] data)
{
buffer.AddInt(data.Length);
foreach (var b in data)
buffer.AddByte(b);
return buffer;
}
public static byte[] ReadBytes(this BitBuffer buffer)
{
var size = buffer.ReadInt();
var data = new byte[size];
var i = 0;
while (i < size)
data[i] = buffer.ReadByte();
return data;
}
}
}