This commit is contained in:
/
2024-12-29 21:15:58 +01:00
commit 547655c326
77 changed files with 7313 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using System;
using VRage.Library.Collections;
namespace Global.Util
{
internal class SendBuffer : IBitSerializable
{
public int NumElements;
public long SenderUserId;
public byte[] VoiceDataBuffer;
public bool Serialize(BitStream stream, bool validate, bool acceptAndSetValue = true)
{
if (stream.Reading)
{
SenderUserId = stream.ReadInt64();
NumElements = stream.ReadInt32();
ArrayExtensions.EnsureCapacity(ref VoiceDataBuffer, NumElements);
stream.ReadBytes(VoiceDataBuffer, 0, NumElements);
}
else
{
stream.WriteInt64(SenderUserId);
stream.WriteInt32(NumElements);
stream.WriteBytes(VoiceDataBuffer, 0, NumElements);
}
return true;
}
public static implicit operator BitReaderWriter(SendBuffer buffer)
{
return new BitReaderWriter(buffer);
}
}
}