/// <summary> /// Initializes an instance of the Torrent.Client.TrackerRequest class with the specified parameters. /// </summary> /// <param name="infoHash">The SHA1 hash of the value of the info key from the torrent metadata.</param> /// <param name="peerId">The Peer ID, used to uniquely identify the peer. 20 bytes.</param> /// <param name="port">The port at which the client is listening on. Typically 6881-6889.</param> /// <param name="uploaded">The total count of uploaded bytes.</param> /// <param name="downloaded">The total count of downloaded bytes.</param> /// <param name="left">The count of bytes left to download for the download to be complete.</param> /// <param name="compact">Whether to request a compact response by the tracker. (binary peers representation)</param> /// <param name="omitPeerIds">Whether to request that the tracker should omit peer IDs in the peers dictionary.</param> /// <param name="event">Specifies the event that caused the request. None by default.</param> public TrackerRequest(InfoHash infoHash, string peerId, ushort port, long uploaded, long downloaded, long left, bool compact, bool omitPeerIds, EventType @event = EventType.None, int?numWant = null) { Contract.Requires(infoHash != null); Contract.Requires(peerId != null); Contract.Requires(port > 0); Contract.Requires(uploaded >= 0); Contract.Requires(downloaded >= 0); Contract.Requires(left >= 0); InfoHash = infoHash; PeerId = peerId; Port = port; Uploaded = uploaded; Downloaded = downloaded; Left = left; Compact = compact; OmitPeerIds = omitPeerIds; Event = @event; NumWant = numWant; }
public TransferMonitor(InfoHash hash, long totalBytes) { TorrentHash = hash; TotalBytes = totalBytes; }
public void Regular(InfoHash hash, long downloaded, long uploaded, long remaining) { Announce(hash, downloaded, uploaded, remaining, EventType.None); }
public void Completed(InfoHash hash, long downloaded, long uploaded, long remaining) { Announce(hash, downloaded, uploaded, remaining, EventType.Completed); }
public static bool Deregister(InfoHash infoHash) { PeerConnectedCallback callback; return(InnerDictionary.TryRemove(infoHash, out callback)); }
public static bool Register(InfoHash infoHash, PeerConnectedCallback callback) { return(InnerDictionary.TryAdd(infoHash, callback)); }