TorrentFile Class
public sealed class TorrentFileNo documentation is available.
Constructors
| Name | Description |
|---|---|
| TorrentFile() |
TorrentFile()
TorrentFile.cspublic TorrentFile()No documentation is available.
Properties
| Name | Description |
|---|---|
| Announce | |
| AnnounceList | |
| Comment | |
| CreatedBy | |
| CreationDate | |
| Encoding | The 'encoding' key naming the code page the text fields were written with. |
| HttpSeeds | Web seed URLs from the 'httpseeds' key (BEP 17). |
| Info | The metainfo dictionary. Replacing it discards the parsed bytes, so the info-hash is recomputed from the model. |
| Nodes | DHT bootstrap nodes from the 'nodes' key (BEP 5). |
| Publisher | |
| PublisherUrl | The 'publisher-url' key. Kept as text because the metainfo value is not guaranteed to be a well-formed URI. |
| UrlList | Web seed URLs from the 'url-list' key (BEP 19). |
Announce
TorrentFile.csAnnounceList
TorrentFile.cspublic IReadOnlyList<IReadOnlyList<string>>? AnnounceList { get; set; }Property value
No documentation is available.
Comment
TorrentFile.csCreatedBy
TorrentFile.csCreationDate
TorrentFile.csEncoding
TorrentFile.csHttpSeeds
TorrentFile.csWeb seed URLs from the 'httpseeds' key (BEP 17).
public IReadOnlyList<string>? HttpSeeds { get; set; }Property value
Info
TorrentFile.csThe metainfo dictionary. Replacing it discards the parsed bytes, so the info-hash is recomputed from the model.
public TorrentInfo Info { get; set; }Property value
Nodes
TorrentFile.csDHT bootstrap nodes from the 'nodes' key (BEP 5).
public IReadOnlyList<TorrentNode>? Nodes { get; set; }Property value
Publisher
TorrentFile.csPublisherUrl
TorrentFile.csUrlList
TorrentFile.csWeb seed URLs from the 'url-list' key (BEP 19).
public IReadOnlyList<string>? UrlList { get; set; }Property value
Remarks
BEP 19 allows a bare string as well as a list; both are read into this list, and it is always written back as a list.
Methods
| Name | Description |
|---|---|
| GetInfoHashSha1() | Computes the BitTorrent v1 info-hash. |
| GetInfoHashSha256() | Computes the SHA-256 of the 'info' dictionary. |
| Parse(ReadOnlySpan<byte>) | |
| ParseAsync(Stream, CancellationToken) | |
| ToUtf8ByteArray(bool) | |
| TryParse(ReadOnlySpan<byte>, TorrentFile?) | |
| WriteToAsync(Stream, bool, CancellationToken) |
GetInfoHashSha1()
TorrentFile.csComputes the BitTorrent v1 info-hash.
public byte[] GetInfoHashSha1()Returns
byte[]
Remarks
For a parsed torrent this hashes the exact bytes the 'info' dictionary was read from, so keys this model does not represent still contribute to the hash.
GetInfoHashSha256()
TorrentFile.csComputes the SHA-256 of the 'info' dictionary.
public byte[] GetInfoHashSha256()Returns
byte[]
Remarks
For a parsed torrent this hashes the exact bytes the 'info' dictionary was read from, so keys this model does not represent still contribute to the hash.
Parse(ReadOnlySpan<byte>)
TorrentFile.cspublic static TorrentFile Parse(ReadOnlySpan<byte> data)No documentation is available.
ParseAsync(Stream, CancellationToken)
TorrentFile.csnet10.0
public static ValueTask<TorrentFile> ParseAsync(Stream stream, CancellationToken cancellationToken = default)net11.0
public static ValueTask<TorrentFile> ParseAsync(Stream stream, CancellationToken cancellationToken = default)No documentation is available.
ToUtf8ByteArray(bool)
TorrentFile.csTryParse(ReadOnlySpan<byte>, TorrentFile?)
TorrentFile.cspublic static bool TryParse(ReadOnlySpan<byte> data, out TorrentFile? result)No documentation is available.
WriteToAsync(Stream, bool, CancellationToken)
TorrentFile.csnet10.0
public ValueTask WriteToAsync(Stream stream, bool canonical = true, CancellationToken cancellationToken = default)net11.0
public ValueTask WriteToAsync(Stream stream, bool canonical = true, CancellationToken cancellationToken = default)No documentation is available.