public BitTorrentDownloader(string peerId, IBencodeParser bencodeParser, IHttpClientHelper httpClientHelper, ITcpSocketHelper tcpSocketHelper, ITorrentFactory torrentFactory, ITrackerResponseFactory trackerResponseFactory, IPeerEventDataFactory peerEventDataFactory) { _peerId = peerId; _bencodeParser = bencodeParser; _httpClientHelper = httpClientHelper; _tcpSocketHelper = tcpSocketHelper; _torrentFactory = torrentFactory; _trackerResponseFactory = trackerResponseFactory; _peerEventDataFactory = peerEventDataFactory; }
public PeerConnector(IPeerEventDataFactory peerEventDataFactory, ITcpSocketHelper tcpSocketHelper, string peerId, TorrentInfoSingle torrentInfo) { if (torrentInfo.InfoHash.Length != Constants.InfoHashLength) { throw new ArgumentException($"Info hash must be {Constants.InfoHashLength} bytes"); } if (peerId.Length != Constants.PeerIdLength) { throw new ArgumentException($"Peer id must be {Constants.PeerIdLength} bytes"); } PeerEventDataFactory = peerEventDataFactory; TcpSocketHelper = tcpSocketHelper; TorrentInfo = torrentInfo; PeerId = peerId; }