Esempio n. 1
0
        private async void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            if (searchInput.Text == "")
            {
                return;
            }
            DisplayInformationMessage("Waiting for results...");

            List <Torrent> torrentsList;

            try
            {
                torrentsList = await T411Service.Search(searchInput.Text);
            }
            catch (JsonSerializationException error)
            {
                Console.WriteLine(error.Message);
                torrentsList = new List <Torrent>();
            }


            if (torrentsList.Count > 0)
            {
                torrentListView.TorrentList = torrentsList;
                torrentListView.Sort();
                DisplayTorrentsList();
            }
            else
            {
                DisplayInformationMessage("No torrents found.");
            }
        }
Esempio n. 2
0
        private static void t411()
        {
            if (!T411Service.VerifyToken())
            {
                auth();
            }

            while (true)
            {
                Console.Write("Search: ");
                string pattern = Console.ReadLine();

                var task = T411Service.Search(pattern, 10, T411Service.CID_SERIES);
                try
                {
                    task.Wait();
                }catch (Exception e)
                {
                    Console.WriteLine(e.InnerException.Message);
                    auth();
                    continue;
                }

                List <Torrent> results = task.Result;

                Console.WriteLine("Results: ");
                foreach (var t in results)
                {
                    Console.WriteLine($"{t.Id} : {t.Name}");
                }
                Console.WriteLine("---");
            }
        }