Exemple #1
0
        private PagedEnumerator <Tuple <string, string> > TradeOffersBuySell(DiscordEmbedBuilder embed, Func <StoreComponent, TradeOffer, bool> filter, Func <Tuple <StoreComponent, TradeOffer>, string> context)
        {
            var sellOffers        = TradeHelper.SellOffers(filter);
            var groupedSellOffers = sellOffers.GroupBy(t => TradeHelper.StoreCurrencyName(t.Item1)).OrderBy(g => g.Key);

            var buyOffers        = TradeHelper.BuyOffers(filter);
            var groupedBuyOffers = buyOffers.GroupBy(t => TradeHelper.StoreCurrencyName(t.Item1)).OrderBy(g => g.Key);

            var fieldEnumerator = OffersToFields(groupedBuyOffers, groupedSellOffers, context).GetEnumerator();

            var pagedFieldEnumerator = new PagedEnumerator <Tuple <string, string> >(fieldEnumerator, EMBED_CONTENT_CHARACTER_LIMIT, field => field.Item1.Length + field.Item2.Length);

            pagedFieldEnumerator.ForEachInPage(field => { embed.AddField(field.Item1, field.Item2, true); });

            return(pagedFieldEnumerator);
        }