using System; using System.Net; using Impostor.Api.Games; namespace Impostor.Api.Net.Messages { /// /// Base message writer. /// public interface IMessageWriter : IDisposable { public byte[] Buffer { get; } public int Length { get; set; } public int Position { get; set; } public MessageType SendOption { get; } /// /// Writes a boolean to the message. /// /// Value to write. void Write(bool value); /// /// Writes a sbyte to the message. /// /// Value to write. void Write(sbyte value); /// /// Writes a byte to the message. /// /// Value to write. void Write(byte value); /// /// Writes a short to the message. /// /// Value to write. void Write(short value); /// /// Writes an ushort to the message. /// /// Value to write. void Write(ushort value); /// /// Writes an uint to the message. /// /// Value to write. void Write(uint value); /// /// Writes an int to the message. /// /// Value to write. void Write(int value); /// /// Writes a float to the message. /// /// Value to write. void Write(float value); /// /// Writes a string to the message. /// /// Value to write. void Write(string value); /// /// Writes a to the message. /// /// Value to write. void Write(IPAddress value); /// /// Writes an packed int to the message. /// /// Value to write. void WritePacked(int value); /// /// Writes an packed uint to the message. /// /// Value to write. void WritePacked(uint value); /// /// Writes raw bytes to the message. /// /// Bytes to write. void Write(ReadOnlyMemory data); /// /// Writes a game code to the message. /// /// Value to write. void Write(GameCode value); void WriteBytesAndSize(byte[] bytes); void WriteBytesAndSize(byte[] bytes, int length); void WriteBytesAndSize(byte[] bytes, int offset, int length); /// /// Starts a new message. /// /// Message flag header. void StartMessage(byte typeFlag); /// /// Mark the end of the message. /// void EndMessage(); /// /// Clear the message writer. /// /// New type of the message. void Clear(MessageType type); } }