public static IPiecePicker Wrap(IPiecePicker picker, IEnumerable <BitField> ignoringBitfields) { var result = picker; foreach (var bf in ignoringBitfields) { result = new IgnoringPicker(bf, result); } return(result); }
public void Initialise(ITorrentData torrentData, IReadOnlyList <BitField> ignoringBitfields) { TorrentData = torrentData; IPiecePicker picker = new StandardPicker(); picker = new RandomisedPicker(picker); picker = new RarestFirstPicker(picker); picker = new PriorityPicker(picker); Picker = IgnoringPicker.Wrap(picker, ignoringBitfields); Picker.Initialise(torrentData); }
public void Initialise(ITorrentData torrentData, IReadOnlyList <BitField> ignoringBitfields) { TorrentData = torrentData; 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); }