public void Setup()
        {
            int pieceLength = 16 * Constants.BlockSize;
            int pieces      = 40;
            int size        = pieces * pieceLength;

            bitfield    = new MutableBitField(pieces);
            torrentData = new TestTorrentData {
                Files       = TorrentFileInfo.Create(pieceLength, ("Test", size, "Full/Path/Test")),
                PieceLength = pieceLength,
                Size        = size
            };

            checker = new PiecePickerFilterChecker();
            picker  = new RarestFirstPicker(checker);
            picker.Initialise(torrentData);

            peer = PeerId.CreateNull(pieces);
            peer.BitField.SetAll(true);

            peers = new List <PeerId> ();
            for (int i = 0; i < 5; i++)
            {
                peers.Add(PeerId.CreateNull(pieces));
            }
        }
        public void Initialise(ITorrentData torrentData, IReadOnlyList <BitField> ignoringBitfields)
        {
            IgnorableBitfields = ignoringBitfields;
            TorrentData        = torrentData;

            Temp = new MutableBitField(TorrentData.PieceCount());

            IPiecePicker picker = new StandardPicker();

            picker = new RandomisedPicker(picker);
            picker = new RarestFirstPicker(picker);
            Picker = new PriorityPicker(picker);

            Picker.Initialise(torrentData);
        }
        public void Initialise(ITorrentManagerInfo torrentData, IReadOnlyList <ReadOnlyBitField> ignoringBitfields)
        {
            TorrentData       = torrentData.TorrentInfo !;
            IgnoringBitfields = ignoringBitfields;
            Temp = new BitField(TorrentData.PieceCount());

            var standardPicker = new StandardPicker();

            HighPriorityPicker = IgnoringPicker.Wrap(new PriorityPicker(standardPicker), ignoringBitfields);

            LowPriorityPicker = new RandomisedPicker(standardPicker);
            LowPriorityPicker = new RarestFirstPicker(LowPriorityPicker);
            LowPriorityPicker = new PriorityPicker(LowPriorityPicker);
            LowPriorityPicker = IgnoringPicker.Wrap(LowPriorityPicker, ignoringBitfields);

            LowPriorityPicker.Initialise(torrentData);
            HighPriorityPicker.Initialise(torrentData);
        }