Esempio n. 1
0
        /// <inheritdoc/>
        public async Task <ServerInfo> GetServerInfoAsync()
        {
            var sInfo = new ServerInfo
            {
                Ping = new Ping().Send(_remoteIpEndpoint.Address).RoundtripTime
            };

            byte[] response = await SendRequestAsync(RequestHelpers.PrepareAS2_INFO_Request());

            if (response.Length > 0)
            {
                DataResolutionUtils.ExtractData(sInfo, response, nameof(sInfo.EDF), true);
            }

            return(sInfo);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public async Task <List <Rule> > GetRulesAsync()
        {
            if (_currentChallenge == 0)
            {
                await RenewChallengeAsync();
            }

            byte[] response = await SendRequestAsync(
                RequestHelpers.PrepareAS2_GENERIC_Request(RequestHeaders.A2S_RULES, _currentChallenge));

            if (response.Length > 0)
            {
                return(DataResolutionUtils.ExtractListData <Rule>(response));
            }
            else
            {
                throw new InvalidOperationException("Server did not response the query");
            }
        }