2018-11-30 23:58:00 -05:00
|
|
|
using System.IO;
|
2017-04-01 21:01:50 -04:00
|
|
|
|
2018-02-08 17:05:02 -06:00
|
|
|
namespace ACE.Server.Network
|
2017-04-01 21:01:50 -04:00
|
|
|
{
|
|
|
|
|
public class ClientMessage
|
|
|
|
|
{
|
|
|
|
|
public MemoryStream Data { get; }
|
2017-04-04 12:44:57 -04:00
|
|
|
|
2023-12-25 03:20:38 +00:00
|
|
|
public BinaryReader Payload { get; }
|
|
|
|
|
|
2017-04-01 21:01:50 -04:00
|
|
|
public uint Opcode { get; }
|
|
|
|
|
|
2023-12-25 03:20:38 +00:00
|
|
|
/// <exception cref="EndOfStreamException">stream must be at least 4 bytes in length remaining to read</exception>
|
2017-04-01 21:01:50 -04:00
|
|
|
public ClientMessage(MemoryStream stream)
|
|
|
|
|
{
|
|
|
|
|
Data = stream;
|
|
|
|
|
Payload = new BinaryReader(Data);
|
|
|
|
|
Opcode = Payload.ReadUInt32();
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-25 03:20:38 +00:00
|
|
|
/// <exception cref="EndOfStreamException">data must be at least 4 bytes in length</exception>
|
2017-04-01 21:01:50 -04:00
|
|
|
public ClientMessage(byte[] data)
|
|
|
|
|
{
|
|
|
|
|
Data = new MemoryStream(data);
|
|
|
|
|
Payload = new BinaryReader(Data);
|
|
|
|
|
Opcode = Payload.ReadUInt32();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|