|
1 | 1 | using SteamQueryNet.Interfaces; |
2 | 2 | using SteamQueryNet.Models; |
| 3 | +using SteamQueryNet.Services; |
3 | 4 | using SteamQueryNet.Utils; |
4 | 5 |
|
5 | 6 | using System; |
|
13 | 14 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SteamQueryNet.Tests")] |
14 | 15 | namespace SteamQueryNet |
15 | 16 | { |
16 | | - // This is not really required but imma be a good guy and create this for them people that wants to mock the ServerQuery. |
17 | | - public interface IServerQuery |
18 | | - { |
19 | | - /// <summary> |
20 | | - /// Renews the server challenge code of the ServerQuery instance in order to be able to execute further operations. |
21 | | - /// </summary> |
22 | | - /// <returns>The new created challenge.</returns> |
23 | | - int RenewChallenge(); |
24 | | - |
25 | | - /// <summary> |
26 | | - /// Renews the server challenge code of the ServerQuery instance in order to be able to execute further operations. |
27 | | - /// </summary> |
28 | | - /// <returns>The new created challenge.</returns> |
29 | | - Task<int> RenewChallengeAsync(); |
30 | | - |
31 | | - /// <summary> |
32 | | - /// Configures and Connects the created instance of SteamQuery UDP socket for Steam Server Query Operations. |
33 | | - /// </summary> |
34 | | - /// <param name="serverAddress">IPAddress or HostName of the server that queries will be sent.</param> |
35 | | - /// <param name="port">Port of the server that queries will be sent.</param> |
36 | | - /// <returns>Connected instance of ServerQuery.</returns> |
37 | | - IServerQuery Connect(string serverAddress, ushort port); |
38 | | - |
39 | | - /// <summary> |
40 | | - /// Configures and Connects the created instance of SteamQuery UDP socket for Steam Server Query Operations. |
41 | | - /// </summary> |
42 | | - /// <param name="serverAddressAndPort">IPAddress or HostName of the server and port separated by a colon(:) or a comma(,).</param> |
43 | | - /// <returns>Connected instance of ServerQuery.</returns> |
44 | | - IServerQuery Connect(string serverAddressAndPort); |
45 | | - |
46 | | - /// <summary> |
47 | | - /// Configures and Connects the created instance of SteamQuery UDP socket for Steam Server Query Operations. |
48 | | - /// </summary> |
49 | | - /// <param name="customLocalIPEndpoint">Desired local IPEndpoint to bound.</param> |
50 | | - /// <param name="serverAddressAndPort">IPAddress or HostName of the server and port separated by a colon(:) or a comma(,).</param> |
51 | | - /// <returns>Connected instance of ServerQuery.</returns> |
52 | | - IServerQuery Connect(IPEndPoint customLocalIPEndpoint, string serverAddressAndPort); |
53 | | - |
54 | | - /// <summary> |
55 | | - /// Configures and Connects the created instance of SteamQuery UDP socket for Steam Server Query Operations. |
56 | | - /// </summary> |
57 | | - /// <param name="customLocalIPEndpoint">Desired local IPEndpoint to bound.</param> |
58 | | - /// <param name="serverAddress">IPAddress or HostName of the server that queries will be sent.</param> |
59 | | - /// <param name="port">Port of the server that queries will be sent.</param> |
60 | | - /// <returns>Connected instance of ServerQuery.</returns> |
61 | | - IServerQuery Connect(IPEndPoint customLocalIPEndpoint, string serverAddress, ushort port); |
62 | | - |
63 | | - /// <summary> |
64 | | - /// Requests and serializes the server information. |
65 | | - /// </summary> |
66 | | - /// <returns>Serialized ServerInfo instance.</returns> |
67 | | - ServerInfo GetServerInfo(); |
68 | | - |
69 | | - /// <summary> |
70 | | - /// Requests and serializes the server information. |
71 | | - /// </summary> |
72 | | - /// <returns>Serialized ServerInfo instance.</returns> |
73 | | - Task<ServerInfo> GetServerInfoAsync(); |
74 | | - |
75 | | - /// <summary> |
76 | | - /// Requests and serializes the list of player information. |
77 | | - /// </summary> |
78 | | - /// <returns>Serialized list of Player instances.</returns> |
79 | | - List<Player> GetPlayers(); |
80 | | - |
81 | | - /// <summary> |
82 | | - /// Requests and serializes the list of player information. |
83 | | - /// </summary> |
84 | | - /// <returns>Serialized list of Player instances.</returns> |
85 | | - Task<List<Player>> GetPlayersAsync(); |
86 | | - |
87 | | - /// <summary> |
88 | | - /// Requests and serializes the list of rules defined by the server. |
89 | | - /// Warning: CS:GO Rules reply is broken since update CSGO 1.32.3.0 (Feb 21, 2014). |
90 | | - /// Before the update rules got truncated when exceeding MTU, after the update rules reply is not sent at all. |
91 | | - /// </summary> |
92 | | - /// <returns>Serialized list of Rule instances.</returns> |
93 | | - List<Rule> GetRules(); |
94 | | - |
95 | | - /// <summary> |
96 | | - /// Requests and serializes the list of rules defined by the server. |
97 | | - /// Warning: CS:GO Rules reply is broken since update CSGO 1.32.3.0 (Feb 21, 2014). |
98 | | - /// Before the update rules got truncated when exceeding MTU, after the update rules reply is not sent at all. |
99 | | - /// </summary> |
100 | | - /// <returns>Serialized list of Rule instances.</returns> |
101 | | - Task<List<Rule>> GetRulesAsync(); |
102 | | - } |
103 | | - |
104 | 17 | public class ServerQuery : IServerQuery, IDisposable |
105 | 18 | { |
106 | 19 | private IPEndPoint _remoteIpEndpoint; |
|
0 commit comments