Skip to content

Commit b411941

Browse files
committed
Fix and change Torrent.Pieces to be byte[]
1 parent 6fad418 commit b411941

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

BencodeNET/Parsing/TorrentParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected Torrent CreateTorrent(BDictionary data)
6262
{
6363
IsPrivate = info.Get<BNumber>(TorrentInfoFields.Private) == 1,
6464
PieceSize = info.Get<BNumber>(TorrentInfoFields.PieceLength),
65-
Pieces = info.Get<BString>(TorrentInfoFields.Pieces)?.ToString(),
65+
Pieces = info.Get<BString>(TorrentInfoFields.Pieces)?.Value.ToArray() ?? new byte[0],
6666

6767
Comment = data.Get<BString>(TorrentFields.Comment)?.ToString(),
6868
CreatedBy = data.Get<BString>(TorrentFields.CreatedBy)?.ToString(),

BencodeNET/Torrents/Torrent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public virtual string DisplayName
129129
/// <summary>
130130
/// A concatenation of all 20-byte SHA1 hash values (one for each piece).
131131
/// </summary>
132-
public virtual string Pieces { get; set; }
132+
public virtual byte[] Pieces { get; set; }
133133

134134
/// <summary>
135135
/// [optional] If set to true clients must only publish it's presence to the defined trackers.

0 commit comments

Comments
 (0)