private void FetchClientInfo() { if (!_valid) { return; } try { lock (RankingBot.TS3Lock) { RankingBot.Logger.Debug(_file + " Fetching client info (ClientID: '" + _clid + "')"); ClientInfoCommandResponse clinfo = new ClientInfoCommand(_clid).Execute(RankingBot.TS3); if (clinfo.IsErroneous) { RankingBot.Logger.Error(_file + " Received erroneous client info data (ClientID: '" + _clid + "')"); RankingBot.Logger.Debug(_file + " Erroneous data: " + clinfo.ResponseText); Invalidate(); return; } RankingBot.Logger.Debug(_file + " Fetched client info (ClientID: '" + _clid + "')"); _clinfo = clinfo; _errors = 0; } } catch (Exception e) { if (_errors != 2) { _errors++; RankingBot.Logger.Warn(_file + " Caught exception trying to get client info, will try " + (3 - _errors) + " more time(s) (ClientID: '" + _clid + "')"); FetchClientInfo(); } else { RankingBot.Logger.Error(_file + " Repeated exceptions (" + e.Message + ") trying to get client info. Invalidating client (ClientID: '" + _clid + "')"); Invalidate(); return; } } }
private string CheckClientLang(ClientInfoCommandResponse clientinfo) { return(_config.Reason.ContainsKey(clientinfo.ClientCountry.ToLower()) ? clientinfo.ClientCountry.ToLower() : _config.DefaultLang); }