Skip to content

Commit e490d27

Browse files
committed
Merge branch 'tautcony-master'
2 parents a6f3cca + dac3885 commit e490d27

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

BencodeNET.Net45/Objects/TorrentFile.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ public class TorrentFile : BObject<BDictionary>
99
{
1010
private readonly DateTime _epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
1111

12+
/// <summary>
13+
/// The dictionary that describes the file(s) of the torrent
14+
/// </summary>
1215
public BDictionary Info
1316
{
1417
get { return (BDictionary) Value[Fields.Info]; }
1518
set { Value[Fields.Info] = value; }
1619
}
1720

21+
/// <summary>
22+
/// The announce URL of the tracker
23+
/// </summary>
1824
public string Announce
1925
{
2026
get
@@ -26,26 +32,35 @@ public string Announce
2632
set { Value[Fields.Announce] = new BString(value); }
2733
}
2834

35+
/// <summary>
36+
/// The announce URLs list of the tracker [optional]
37+
/// </summary>
2938
public BList AnnounceList
3039
{
3140
get { return (BList) Value[Fields.AnnounceList] ?? new BList(); }
3241
set { Value[Fields.AnnounceList] = value; }
3342
}
3443

44+
/// <summary>
45+
/// The creation date of the .torrent file [optional]
46+
/// </summary>
3547
public DateTime CreationDate
3648
{
3749
get
3850
{
3951
var unixTime = (BNumber) Value[Fields.CreationDate];
40-
return _epoch.AddSeconds(unixTime);
52+
return unixTime == null ? DateTime.MinValue : _epoch.AddSeconds(unixTime);
4153
}
4254
set
4355
{
44-
var unixTime = value.Subtract(_epoch).TotalSeconds.ToString();
56+
var unixTime = (value.Subtract(_epoch).Ticks/TimeSpan.TicksPerSecond).ToString();
4557
Value[Fields.CreationDate] = new BString(unixTime);
4658
}
4759
}
4860

61+
/// <summary>
62+
/// The comment of the .torrent file [optional]
63+
/// </summary>
4964
public string Comment
5065
{
5166
get
@@ -57,6 +72,9 @@ public string Comment
5772
set { Value[Fields.Comment] = new BString(value); }
5873
}
5974

75+
/// <summary>
76+
/// The name and version of the program used to create the .torrent [optional]
77+
/// </summary>
6078
public string CreatedBy
6179
{
6280
get
@@ -68,6 +86,9 @@ public string CreatedBy
6886
set { Value[Fields.CreatedBy] = new BString(value); }
6987
}
7088

89+
/// <summary>
90+
/// The encoding used by the client that created the .torrent file [optional]
91+
/// </summary>
7192
public string Encoding
7293
{
7394
get

0 commit comments

Comments
 (0)