Table of Contents

Class Quake1

Namespace
OpenGSQ.Protocols
Assembly
OpenGSQ.dll

Quake1 Query Protocol

public class Quake1 : ProtocolBase
Inheritance
Quake1
Derived
Inherited Members

Constructors

Quake1(string, int, int)

Initializes a new instance of the Quake1 class.

public Quake1(string host, int port, int timeout = 5000)

Parameters

host string

The IP address of the server.

port int

The port number of the server.

timeout int

The timeout for the connection in milliseconds.

Fields

Delimiter1

The ASCII value of the backslash character used as a delimiter.

protected byte Delimiter1

Field Value

byte

Delimiter2

The ASCII value of the newline character used as a delimiter.

protected byte Delimiter2

Field Value

byte

RequestHeader

The header of the request.

protected string RequestHeader

Field Value

string

ResponseHeader

The header of the response.

protected string ResponseHeader

Field Value

string

Properties

FullName

Gets the full name of the protocol.

public override string FullName { get; }

Property Value

string

Methods

ConnectAndSend(string)

Connects to the server and sends a request.

protected Task<byte[]> ConnectAndSend(string request)

Parameters

request string

The request to send.

Returns

Task<byte[]>

The response data received from the server.

Exceptions

TimeoutException

Thrown when the operation times out.

GetPlayerMatchCollections(BinaryReader)

Gets a list of MatchCollection objects for each player.

protected List<MatchCollection> GetPlayerMatchCollections(BinaryReader br)

Parameters

br BinaryReader

The BinaryReader containing the player information.

Returns

List<MatchCollection>

A list of MatchCollection objects for each player.

GetResponseBinaryReader()

Gets a BinaryReader for the response data.

protected Task<BinaryReader> GetResponseBinaryReader()

Returns

Task<BinaryReader>

A BinaryReader for the response data.

Exceptions

InvalidPacketException

Thrown when the packet header does not match the expected header.

GetStatus()

Gets the status of the server including information and players.

public Task<Status> GetStatus()

Returns

Task<Status>

A Status object containing the server information and players.

Exceptions

InvalidPacketException

Thrown when the packet header does not match the expected header.

TimeoutException

Thrown when the operation times out.

ParseInfo(BinaryReader)

Parses the server information from the BinaryReader.

protected Dictionary<string, string> ParseInfo(BinaryReader br)

Parameters

br BinaryReader

The BinaryReader containing the server information.

Returns

Dictionary<string, string>

A dictionary containing the server information.

ParsePlayers(BinaryReader)

Parses the player information from the BinaryReader.

protected List<Player> ParsePlayers(BinaryReader br)

Parameters

br BinaryReader

The BinaryReader containing the player information.

Returns

List<Player>

A list of Player objects.