summaryrefslogtreecommitdiff
path: root/Impostor-dev/src/Impostor.Api/Net/Messages/IMessageReader.cs
blob: 87c06c4488648f3d6a4c925a7bc2817bc78282f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;

namespace Impostor.Api.Net.Messages
{
    public interface IMessageReader : IDisposable
    {
        /// <summary>
        ///     Gets the tag of the message.
        /// </summary>
        byte Tag { get; }

        /// <summary>
        ///     Gets the buffer of the message.
        /// </summary>
        byte[] Buffer { get; }

        /// <summary>
        ///     Gets the offset of our current <see cref="IMessageReader"/> in the entire <see cref="Buffer"/>.
        /// </summary>
        int Offset { get; }

        /// <summary>
        ///     Gets the current position of the reader.
        /// </summary>
        int Position { get; }

        /// <summary>
        ///     Gets the length of the buffer.
        /// </summary>
        int Length { get; }

        IMessageReader ReadMessage();

        bool ReadBoolean();

        sbyte ReadSByte();

        byte ReadByte();

        ushort ReadUInt16();

        short ReadInt16();

        uint ReadUInt32();

        int ReadInt32();

        float ReadSingle();

        string ReadString();

        ReadOnlyMemory<byte> ReadBytesAndSize();

        ReadOnlyMemory<byte> ReadBytes(int length);

        int ReadPackedInt32();

        uint ReadPackedUInt32();

        void CopyTo(IMessageWriter writer);

        void Seek(int position);

        void RemoveMessage(IMessageReader message);

        IMessageReader Copy(int offset = 0);
    }
}