From 1a20b60af3ffaf5be59c1053d119414977c12363 Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Sat, 27 Jan 2024 03:55:35 +0800 Subject: [PATCH] Update Protocols --- OpenGSQ/Protocols/EOS.cs | 20 ++++++++++++---- OpenGSQ/Protocols/FiveM.cs | 2 +- OpenGSQ/Protocols/Scum.cs | 2 +- OpenGSQ/RconProtocols/SourceRcon.cs | 2 +- OpenGSQ/Responses/ASE/Player.cs | 6 ++--- OpenGSQ/Responses/ASE/Status.cs | 14 ++++++------ OpenGSQ/Responses/Battlefield/Info.cs | 24 ++++++++++---------- OpenGSQ/Responses/Battlefield/VersionInfo.cs | 4 ++-- OpenGSQ/Responses/EOS/Matchmaking.cs | 2 +- OpenGSQ/Responses/GameSpy1/Status.cs | 6 ++--- OpenGSQ/Responses/GameSpy2/Status.cs | 6 ++--- OpenGSQ/Responses/Minecraft/StatusPre17.cs | 6 ++--- OpenGSQ/Responses/Quake1/Player.cs | 4 ++-- OpenGSQ/Responses/Quake1/Status.cs | 4 ++-- OpenGSQ/Responses/Quake2/Player.cs | 4 ++-- OpenGSQ/Responses/Quake2/Status.cs | 4 ++-- OpenGSQ/Responses/RakNet/Status.cs | 12 +++++----- OpenGSQ/Responses/Samp/Player.cs | 2 +- OpenGSQ/Responses/Samp/Status.cs | 6 ++--- OpenGSQ/Responses/Scum/Status.cs | 6 ++--- OpenGSQ/Responses/Source/GoldSourceInfo.cs | 6 ++--- OpenGSQ/Responses/Source/PartialInfo.cs | 8 +++---- OpenGSQ/Responses/Source/Player.cs | 2 +- OpenGSQ/Responses/Source/SourceInfo.cs | 6 ++--- OpenGSQ/Responses/Unreal2/Player.cs | 2 +- OpenGSQ/Responses/Unreal2/Status.cs | 10 ++++---- OpenGSQ/Responses/Vcmp/Player.cs | 2 +- OpenGSQ/Responses/Vcmp/Status.cs | 8 +++---- OpenGSQ/Socket.cs | 1 - OpenGSQTests/Protocols/EOSTests.cs | 2 +- 30 files changed, 96 insertions(+), 87 deletions(-) diff --git a/OpenGSQ/Protocols/EOS.cs b/OpenGSQ/Protocols/EOS.cs index 33a7eaa..0ca0719 100644 --- a/OpenGSQ/Protocols/EOS.cs +++ b/OpenGSQ/Protocols/EOS.cs @@ -29,11 +29,11 @@ public class EOS : ProtocolBase /// /// The host name of the server. /// The port number of the server. - /// The timeout value for the connection, in milliseconds. Default is 5000. /// The deployment ID for the application. /// The access token for the application. + /// The timeout value for the connection, in milliseconds. Default is 5000. /// Thrown when either deploymentId or accessToken is null. - public EOS(string host, int port, int timeout = 5000, string deploymentId = null, string accessToken = null) : base(host, port, timeout) + public EOS(string host, int port, string deploymentId,string accessToken, int timeout = 5000) : base(host, port, timeout) { if (deploymentId == null || accessToken == null) { @@ -82,7 +82,12 @@ public static async Task GetAccessTokenAsync(string clientId, string cli var data = await response.Content.ReadFromJsonAsync>(); - return data["access_token"].ToString(); + if (data == null || !data.TryGetValue("access_token", out var accessToken)) + { + throw new Exception($"Failed to get access token from {url}"); + } + + return accessToken.ToString()!; } } @@ -126,7 +131,12 @@ public static async Task GetExternalAuthTokenAsync(string clientId, stri var data = await response.Content.ReadFromJsonAsync>(); - return data["access_token"].ToString(); + if (data == null || !data.TryGetValue("access_token", out var accessToken)) + { + throw new Exception($"Failed to get access token from {url}"); + } + + return accessToken.ToString()!; } } @@ -171,7 +181,7 @@ public static async Task GetMatchmakingAsync(string deploymentId, s var responseData = await response.Content.ReadFromJsonAsync(); - return responseData; + return responseData ?? throw new Exception($"Failed to load data from {url}"); ; } } diff --git a/OpenGSQ/Protocols/FiveM.cs b/OpenGSQ/Protocols/FiveM.cs index 54dafc9..3da9b3a 100644 --- a/OpenGSQ/Protocols/FiveM.cs +++ b/OpenGSQ/Protocols/FiveM.cs @@ -33,7 +33,7 @@ private async Task GetAsync(string filename) HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); - return await response.Content.ReadFromJsonAsync(); + return await response.Content.ReadFromJsonAsync() ?? throw new Exception($"Failed to load data from {url}"); } } diff --git a/OpenGSQ/Protocols/Scum.cs b/OpenGSQ/Protocols/Scum.cs index 258a6fd..383d608 100644 --- a/OpenGSQ/Protocols/Scum.cs +++ b/OpenGSQ/Protocols/Scum.cs @@ -42,7 +42,7 @@ public Scum(string host, int port, int timeout = 5000) : base(host, port, timeou /// The status of the server. /// Thrown when the operation times out. /// Thrown when the server is not found in the list of master servers. - public async Task GetStatus(List masterServers = null) + public async Task GetStatus(List? masterServers = null) { var ip = await GetIPAddress(); diff --git a/OpenGSQ/RconProtocols/SourceRcon.cs b/OpenGSQ/RconProtocols/SourceRcon.cs index 14d3c91..1d6b58a 100644 --- a/OpenGSQ/RconProtocols/SourceRcon.cs +++ b/OpenGSQ/RconProtocols/SourceRcon.cs @@ -13,7 +13,7 @@ namespace OpenGSQ.RconProtocols /// public class SourceRcon : ProtocolBase, IDisposable { - private System.Net.Sockets.TcpClient _tcpClient; + private System.Net.Sockets.TcpClient? _tcpClient; /// public override string FullName => "Source RCON Protocol"; diff --git a/OpenGSQ/Responses/ASE/Player.cs b/OpenGSQ/Responses/ASE/Player.cs index 5e7b098..4b4dabf 100644 --- a/OpenGSQ/Responses/ASE/Player.cs +++ b/OpenGSQ/Responses/ASE/Player.cs @@ -8,17 +8,17 @@ public class Player /// /// Gets or sets the name of the player. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Gets or sets the team of the player. /// - public string Team { get; set; } + public string Team { get; set; } = string.Empty; /// /// Gets or sets the skin of the player. /// - public string Skin { get; set; } + public string Skin { get; set; } = string.Empty; /// /// Gets or sets the score of the player. diff --git a/OpenGSQ/Responses/ASE/Status.cs b/OpenGSQ/Responses/ASE/Status.cs index c57f20c..edd1d5b 100644 --- a/OpenGSQ/Responses/ASE/Status.cs +++ b/OpenGSQ/Responses/ASE/Status.cs @@ -10,7 +10,7 @@ public class Status /// /// Gets or sets the name of the game. /// - public string GameName { get; set; } + public string GameName { get; set; } = string.Empty; /// /// Gets or sets the port of the game. @@ -20,22 +20,22 @@ public class Status /// /// Gets or sets the host name of the game. /// - public string Hostname { get; set; } + public string Hostname { get; set; } = string.Empty; /// /// Gets or sets the type of the game. /// - public string GameType { get; set; } + public string GameType { get; set; } = string.Empty; /// /// Gets or sets the map of the game. /// - public string Map { get; set; } + public string Map { get; set; } = string.Empty; /// /// Gets or sets the version of the game. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether a password is required. @@ -55,11 +55,11 @@ public class Status /// /// Gets or sets the rules of the game. /// - public Dictionary Rules { get; set; } + public Dictionary Rules { get; set; } = new Dictionary(); /// /// Gets or sets the players in the game. /// - public List Players { get; set; } + public List Players { get; set; } = new List(); } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Battlefield/Info.cs b/OpenGSQ/Responses/Battlefield/Info.cs index a60a0da..c22018b 100644 --- a/OpenGSQ/Responses/Battlefield/Info.cs +++ b/OpenGSQ/Responses/Battlefield/Info.cs @@ -10,7 +10,7 @@ public class Info /// /// Gets or sets the hostname of the game server. /// - public string Hostname { get; set; } + public string Hostname { get; set; } = string.Empty; /// /// Gets or sets the number of players in the game. @@ -25,12 +25,12 @@ public class Info /// /// Gets or sets the type of the game. /// - public string GameType { get; set; } + public string GameType { get; set; } = string.Empty; /// /// Gets or sets the current map of the game. /// - public string Map { get; set; } + public string Map { get; set; } = string.Empty; /// /// Gets or sets the number of rounds played. @@ -45,7 +45,7 @@ public class Info /// /// Gets or sets the list of teams. /// - public List Teams { get; set; } + public List Teams { get; set; } = new List(); /// /// Gets or sets the target score. @@ -55,7 +55,7 @@ public class Info /// /// Gets or sets the status of the game. /// - public string Status { get; set; } + public string Status { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether the game is ranked. @@ -87,17 +87,17 @@ public class Info /// /// Gets or sets the game mod. This property is optional. /// - public string Mod { get; set; } + public string Mod { get; set; } = string.Empty; /// /// Gets or sets the IP port of the game server. This property is optional. /// - public string IpPort { get; set; } + public string IpPort { get; set; } = string.Empty; /// /// Gets or sets the version of PunkBuster. This property is optional. /// - public string PunkBusterVersion { get; set; } + public string? PunkBusterVersion { get; set; } /// /// Gets or sets a value indicating whether the join queue is enabled. This property is optional. @@ -107,17 +107,17 @@ public class Info /// /// Gets or sets the region of the game server. This property is optional. /// - public string Region { get; set; } + public string? Region { get; set; } /// /// Gets or sets the ping site of the game server. This property is optional. /// - public string PingSite { get; set; } + public string? PingSite { get; set; } /// /// Gets or sets the country of the game server. This property is optional. /// - public string Country { get; set; } + public string? Country { get; set; } /// /// Gets or sets the number of players in the Blaze game state. This property is optional. @@ -127,7 +127,7 @@ public class Info /// /// Gets or sets the Blaze game state. This property is optional. /// - public string BlazeGameState { get; set; } + public string? BlazeGameState { get; set; } /// /// Gets or sets a value indicating whether quick match is enabled. This property is optional. diff --git a/OpenGSQ/Responses/Battlefield/VersionInfo.cs b/OpenGSQ/Responses/Battlefield/VersionInfo.cs index cd0105c..6b3a44b 100644 --- a/OpenGSQ/Responses/Battlefield/VersionInfo.cs +++ b/OpenGSQ/Responses/Battlefield/VersionInfo.cs @@ -8,11 +8,11 @@ public class VersionInfo /// /// Gets or sets the mod of the game. /// - public string Mod { get; set; } + public string Mod { get; set; } = string.Empty; /// /// Gets or sets the version of the mod. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Responses/EOS/Matchmaking.cs b/OpenGSQ/Responses/EOS/Matchmaking.cs index 28f9061..5b78bc1 100644 --- a/OpenGSQ/Responses/EOS/Matchmaking.cs +++ b/OpenGSQ/Responses/EOS/Matchmaking.cs @@ -11,7 +11,7 @@ public class Matchmaking /// Gets or sets the list of sessions returned by the matchmaking request. /// Each session is represented as a dictionary of string keys and object values. /// - public List> Sessions { get; set; } + public List> Sessions { get; set; } = new List>(); /// /// Gets or sets the count of sessions returned by the matchmaking request. diff --git a/OpenGSQ/Responses/GameSpy1/Status.cs b/OpenGSQ/Responses/GameSpy1/Status.cs index 3e895bd..82d639b 100644 --- a/OpenGSQ/Responses/GameSpy1/Status.cs +++ b/OpenGSQ/Responses/GameSpy1/Status.cs @@ -16,16 +16,16 @@ public class Status /// Server's Info /// If is , then it includes \info\xserverquery\rules\xserverquery, else \basic\\info\\rules\\ /// - public Dictionary Info { get; set; } + public Dictionary Info { get; set; } = new Dictionary(); /// /// Server's Players /// - public List> Players { get; set; } + public List> Players { get; set; } = new List>(); /// /// Server's Teams (Only when is ) /// - public List> Teams { get; set; } + public List> Teams { get; set; } = new List>(); } } \ No newline at end of file diff --git a/OpenGSQ/Responses/GameSpy2/Status.cs b/OpenGSQ/Responses/GameSpy2/Status.cs index ea711ed..d96a4f9 100644 --- a/OpenGSQ/Responses/GameSpy2/Status.cs +++ b/OpenGSQ/Responses/GameSpy2/Status.cs @@ -10,16 +10,16 @@ public class Status /// /// Gets or sets the server information. /// - public Dictionary Info { get; set; } + public Dictionary Info { get; set; } = new Dictionary(); /// /// Gets or sets the list of players. /// - public List> Players { get; set; } + public List> Players { get; set; } = new List>(); /// /// Gets or sets the list of teams. /// - public List> Teams { get; set; } + public List> Teams { get; set; } = new List>(); } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Minecraft/StatusPre17.cs b/OpenGSQ/Responses/Minecraft/StatusPre17.cs index afdcd30..16fb3fa 100644 --- a/OpenGSQ/Responses/Minecraft/StatusPre17.cs +++ b/OpenGSQ/Responses/Minecraft/StatusPre17.cs @@ -8,17 +8,17 @@ public class StatusPre17 /// /// Gets or sets the protocol of the game. /// - public string Protocol { get; set; } + public string Protocol { get; set; } = string.Empty; /// /// Gets or sets the version of the game. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// Gets or sets the message of the day. /// - public string Motd { get; set; } + public string Motd { get; set; } = string.Empty; /// /// Gets or sets the number of players in the game. diff --git a/OpenGSQ/Responses/Quake1/Player.cs b/OpenGSQ/Responses/Quake1/Player.cs index 6b7faa2..c232b0f 100644 --- a/OpenGSQ/Responses/Quake1/Player.cs +++ b/OpenGSQ/Responses/Quake1/Player.cs @@ -28,12 +28,12 @@ public class Player /// /// Gets or sets the player's name. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Gets or sets the player's skin. /// - public string Skin { get; set; } + public string Skin { get; set; } = string.Empty; /// /// Gets or sets the player's first color. diff --git a/OpenGSQ/Responses/Quake1/Status.cs b/OpenGSQ/Responses/Quake1/Status.cs index ce138d3..19d82b3 100644 --- a/OpenGSQ/Responses/Quake1/Status.cs +++ b/OpenGSQ/Responses/Quake1/Status.cs @@ -10,11 +10,11 @@ public class Status /// /// Gets or sets the server information. /// - public Dictionary Info { get; set; } + public Dictionary Info { get; set; } = new Dictionary(); /// /// Gets or sets the list of players. /// - public List Players { get; set; } + public List Players { get; set; } = new List(); } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Quake2/Player.cs b/OpenGSQ/Responses/Quake2/Player.cs index b0d648f..79f5c8a 100644 --- a/OpenGSQ/Responses/Quake2/Player.cs +++ b/OpenGSQ/Responses/Quake2/Player.cs @@ -18,11 +18,11 @@ public class Player /// /// Gets or sets the player's name. /// - public string Name { get; set; } + public string? Name { get; set; } /// /// Gets or sets the player's address. /// - public string Address { get; set; } + public string? Address { get; set; } } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Quake2/Status.cs b/OpenGSQ/Responses/Quake2/Status.cs index cb70328..d7dca59 100644 --- a/OpenGSQ/Responses/Quake2/Status.cs +++ b/OpenGSQ/Responses/Quake2/Status.cs @@ -10,11 +10,11 @@ public class Status /// /// Gets or sets the server information. /// - public Dictionary Info { get; set; } + public Dictionary Info { get; set; } = new Dictionary(); /// /// Gets or sets the list of players. /// - public List Players { get; set; } + public List Players { get; set; } = new List(); } } \ No newline at end of file diff --git a/OpenGSQ/Responses/RakNet/Status.cs b/OpenGSQ/Responses/RakNet/Status.cs index 77895d7..8da38a0 100644 --- a/OpenGSQ/Responses/RakNet/Status.cs +++ b/OpenGSQ/Responses/RakNet/Status.cs @@ -8,12 +8,12 @@ public class Status /// /// Gets or sets the edition of the server (MCPE or MCEE for Education Edition). /// - public string Edition { get; set; } + public string Edition { get; set; } = string.Empty; /// /// Gets or sets the first line of the Message of the Day (MOTD). /// - public string MotdLine1 { get; set; } + public string MotdLine1 { get; set; } = string.Empty; /// /// Gets or sets the protocol version of the server. @@ -23,7 +23,7 @@ public class Status /// /// Gets or sets the version name of the server. /// - public string VersionName { get; set; } + public string VersionName { get; set; } = string.Empty; /// /// Gets or sets the number of players currently on the server. @@ -38,17 +38,17 @@ public class Status /// /// Gets or sets the unique ID of the server. /// - public string ServerUniqueId { get; set; } + public string ServerUniqueId { get; set; } = string.Empty; /// /// Gets or sets the second line of the Message of the Day (MOTD). /// - public string MotdLine2 { get; set; } + public string MotdLine2 { get; set; } = string.Empty; /// /// Gets or sets the game mode of the server. /// - public string GameMode { get; set; } + public string GameMode { get; set; } = string.Empty; /// /// Gets or sets the numeric representation of the game mode. diff --git a/OpenGSQ/Responses/Samp/Player.cs b/OpenGSQ/Responses/Samp/Player.cs index e467f05..f8df792 100644 --- a/OpenGSQ/Responses/Samp/Player.cs +++ b/OpenGSQ/Responses/Samp/Player.cs @@ -13,7 +13,7 @@ public class Player /// /// Gets or sets the name of the player. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Gets or sets the score of the player. diff --git a/OpenGSQ/Responses/Samp/Status.cs b/OpenGSQ/Responses/Samp/Status.cs index a5eb880..1d6adc3 100644 --- a/OpenGSQ/Responses/Samp/Status.cs +++ b/OpenGSQ/Responses/Samp/Status.cs @@ -23,16 +23,16 @@ public class Status /// /// Gets or sets the name of the server. /// - public string ServerName { get; set; } + public string ServerName { get; set; } = string.Empty; /// /// Gets or sets the type of game being played on the server. /// - public string GameType { get; set; } + public string GameType { get; set; } = string.Empty; /// /// Gets or sets the language of the server. /// - public string Language { get; set; } + public string Language { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Scum/Status.cs b/OpenGSQ/Responses/Scum/Status.cs index 98dfe12..1102793 100644 --- a/OpenGSQ/Responses/Scum/Status.cs +++ b/OpenGSQ/Responses/Scum/Status.cs @@ -8,7 +8,7 @@ public class Status /// /// Gets or sets the IP address of the server. /// - public string Ip { get; set; } + public string Ip { get; set; } = string.Empty; /// /// Gets or sets the port number of the server. @@ -18,7 +18,7 @@ public class Status /// /// Gets or sets the name of the server. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Gets or sets the number of players currently connected to the server. @@ -43,6 +43,6 @@ public class Status /// /// Gets or sets the version of the server. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Source/GoldSourceInfo.cs b/OpenGSQ/Responses/Source/GoldSourceInfo.cs index 584006e..58fb604 100644 --- a/OpenGSQ/Responses/Source/GoldSourceInfo.cs +++ b/OpenGSQ/Responses/Source/GoldSourceInfo.cs @@ -8,7 +8,7 @@ public class GoldSourceInfo : PartialInfo /// /// IP address and port of the server. /// - public string Address { get; set; } + public string Address { get; set; } = string.Empty; /// /// Indicates whether the game is a mod @@ -22,12 +22,12 @@ public class GoldSourceInfo : PartialInfo /// /// URL to mod website. /// - public string Link { get; set; } + public string Link { get; set; } = string.Empty; /// /// URL to download the mod. /// - public string DownloadLink { get; set; } + public string DownloadLink { get; set; } = string.Empty; /// /// Version of mod installed on server. diff --git a/OpenGSQ/Responses/Source/PartialInfo.cs b/OpenGSQ/Responses/Source/PartialInfo.cs index 164512c..9e42269 100644 --- a/OpenGSQ/Responses/Source/PartialInfo.cs +++ b/OpenGSQ/Responses/Source/PartialInfo.cs @@ -13,22 +13,22 @@ public class PartialInfo /// /// Name of the server. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Map the server has currently loaded. /// - public string Map { get; set; } + public string Map { get; set; } = string.Empty; /// /// Name of the folder containing the game files. /// - public string Folder { get; set; } + public string Folder { get; set; } = string.Empty; /// /// Full name of the game. /// - public string Game { get; set; } + public string Game { get; set; } = string.Empty; /// /// Number of players on the server. diff --git a/OpenGSQ/Responses/Source/Player.cs b/OpenGSQ/Responses/Source/Player.cs index 7117866..9e5e796 100644 --- a/OpenGSQ/Responses/Source/Player.cs +++ b/OpenGSQ/Responses/Source/Player.cs @@ -8,7 +8,7 @@ public class Player /// /// Player Name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Player Score diff --git a/OpenGSQ/Responses/Source/SourceInfo.cs b/OpenGSQ/Responses/Source/SourceInfo.cs index 359fd69..0aaf3ee 100644 --- a/OpenGSQ/Responses/Source/SourceInfo.cs +++ b/OpenGSQ/Responses/Source/SourceInfo.cs @@ -28,7 +28,7 @@ public class SourceInfo : PartialInfo /// /// Version of the game installed on the server. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// If present, this specifies which additional data fields will be included. @@ -53,12 +53,12 @@ public class SourceInfo : PartialInfo /// /// Name of the spectator server for SourceTV. /// - public string SpectatorName { get; set; } + public string? SpectatorName { get; set; } /// /// Tags that describe the game according to the server (for future use.) /// - public string Keywords { get; set; } + public string? Keywords { get; set; } /// /// The server's 64-bit GameID. If this is present, a more accurate AppID is present in the low 24 bits. The earlier AppID could have been truncated as it was forced into 16-bit storage. diff --git a/OpenGSQ/Responses/Unreal2/Player.cs b/OpenGSQ/Responses/Unreal2/Player.cs index 3459413..ef25c9e 100644 --- a/OpenGSQ/Responses/Unreal2/Player.cs +++ b/OpenGSQ/Responses/Unreal2/Player.cs @@ -13,7 +13,7 @@ public class Player /// /// Gets or sets the name of the player. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Gets or sets the ping of the player. diff --git a/OpenGSQ/Responses/Unreal2/Status.cs b/OpenGSQ/Responses/Unreal2/Status.cs index c9c7826..e974e05 100644 --- a/OpenGSQ/Responses/Unreal2/Status.cs +++ b/OpenGSQ/Responses/Unreal2/Status.cs @@ -13,7 +13,7 @@ public class Status /// /// Gets or sets the IP address of the server. /// - public string ServerIP { get; set; } + public string ServerIP { get; set; } = string.Empty; /// /// Gets or sets the game port of the server. @@ -28,17 +28,17 @@ public class Status /// /// Gets or sets the name of the server. /// - public string ServerName { get; set; } + public string ServerName { get; set; } = string.Empty; /// /// Gets or sets the name of the map. /// - public string MapName { get; set; } + public string MapName { get; set; } = string.Empty; /// /// Gets or sets the type of the game. /// - public string GameType { get; set; } + public string GameType { get; set; } = string.Empty; /// /// Gets or sets the number of players. @@ -63,6 +63,6 @@ public class Status /// /// Gets or sets the skill level. /// - public string Skill { get; set; } + public string Skill { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Vcmp/Player.cs b/OpenGSQ/Responses/Vcmp/Player.cs index 98b7490..5fda2ed 100644 --- a/OpenGSQ/Responses/Vcmp/Player.cs +++ b/OpenGSQ/Responses/Vcmp/Player.cs @@ -8,6 +8,6 @@ public class Player /// /// Gets or sets the player's name. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Responses/Vcmp/Status.cs b/OpenGSQ/Responses/Vcmp/Status.cs index 4571209..4d45c65 100644 --- a/OpenGSQ/Responses/Vcmp/Status.cs +++ b/OpenGSQ/Responses/Vcmp/Status.cs @@ -8,7 +8,7 @@ public class Status /// /// Gets or sets the version of the server. /// - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether a password is required to connect to the server. @@ -28,16 +28,16 @@ public class Status /// /// Gets or sets the name of the server. /// - public string ServerName { get; set; } + public string ServerName { get; set; } = string.Empty; /// /// Gets or sets the type of game being played on the server. /// - public string GameType { get; set; } + public string GameType { get; set; } = string.Empty; /// /// Gets or sets the language of the server. /// - public string Language { get; set; } + public string Language { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/OpenGSQ/Socket.cs b/OpenGSQ/Socket.cs index abb4d50..521c4ea 100644 --- a/OpenGSQ/Socket.cs +++ b/OpenGSQ/Socket.cs @@ -1,5 +1,4 @@ using System.Net.Sockets; -using System.Threading; using System.Threading.Tasks; using OpenGSQ.Exceptions; diff --git a/OpenGSQTests/Protocols/EOSTests.cs b/OpenGSQTests/Protocols/EOSTests.cs index be969f1..3be4473 100644 --- a/OpenGSQTests/Protocols/EOSTests.cs +++ b/OpenGSQTests/Protocols/EOSTests.cs @@ -24,7 +24,7 @@ public async Task GetInfoTest() string externalAuthToken = ""; string accessToken = await EOS.GetAccessTokenAsync(clientId, clientSecret, deploymentId, grantType, externalAuthType, externalAuthToken); - EOS eos = new("5.62.115.46", 7783, 5000, deploymentId, accessToken); + EOS eos = new("5.62.115.46", 7783, deploymentId, accessToken, 5000); SaveResult(nameof(GetInfoTest), await eos.GetInfo()); }