Table of Contents

Class GameSpy1

Namespace
OpenGSQ.Protocols
Assembly
OpenGSQ.dll

Gamespy Query Protocol version 1

public class GameSpy1 : ProtocolBase
Inheritance
GameSpy1
Inherited Members

Constructors

GameSpy1(string, int, int)

Initializes a new instance of the GameSpy1 class.

public GameSpy1(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.

Properties

FullName

Gets the full name of the protocol.

public override string FullName { get; }

Property Value

string

Methods

GetBasic()

Gets basic server information, mainly for recognition.

public Task<Dictionary<string, string>> GetBasic()

Returns

Task<Dictionary<string, string>>

A dictionary containing the basic server information.

Exceptions

TimeoutException

Thrown when the operation times out.

GetEcho(string)

Sends an echo command to the server. The server will return the argument.

public Task<Dictionary<string, string>> GetEcho(string text = "this is a test")

Parameters

text string

The text to send with the echo command.

Returns

Task<Dictionary<string, string>>

A dictionary containing the server's response.

Exceptions

TimeoutException

Thrown when the operation times out.

GetInfo(bool)

Gets information about the current game running on the server.

public Task<Dictionary<string, string>> GetInfo(bool XServerQuery = true)

Parameters

XServerQuery bool

A boolean indicating whether to use XServerQuery.

Returns

Task<Dictionary<string, string>>

A dictionary containing the game information.

Exceptions

TimeoutException

Thrown when the operation times out.

GetPlayers(bool)

Returns information about each player on the server.

public Task<List<Dictionary<string, string>>> GetPlayers(bool XServerQuery = true)

Parameters

XServerQuery bool

A boolean indicating whether to use XServerQuery.

Returns

Task<List<Dictionary<string, string>>>

A list of dictionaries containing the player information.

Exceptions

TimeoutException

Thrown when the operation times out.

GetRules(bool)

Gets the settings for the current game, returns sets of rules depends on the running game type.

public Task<Dictionary<string, string>> GetRules(bool XServerQuery = true)

Parameters

XServerQuery bool

A boolean indicating whether to use XServerQuery.

Returns

Task<Dictionary<string, string>>

A dictionary containing the game rules.

Exceptions

TimeoutException

Thrown when the operation times out.

GetStatus(bool)

Gets the status of the server. If the server uses XServerQuery, it sends the new information, otherwise it gives back the old information.

public Task<Status> GetStatus(bool XServerQuery = true)

Parameters

XServerQuery bool

A boolean indicating whether to use XServerQuery.

Returns

Task<Status>

A Status object containing the server information, players, and teams.

Exceptions

TimeoutException

Thrown when the operation times out.

GetTeams()

Returns information about each team on the server.

public Task<List<Dictionary<string, string>>> GetTeams()

Returns

Task<List<Dictionary<string, string>>>

A list of dictionaries containing the team information.

Exceptions

TimeoutException

Thrown when the operation times out.