From fc0e6620b6004ae171966584a9d888c99a8db22b Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Sat, 5 Jun 2021 07:29:51 +0800 Subject: [PATCH] Fix A2S GetInfo --- OpenGSQ/OpenGSQ.csproj | 2 +- OpenGSQ/Protocols/A2S.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenGSQ/OpenGSQ.csproj b/OpenGSQ/OpenGSQ.csproj index 7b92360..ac41b9b 100644 --- a/OpenGSQ/OpenGSQ.csproj +++ b/OpenGSQ/OpenGSQ.csproj @@ -3,7 +3,7 @@ OpenGSQ 1.0.0 - 1.0.0 + 1.0.1 OpenGSQ, BattlefieldDuck netstandard2.0 OpenGSQ diff --git a/OpenGSQ/Protocols/A2S.cs b/OpenGSQ/Protocols/A2S.cs index 686a7ae..cdb4ee8 100644 --- a/OpenGSQ/Protocols/A2S.cs +++ b/OpenGSQ/Protocols/A2S.cs @@ -260,15 +260,18 @@ private byte[] ConnectAndSendChallenge(UdpClient udpClient, Request request) udpClient.Client.SendTimeout = _timeout; udpClient.Client.ReceiveTimeout = _timeout; - // Set up request data + // Set up request base var requestBase = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, (byte)request }; - var requestData = requestBase; if (request == Request.A2S_INFO) { - requestData = requestData.Concat(Encoding.Default.GetBytes("Source Engine Query\0")).ToArray(); + requestBase = requestBase.Concat(Encoding.Default.GetBytes("Source Engine Query\0")).ToArray(); } - else + + // Set up request data + var requestData = requestBase; + + if (request != Request.A2S_INFO) { requestData = requestData.Concat(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }).ToArray(); }