示例#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);
        }
        private void HandleSuspectBanned(object sender, SuspectBannedEventArgs args)
        {
            if (args.SteamIdList.Count > 0)
            {
                // send to CSGO DM the new account banned count
                _bridge.SendSuspectBannedCount(args.SteamIdList.Count);

                foreach (string steamId in args.SteamIdList)
                {
                    if (!_bannedSteamIdList.Contains(steamId))
                    {
                        _bannedSteamIdList.Add(steamId);
                    }
                }
                App.NotifyIcon.ShowBalloonTip(AppSettings.APP_NAME, _bannedSteamIdList.Count + " suspect(s) has been banned.", BalloonIcon.Warning);
                App.NotifyIcon.TrayBalloonTipClicked += NewSuspectsBalloonClicked;
            }
        }