Пример #1
0
        public void Setup()
        {
            singleFile     = CreateSingleFile();
            singleBitfield = new BitField(singleFile.TorrentInfo.PieceCount()).SetAll(true);
            singlePeer     = PeerId.CreateNull(singleBitfield.Length);

            multiFile     = CreateMultiFile();
            multiBitfield = new BitField(multiFile.TorrentInfo.PieceCount()).SetAll(true);
            multiPeer     = PeerId.CreateNull(multiBitfield.Length);

            checker = new PiecePickerFilterChecker();
            picker  = new PriorityPicker(checker);
            peers   = new List <PeerId> ();
        }
        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);
        }