SelectivePrioritised Downloading

Version 1 (Alan McGovern, 04/13/2009 12:42 PM)

1 1
h1. SelectivePrioritised Downloading
2 1
3 1
<pre><code>
4 1
		public void SelectiveDownload (TorrentManager manager)
5 1
		{
6 1
			Torrent torrent = manager.Torrent;
7 1
8 1
			// Don't download any files in the 'Docs' subfolder
9 1
			foreach (TorrentFile file in torrent.Files) {
10 1
				if (file.Path.StartsWith ("Docs"))
11 1
					file.Priority = Priority.DoNotDownload;
12 1
			}
13 1
14 1
			// Prioritise everything in the 'Data' subfolder
15 1
			foreach (TorrentFile file in torrent.Files) {
16 1
				if (file.Path.StartsWith ("Data"))
17 1
					file.Priority = Priority.High;
18 1
			}
19 1
20 1
			// Get all '.txt' files first
21 1
			foreach (TorrentFile file in torrent.Files) {
22 1
				if (file.Path.EndsWith (".txt"))
23 1
					file.Priority = Priority.Immediate;
24 1
			}
25 1
		}
26 1
</code>
27 1
</pre>