SelectivePrioritised Downloading
Version 2 (Alan McGovern, 04/13/2009 12:42 PM) → Version 3/4 (Alan McGovern, 07/30/2009 01:20 AM)
h1. Selective/Prioritised Downloading
[[Selective/Prioritised Downloading#Example-1|Example 1]] Shows how to prevent certain files from being downloaded and also prioritise other files
h2. Example 1
<pre><code>
public void SelectiveDownload (TorrentManager manager)
{
Torrent torrent = manager.Torrent;
// Don't download any files in the 'Docs' subfolder
foreach (TorrentFile file in torrent.Files) {
if (file.Path.StartsWith ("Docs"))
file.Priority = Priority.DoNotDownload;
}
// Prioritise everything in the 'Data' subfolder
foreach (TorrentFile file in torrent.Files) {
if (file.Path.StartsWith ("Data"))
file.Priority = Priority.High;
}
// Get all '.txt' files first
foreach (TorrentFile file in torrent.Files) {
if (file.Path.EndsWith (".txt"))
file.Priority = Priority.Immediate;
}
}
</code>
</pre>