public void Setup() { alreadyGot = new List<Block>(); bitfield = new BitField(40).SetAll(true); picker = new EndGamePicker(); pieces = new List<Piece>(new Piece[] { new Piece(4, rig.Torrent), new Piece(6, rig.Torrent), new Piece(36, rig.Torrent), new Piece(24, rig.Torrent) }); for (int i = 0; i < pieces.Count; i++) { for (int j = 0; j < pieces[i].BlockCount; j++) { if (j % 3 == 0) { pieces[i].Blocks[j].CreateRequest(id); if (j % 2 == 0) { pieces[i].Blocks[j].Received = true; } pieces[i].Blocks[j].Requested = true; alreadyGot.Add(pieces[i].Blocks[j]); } } } picker.Initialise(bitfield, rig.Torrent.Files, pieces); }
public void Setup() { bitfield = new BitField(40).SetAll(true) .Set(4, false) .Set(6, false) .Set(24, false) .Set(36, false); picker = new EndGamePicker(); pieces = new List <Piece>(new Piece[] { new Piece(4, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(6, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(24, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(36, rig.Torrent.PieceLength, rig.Torrent.Size) }); id = new PeerId(new Peer("peerid", new Uri("tcp://weburl.com")), rig.Manager); id.Encryptor = id.Decryptor = PlainTextEncryption.Instance; id.IsChoking = false; id.BitField.SetAll(false); other = new PeerId(new Peer("other", new Uri("tcp://other.com")), rig.Manager); other.Decryptor = other.Encryptor = PlainTextEncryption.Instance; other.IsChoking = false; other.BitField.SetAll(false); }
public void Setup() { rig = TestRig.CreateMultiFile(); bitfield = new BitField(40).SetAll(true) .Set(4, false) .Set(6, false) .Set(24, false) .Set(36, false); picker = new EndGamePicker(); pieces = new List <Piece>(new Piece[] { new Piece(4, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(6, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(24, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(36, rig.Torrent.PieceLength, rig.Torrent.Size) }); id = new PeerId(new Peer("peerid", new Uri("tcp://weburl.com")), rig.Manager); id.IsChoking = false; id.BitField.SetAll(false); other = new PeerId(new Peer("other", new Uri("tcp://other.com")), rig.Manager); other.IsChoking = false; other.BitField.SetAll(false); }
public EndGamePickerTests() { rig = TestRig.CreateMultiFile(); bitfield = new BitField(40).SetAll(true) .Set(4, false) .Set(6, false) .Set(24, false) .Set(36, false); picker = new EndGamePicker(); pieces = new List<Piece>(new[] { new Piece(4, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(6, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(24, rig.Torrent.PieceLength, rig.Torrent.Size), new Piece(36, rig.Torrent.PieceLength, rig.Torrent.Size) }); id = new PeerId(new Peer("peerid", new Uri("tcp://weburl.com")), rig.Manager); id.IsChoking = false; id.BitField.SetAll(false); other = new PeerId(new Peer("other", new Uri("tcp://other.com")), rig.Manager); other.IsChoking = false; other.BitField.SetAll(false); }
public EndGameSwitcher(StandardPicker standard, EndGamePicker endgame, int blocksPerPiece, TorrentManager torrentManager) : base(null) { this.standard = standard; this.endgame = endgame; this.blocksPerPiece = blocksPerPiece; this.torrentManager = torrentManager; }
public EndGameSwitcher(StandardPicker standard, EndGamePicker endgame, int blocksPerPiece, TorrentManager torrentManager) : base(null) { this.standard = standard; this.endgame = endgame; this.blocksPerPiece = blocksPerPiece; this.torrentManager = torrentManager; }