Exemplo n.º 1
0
        /// <summary>
        /// Creates a new guild card data with the following <see cref="Blocked"/> users and
        /// <see cref="Friends"/>.
        /// </summary>
        /// <param name="blocked">The blocked users.</param>
        /// <param name="friends">The friends.</param>
        public GuildCardData([NotNull] GuildCardEntry[] blocked, [NotNull] GuildCardFriend[] friends)
        {
            Blocked = blocked ?? throw new ArgumentNullException(nameof(blocked));
            Friends = friends ?? throw new ArgumentNullException(nameof(friends));

            if (Blocked.Length > BLOCKED_SIZE)
            {
                throw new ArgumentException($"{nameof(blocked)} exceeds max size of: {BLOCKED_SIZE}", nameof(blocked));
            }

            if (Friends.Length > FRIENDS_SIZE)
            {
                throw new ArgumentException($"{nameof(friends)} exceeds max size of: {FRIENDS_SIZE}", nameof(friends));
            }

            if (Blocked.Length != BLOCKED_SIZE)
            {
                Blocked = Blocked
                          .Concat(Enumerable.Repeat(GuildCardEntry.CreateEmpty(), Blocked.Length - BLOCKED_SIZE))
                          .ToArray();
            }

            if (Friends.Length != FRIENDS_SIZE)
            {
                Friends = Friends
                          .Concat(Enumerable.Repeat(GuildCardFriend.CreateEmpty(), Blocked.Length - FRIENDS_SIZE))
                          .ToArray();
            }
        }
Exemplo n.º 2
0
 public AuditXmlUpdate Merge(AuditXmlUpdate other)
 {
     return(new AuditXmlUpdate
     {
         Communities = Communities.Concat(other.Communities).DistinctBy(x => x.Name),
         Friends = Friends.Concat(other.Friends).DistinctBy(x => x.Id),
         Meetups = Meetups.Concat(other.Meetups).DistinctBy(x => x.Id),
         Speakers = Speakers.Concat(other.Speakers).DistinctBy(x => x.Id),
         Talks = Talks.Concat(other.Talks).DistinctBy(x => x.Id),
         Venues = Venues.Concat(other.Venues).DistinctBy(x => x.Id)
     });
 }
Exemplo n.º 3
0
 public IEnumerator <UserSearchResult> GetEnumerator() => Friends.Concat(Others).GetEnumerator();