Exemplo n.º 1
0
        static async Task Main(string[] args)
        {
            var address = "https://mail.ru/";
            var uri     = new Uri(address);
            var domain  = $"{uri.Scheme}://{uri.Host}";

            var strategy = Factory.GetSearchStrategy("First");
            //var strategy = Factory.GetSearchStrategy("Second");
            //var strategy = Factory.GetSearchStrategy("Third");

            var parser = new Parser(strategy);

            var returnedLinks = new ConcurrentDictionary <string, string>();

            Console.WriteLine("Search started");

            await parser.Parse(address, returnedLinks, domain);

            foreach (var link in returnedLinks.OrderBy(it => it.Key))
            {
                Console.WriteLine($"{link.Key} --- {link.Value}");
            }

            Console.WriteLine("Search finished");
        }
Exemplo n.º 2
0
        public async Task <List <Book> > GetSearchedBooks(string filter, string radioFilter)
        {
            ISearchStrategy searchStrategy = _searchStrategyFactory.GetSearchStrategy(radioFilter);

            if (searchStrategy != null)
            {
                return(await searchStrategy.GetSearchedBook(filter));
            }

            return(null);
        }