/// <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); } } }
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; }
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; }
/// <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(); }