1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-09 06:37:58 -05:00

fix T7 extra null bytes in status response

fix regression bug with info response on T6
This commit is contained in:
RaidMax 2020-04-18 10:46:55 -05:00
parent c7005c7ac0
commit 842fdc63a7
2 changed files with 6 additions and 4 deletions

View File

@ -219,7 +219,7 @@ namespace IW4MAdmin.Application.RCon
else
{
splitStatusStrings.Add(responseString.Replace(config.CommandPrefixes.RConResponse, ""));
splitStatusStrings.Add(responseString.Replace(config.CommandPrefixes.RConResponse, "").TrimEnd('\0'));
}
}

View File

@ -669,10 +669,10 @@ namespace SharedLibraryCore
Dictionary<string, string> dict = null;
if (values.Length % 2 == 0 && values.Length > 1)
if (values.Length > 1)
{
dict = new Dictionary<string, string>();
for (int i = 0; i < values.Length; i += 2)
for (int i = values.Length % 2 == 0 ? 0 : 1; i < values.Length; i += 2)
{
dict.Add(values[i], values[i + 1]);
}
@ -754,7 +754,9 @@ namespace SharedLibraryCore
}
var response = await server.RemoteConnection.SendQueryAsync(RCon.StaticHelpers.QueryType.GET_INFO);
string combinedResponse = string.Join('\\', response.Where(r => r.Length > 0 && r[0] == '\\'));
string combinedResponse = response.Length > 1 ?
string.Join('\\', response.Where(r => r.Length > 0 && r[0] == '\\')) :
response[0];
return combinedResponse.DictionaryFromKeyValue();
}