Example #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();
            }
        }
Example #2
0
 public static GuildCardData CreateEmpty()
 {
     return(new GuildCardData(Enumerable.Repeat(GuildCardEntry.CreateEmpty(), 29).ToArray(), Enumerable.Repeat(GuildCardFriend.CreateEmpty(), 104).ToArray()));
 }