« Previous - Version 2/4 (diff) - Next » - Current version
Alan McGovern, 04/13/2009 12:42 PM


Selective/Prioritised Downloading


        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;
            }
        }

Also available in: HTML TXT