2022-08-13 02:19:40 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace RageCoop.Core
|
|
|
|
|
{
|
|
|
|
|
internal partial class Packets
|
|
|
|
|
{
|
|
|
|
|
internal class Voice : Packet
|
|
|
|
|
{
|
|
|
|
|
public byte[] Buffer { get; set; }
|
2022-08-13 03:39:11 +02:00
|
|
|
|
public int Recorded { get; set; }
|
2022-08-13 02:19:40 +02:00
|
|
|
|
public override PacketType Type => PacketType.Voice;
|
|
|
|
|
public override byte[] Serialize()
|
|
|
|
|
{
|
2022-08-13 03:39:11 +02:00
|
|
|
|
var data = new List<byte>();
|
|
|
|
|
data.AddArray(Buffer);
|
|
|
|
|
data.AddInt(Recorded);
|
|
|
|
|
return data.ToArray();
|
2022-08-13 02:19:40 +02:00
|
|
|
|
}
|
|
|
|
|
public override void Deserialize(byte[] array)
|
|
|
|
|
{
|
2022-08-13 03:39:11 +02:00
|
|
|
|
var reader = new BitReader(array);
|
|
|
|
|
Buffer = reader.ReadByteArray();
|
|
|
|
|
Recorded = reader.ReadInt32();
|
2022-08-13 02:19:40 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|