public async Task CheckNonsenseString() { IWebsiteLoader websiteLoader = new WebsiteLoader(); var request = await websiteLoader.LoadWebsite("a3rni3r"); Assert.AreEqual(null, request); }
public async Task CheckNullString() { IWebsiteLoader websiteLoader = new WebsiteLoader(); var request = await websiteLoader.LoadWebsite(null); Assert.AreEqual(null, request); }
public async Task CheckIfError() { IWebsiteLoader websiteLoader = new WebsiteLoader(); var request = await websiteLoader.LoadWebsite("https://bloodcat.com/osu/?q=freedom%20dive&c=b&s=&m=&g=&l="); Assert.AreEqual(null, request); }
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 TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { TextBlock tb = (TextBlock)sender; string linkToTorrent = tb.Text; WebsiteLoader.DownloadAndOpenTorrent(linkToTorrent); Console.WriteLine("We got a winner: " + tb.Text); }
public async Task CheckIfWebsiteLoaded() { IWebsiteLoader websiteLoader = new WebsiteLoader(); var request = await websiteLoader.LoadWebsite("https://bloodcat.com/osu/?q=freedom%20dive&c=b&s=&m=&g=&l="); var toCompare = new HttpResponseMessage(); toCompare.StatusCode = HttpStatusCode.OK; Assert.AreEqual(toCompare.StatusCode, request.StatusCode); }
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; } }