public MainWindow() { InitializeComponent(); List <Item> items = WebsiteLoader.GetChannelFromNyaa(); List <Torrent> torrentsToDisplay = new List <Torrent>(); foreach (Item item in items) { torrentsToDisplay.Add(new Torrent() { Name = item.title, SeedersInt = Int16.Parse(item.seeders), Seeders = (item.seeders + "\t/ " + item.leechers), Link = item.link }); } torrentsToDisplay = torrentsToDisplay.OrderByDescending(x => x.SeedersInt).ToList(); listView.ItemsSource = torrentsToDisplay; Assembly asm = Assembly.GetExecutingAssembly(); string path = System.IO.Path.GetDirectoryName(asm.Location); using (WebClient client = new WebClient()) { for (int i = 0; i < 3; i++) { //client.DownloadFile(torrentsToDisplay[i].Link, "torrent" + i + ".torrent"); //string pathToTorrent = Path.Combine(path, "torrent" + i + ".torrent"); //Process.Start(pathToTorrent); } } }
private void SearchField_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { List <Item> items = WebsiteLoader.GetChannelFromNyaa(SearchField.Text); List <Torrent> torrentsToDisplay = new List <Torrent>(); foreach (Item item in items) { torrentsToDisplay.Add(new Torrent() { Name = item.title, SeedersInt = Int16.Parse(item.seeders), Seeders = (item.seeders + "\t/ " + item.leechers), Link = item.link }); } torrentsToDisplay = torrentsToDisplay.OrderByDescending(x => x.SeedersInt).ToList(); listView.ItemsSource = torrentsToDisplay; } }