コード例 #1
0
ファイル: Client.cs プロジェクト: MutsiMutsi/nkn-sdk-net
        private IEnumerable <string> GetAllSubscribersAsync(string topic, PublishOptions options)
        {
            options = options ?? new PublishOptions();

            var offset = options.Offset;

            var getSubscribersResult = this.GetSubscribersAsync(topic, options);

            var subscribers         = getSubscribersResult.Subscribers;
            var subscribersInTxPool = getSubscribersResult.SubscribersInTxPool;

            var walletOptions = options.Clone();

            while (getSubscribersResult.Subscribers != null && getSubscribersResult.Subscribers.Count() >= options.Limit)
            {
                offset += options.Limit;

                walletOptions.Offset = offset;
                walletOptions.TxPool = false;


                getSubscribersResult = this.GetSubscribersAsync(topic, walletOptions);

                if (getSubscribersResult.Subscribers != null)
                {
                    subscribers = subscribers.Concat(getSubscribersResult.Subscribers);
                }
            }

            if (options.TxPool == true && subscribersInTxPool != null)
            {
                subscribers = subscribers.Concat(subscribersInTxPool);
            }

            return(subscribers);
        }