示例#1
0
        protected virtual bool HasUpdated(Clan stored, Clan fetched)
        {
            var a = stored.Labels.SequenceEqual(fetched.Labels);
            var b = fetched.Labels.SequenceEqual(stored.Labels);
            var c = Clan.ClanMembersJoined(stored, fetched).Count == 0;
            var d = Clan.ClanMembersLeft(stored, fetched).Count == 0;
            var e = Clan.Donations(stored, fetched).Count == 0;
            var f = Clan.DonationsReceived(stored, fetched).Count == 0;

            return(!(stored.BadgeUrls?.Small == fetched.BadgeUrls?.Small &&
                     stored.ClanLevel == fetched.ClanLevel &&
                     stored.ClanPoints == fetched.ClanPoints &&
                     stored.ClanVersusPoints == fetched.ClanVersusPoints &&
                     stored.Description == fetched.Description &&
                     stored.IsWarLogPublic == fetched.IsWarLogPublic &&
                     stored.Location?.Id == fetched.Location?.Id &&
                     stored.Name == fetched.Name &&
                     stored.RequiredTrophies == fetched.RequiredTrophies &&
                     stored.Type == fetched.Type &&
                     stored.WarFrequency == fetched.WarFrequency &&
                     stored.WarLeague?.Id == fetched.WarLeague?.Id &&
                     stored.WarLosses == fetched.WarLosses &&
                     stored.WarTies == fetched.WarTies &&
                     stored.WarWins == fetched.WarWins &&
                     stored.WarWinStreak == fetched.WarWinStreak &&
                     stored.Labels.SequenceEqual(fetched.Labels) &&
                     fetched.Labels.SequenceEqual(stored.Labels) &&
                     Clan.ClanMembersJoined(stored, fetched).Count == 0 &&
                     Clan.ClanMembersLeft(stored, fetched).Count == 0 &&
                     Clan.Donations(stored, fetched).Count == 0 &&
                     Clan.DonationsReceived(stored, fetched).Count == 0));
        }
示例#2
0
        private async Task OnClanUpdated(object sender, ClanUpdatedEventArgs e)
        {
            var donations = Clan.Donations(e.Stored, e.Fetched);

            if (donations.Count > 0)
            {
                LogService.Log(LogLevel.Information, this.GetType().Name, null, "Clan updated" + donations.Count + " " + donations.Sum(d => d.Quanity));
            }
            else
            {
                LogService.Log(LogLevel.Information, this.GetType().Name, null, "Clan updated");
            }

            foreach (ClanMember member in Clan.ClanMembersLeft(e.Stored, e.Fetched))
            {
                Console.WriteLine(member.Name + " left");

                await _playersCache.AddOrUpdateAsync(member.Tag, true);
            }

            foreach (ClanMember member in Clan.ClanMembersJoined(e.Stored, e.Fetched))
            {
                Console.WriteLine(member.Name + " joined");

                await _playersCache.AddOrUpdateAsync(member.Tag, true);
            }
        }