예제 #1
0
        internal void UpdateTorrent(UTorrentAPI.Torrent torrent)
        {
            if (torrent == null)
            {
                Status = TorrentStateStatus.NotFound;
                return;
            }
            _torrent = torrent;
            Status = TorrentStateStatus.Downloading;
            _file = FindFile(torrent);
            if (_file != null)
            {
                FilePath = _file.Path;
                if (_file.SizeInBytes == _file.DownloadedBytes) Status = TorrentStateStatus.Done;

            }
        }
예제 #2
0
 private UTorrentAPI.File FindFile(UTorrentAPI.Torrent torrent)
 {
     var cn = Episode.EncodeName(_season, _number);
     return torrent.Files.Where(f => f.Path.IndexOf(cn, StringComparison.OrdinalIgnoreCase) >= 0).FirstOrDefault();
 }