Exemple #1
0
 /// <summary>
 /// Creates a torrent and populates the <see cref="OriginalInfoHash"/> and <see cref="OriginalInfoHashBytes"/>
 /// properties from the provided <see cref="BDictionary"/>.
 /// </summary>
 /// <param name="originalInfoDictionary"></param>
 internal Torrent(BDictionary originalInfoDictionary)
 {
     OriginalInfoHashBytes = TorrentUtil.CalculateInfoHashBytes(originalInfoDictionary);
     OriginalInfoHash      = TorrentUtil.BytesToHexString(OriginalInfoHashBytes);
 }
Exemple #2
0
 /// <summary>
 /// Calculates the info hash of the torrent. This is used when communicating with trackers.
 /// The info hash is a 20-byte SHA1 hash of the value of the 'info' <see cref="BDictionary"/> of the torrent.
 /// </summary>
 /// <returns>A 20-byte SHA1 hash of the value of the 'info' part</returns>
 public virtual byte[] GetInfoHashBytes() => TorrentUtil.CalculateInfoHashBytes(this);
Exemple #3
0
 /// <summary>
 /// Creates a Magnet link in the BTIH (BitTorrent Info Hash) format: xt=urn:btih:{info hash}
 /// </summary>
 public virtual string GetMagnetLink(MagnetLinkOptions options = MagnetLinkOptions.IncludeTrackers)
 {
     return(TorrentUtil.CreateMagnetLink(this, options));
 }
Exemple #4
0
 /// <summary>
 /// Calculates the info hash of the torrent. This is used when communicating with trackers.
 /// The info hash is a 20-byte SHA1 hash of the value of the 'info' <see cref="BDictionary"/> of the torrent.
 /// </summary>
 /// <returns>A string representation of a 20-byte SHA1 hash of the value of the 'info' part</returns>
 public virtual string GetInfoHash() => TorrentUtil.CalculateInfoHash(this);