-
Notifications
You must be signed in to change notification settings - Fork 8
Network
Andrey edited this page Jun 2, 2023
·
11 revisions
The game interacts with the server via the http protocol.
There are ready-made methods of popular queries for you in the library, they are implemented in the GameClient class
The client is created through the constructor
| Parameter | Type | Description | Default |
|---|---|---|---|
| identifierQuery | IdentifierQuery | Represents a uuid and udid parameters of the client |
null (IdentifierQuery.Default) |
| onlineQuery | OnlineQuery | Represents a gameVersion, binaryVersion, gdw and secret parameters of the client |
null (OnlineQuery.Default) |
| network | Network | The class that allows you to make http requests to the server Learn more |
null (new Network()) |
To interact with the official game server
var client = new GameClient();var server = new GameServer(
network: new Network(server: "http://game.gdpseditor.com/server")
);var user = await client.SearchUserAsync("user name");var account = await client.GetAccountAsync(accountId: 71);You can get the accountId from the user search
var user = await client.SearchUserAsync("user name");
if (user.GeometryDashStatusCode != 0)
Console.WriteLine("error when searching for a user");
var account = client.GetAccountAsync(user.GetResultOrDefault().User.AccountId);The Network class represents interaction over the http protocol
You can create Network like this
var network = new Network(server, httpClientFactory, responseFilter);| Parameter | Type | Description | Default |
|---|---|---|---|
| server | string | The base url to the server to which requests will be sent | http://www.boomlings.com/database |
| httpClientFactory | IFactory<HttpClient> | A factory for creating http clients, with which you can configure timeouts, headers, and so on Learn more to create your own http client factory |
null (DefaultHttpClientFactory) |
| responseFilter | Func<string, bool> | Useless feature for manually filtering the response (For example, if suddenly cloudflare gives you html) | null |
using System;
using System.Net.Http;
public class YourHttpFactory : IFactory<HttpClient>
{
public HttpClient Create()
{
return new HttpClient()
{
Timeout = TimeSpan.FromSeconds(20),
};
}
}