partial support of IW6x until the game log is implemented

This commit is contained in:
RaidMax
2020-11-07 10:40:58 -06:00
parent e76976799b
commit fd7bd7e0da
7 changed files with 149 additions and 32 deletions

View File

@ -76,7 +76,22 @@ namespace IW4MAdmin.Application.RconParsers
public async Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default)
{
string[] lineSplit = await connection.SendQueryAsync(StaticHelpers.QueryType.GET_DVAR, dvarName);
string[] lineSplit;
try
{
lineSplit = await connection.SendQueryAsync(StaticHelpers.QueryType.GET_DVAR, dvarName);
}
catch
{
if (fallbackValue == null)
{
throw;
}
lineSplit = new string[0];
}
string response = string.Join('\n', lineSplit).TrimEnd('\0');
var match = Regex.Match(response, Configuration.Dvar.Pattern);