Esempio n. 1
0
        public async Task <bool> Check()
        {
            List <string> steamIdList = await _cacheService.GetSuspectsListFromCache();

            List <string> bannedSteamIdList = await _cacheService.GetSuspectsBannedList();

            List <string> newBannedSteamIdList = await _steamService.GetNewSuspectBannedArray(steamIdList, bannedSteamIdList);

            _lastCheckDate = DateTime.Now;

            if (newBannedSteamIdList.Count > 0)
            {
                // add new ban to cache
                foreach (string steamId in newBannedSteamIdList)
                {
                    await _cacheService.AddSteamIdToBannedList(steamId);
                }
                SuspectBannedEventArgs e = new SuspectBannedEventArgs
                {
                    SteamIdList = newBannedSteamIdList
                };
                SuspectBanned?.Invoke(this, e);

                return(true);
            }

            return(false);
        }