Table of Contents

Interface IPacket

Namespace
Xabbo.Messages
Assembly
Xabbo.Common.dll

Represents a packet of data with a message header.

public interface IPacket : IDisposable
Inherited Members

Properties

Buffer

Gets the packet's buffer.

PacketBuffer Buffer { get; }

Property Value

PacketBuffer

Client

Gets the client type of the packet's header.

ClientType Client { get; }

Property Value

ClientType

Context

Gets the context this packet was intercepted in.

IParserContext? Context { get; }

Property Value

IParserContext

Header

Gets or sets the message header of the packet.

Header Header { get; set; }

Property Value

Header

Length

Gets the length of the packet.

int Length { get; }

Property Value

int

Position

Gets a reference to the current position in the packet.

ref int Position { get; }

Property Value

int

Methods

Allocate(int)

Allocates the specified number of bytes from the current position and returns the allocated range as a Span<T> of bytes.

Span<byte> Allocate(int n)

Parameters

n int

Returns

Span<byte>

Clear()

Clears the packet's buffer and resets its position.

void Clear()

Copy()

Creates a copy of this packet.

IPacket Copy()

Returns

IPacket

ReadContent()

Reads the contents of the packet as a string and advances the position to the end of the packet. The position must be at the start of the packet.

Only supported on Shockwave.
string ReadContent()

Returns

string

ReadSpan(int)

Reads a Span<T> of bytes of length n from the current position and advances it.

ReadOnlySpan<byte> ReadSpan(int n)

Parameters

n int

The number of bytes to read.

Returns

ReadOnlySpan<byte>

Exceptions

IndexOutOfRangeException

If the current position plus the specified length exceeds the length of the packet.

Reader()

Creates a new reader for this packet at the current position.

PacketReader Reader()

Returns

PacketReader

ReaderAt(ref int)

Creates a new reader for this packet at the specified position.

PacketReader ReaderAt(ref int pos)

Parameters

pos int

Returns

PacketReader

WriteContent(string)

Replaces the packet buffer with the specified content and advances the position to the end of the packet. The position must be at the start of the packet.

Only supported on Shockwave.
void WriteContent(string content)

Parameters

content string

WriteSpan(ReadOnlySpan<byte>)

Writes the specified Span<T> of bytes to the current position.

void WriteSpan(ReadOnlySpan<byte> bytes)

Parameters

bytes ReadOnlySpan<byte>

Writer()

Creates a new writer for this packet at the current position.

PacketWriter Writer()

Returns

PacketWriter

WriterAt(ref int)

Creates a new writer for this packet at the specified position.

PacketWriter WriterAt(ref int pos)

Parameters

pos int

Returns

PacketWriter