Exemplo n.º 1
0
 /// <summary>
 /// Sets the torrent priority.
 /// </summary>
 /// <param name="torrents">The torrents.</param>
 /// <param name="priority">The priority.</param>
 public void SetTorrentPriority(List <TorrentEntity> torrents, TorrentPriority priority)
 {
     foreach (var torrent in torrents)
     {
         foreach (var file in torrent.TorrentFiles.Where(t => t.IsSelected))
         {
             SetIndividualFilePriority(torrent, file, priority);
         }
     }
 }
Exemplo n.º 2
0
 public TorrentFileInfo(
     string name,
     Uri downloadUri,
     TorrentPriority priority,
     float size,
     int percentDone)
 {
     Name          = name ?? throw new ArgumentNullException(nameof(name));
     DownloadUri   = downloadUri;
     Priority      = priority;
     SizeMegabytes = size;
     PercentDone   = percentDone;
 }
Exemplo n.º 3
0
 public TorrentInfo(
     string id,
     string name,
     float size,
     int percentDone,
     TorrentStatus status,
     TorrentPriority priority,
     TimeSpan timeRemaining)
 {
     Id            = id ?? throw new ArgumentNullException(nameof(id));
     Name          = name ?? throw new ArgumentNullException(nameof(name));
     SizeMegabytes = size;
     PercentDone   = percentDone;
     Status        = status;
     Priority      = priority;
     TimeRemaining = timeRemaining;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the individual file priority.
        /// </summary>
        /// <param name="torrent">The torrent.</param>
        /// <param name="file">The file.</param>
        /// <param name="priority">The priority.</param>
        public void SetIndividualFilePriority(TorrentEntity torrent, TorrentFileEntity file, TorrentPriority priority)
        {
            var index = torrent.TorrentFiles.IndexOf(file);

            torrent.TorrentHandle.SetFilePriority(index, (int)priority);
            file.Priority     = priority;
            file.PriorityText = priority.ToString();
        }