コード例 #1
0
 private void PrintTorrentInfo()
 {
     Console.WriteLine($@"AnnounceURL: {_torrent.GetAnnounceList().First()}");
     Console.WriteLine($@"Comment: {_torrent.Comment}");
     Console.WriteLine($@"CreatedBy: {_torrent.CreatedBy}");
     Console.WriteLine($@"CreationDate: {_torrent.CreationDate}");
     Console.WriteLine($@"IsPrivate: {_torrent.IsPrivate}");
     Console.WriteLine($@"Source: {_torrent.Source}");
     Console.WriteLine($@"TorrentName: {_torrent.TorrentName}");
 }
コード例 #2
0
        public void TestLoadTorrent3()
        {
            const string torrentPath = @"..\..\[Torrent Sample]\Martian.torrent";

            _torrent = new TorrentData(torrentPath);
            PrintTorrentInfo();
            Assert.IsTrue(_torrent.GetAnnounceList().First() == "http://tracker.hdtime.org/announce.php?passkey=passkey");
            Assert.IsTrue(string.IsNullOrEmpty(_torrent.Comment));
            Assert.IsTrue(_torrent.CreatedBy == null);
            Assert.IsTrue(_torrent.CreationDate == new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Add(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)));
            Assert.IsFalse(_torrent.IsPrivate);
            Assert.IsTrue(_torrent.Source == "[hdtime.org] HDTIME");
            Assert.IsTrue(_torrent.TorrentName == "The Martian 2015 HD-VOD HC x264 AC3-CPG");
            var fileList = _torrent.GetFileList();

            Assert.IsTrue(fileList.Count == 1);
            Assert.IsTrue(fileList["root"].Count == 2);
            Assert.IsTrue(fileList.Keys.Sum(category => fileList[category].Count(item => item.State == FileState.InValidFile)) == 2);
        }
コード例 #3
0
        public void TestLoadTorrent2()
        {
            const string torrentPath = @"..\..\[Torrent Sample]\SingleFile.torrent";

            _torrent = new TorrentData(torrentPath);
            PrintTorrentInfo();
            Assert.IsTrue(_torrent.GetAnnounceList().First() == "http://tracker.dmhy.org/announce?secure=securecode");
            Assert.IsTrue(string.IsNullOrEmpty(_torrent.Comment));
            Assert.IsTrue(_torrent.CreatedBy == "uTorrent/3220");
            Assert.IsTrue(_torrent.CreationDate == (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1414723640)).Add(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)));
            Assert.IsTrue(_torrent.IsPrivate);
            Assert.IsTrue(_torrent.Source == "[u2.dmhy.org] U2分享園@動漫花園");
            Assert.IsTrue(_torrent.TorrentName == "[FLsnow][Tamako_love_story][MOVIE][外挂结构].rar");
            var fileList = _torrent.GetFileList();

            Assert.IsTrue(fileList.Count == 1);
            Assert.IsTrue(fileList["single"].Count == 1);
            Assert.IsTrue(fileList.Keys.Sum(category => fileList[category].Count(item => item.State == FileState.InValidFile)) == 0);
        }
コード例 #4
0
        public void TestLoadTorrent1()
        {
            const string torrentPath = @"..\..\[Torrent Sample]\Comment.torrent";

            _torrent = new TorrentData(torrentPath);
            PrintTorrentInfo();
            Assert.IsTrue(_torrent.GetAnnounceList().First() == "http://tracker.dmhy.org/announce?secure=securecode");
            Assert.IsTrue(_torrent.Comment == "Ripped And Scanned By imi415@U2");
            Assert.IsTrue(_torrent.CreatedBy == "uTorrent/3.4.2");
            Assert.IsTrue(_torrent.CreationDate == (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1415247690)).Add(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)));
            Assert.IsTrue(_torrent.IsPrivate);
            Assert.IsTrue(_torrent.Source == "[u2.dmhy.org] U2分享園@動漫花園");
            Assert.IsTrue(_torrent.TorrentName == "南條愛乃 - あなたの愛した世界");
            var fileList = _torrent.GetFileList();

            Assert.IsTrue(fileList.Count == 2);
            Assert.IsTrue(fileList["root"].Count == 4);
            Assert.IsTrue(fileList["スキャン"].Count == 12);
            Assert.IsTrue(fileList.Keys.Sum(category => fileList[category].Count(item => item.State == FileState.InValidFile)) == 14);
        }