示例#1
0
 static public HtmlDocument GetCustomPage()
 {
     if (_customPage == null)
     {
         _customPage = RequestSender.GetRequestPage(_customPageUrl);
     }
     return(_customPage);
 }
示例#2
0
        static public HtmlDocument GetGenrePageHtml()
        {
            var genrePageUrl = ConfigsMain.GetDomen() + "/g";

            if (_genrePage == null)
            {
                _genrePage = RequestSender.GetRequestPage(genrePageUrl);
            }
            return(_genrePage);
        }
示例#3
0
        public List <Book> GetBookList()
        {
            var doc           = RequestSender.GetRequestPage(_siteUrl);
            var htmlBooksPage = doc.DocumentNode.SelectNodes(_bookLocator);
            var resultBooks   = new List <Book>();

            foreach (var node in htmlBooksPage)
            {
                resultBooks.Add(new Book(node.InnerText, node.GetAttributeValue("href", "error")));
            }
            return(resultBooks);
        }
示例#4
0
        public string GetBookAnotation(string url)
        {
            var bookUri = _siteDomen + url;
            var doc     = RequestSender.GetRequestPage(bookUri);
            var node    = doc.DocumentNode.SelectSingleNode(_bookAnotationLocator);

            if (node == null)
            {
                return(_blankAnnotationString);
            }
            else
            {
                return(node.InnerText);
            }
        }
示例#5
0
        public Image LoadBookImage(string url)
        {
            var bookUri = _siteDomen + url;
            var doc     = RequestSender.GetRequestPage(bookUri);
            var node    = doc.DocumentNode.SelectSingleNode(_imageLocator);

            if (node == null)
            {
                return(RequestSender.GetImageStub());
            }
            else
            {
                var imageUrl = node.GetAttributeValue("src", "error");
                imageUrl = _siteDomen + imageUrl;
                return(RequestSender.LoadImageFromUrl(imageUrl));
            }
        }