private static ExFavoriteList FromHtml(string htmlSource, ExFavoriteSortingMode sortingMode) { if (htmlSource == null) { return(null); } var l = new ExFavoriteList(); HtmlDocument htmlDocument = new HtmlDocument(); htmlDocument.OptionFixNestedTags = true; htmlDocument.LoadHtml(htmlSource); HtmlNodeCollection galleryNodes; try { var tableNode = htmlDocument.DocumentNode.SelectSingleNode("//*[@class='itg glt']"); galleryNodes = tableNode.SelectNodes("//tr[./td/@class='gl1e']"); foreach (var node in galleryNodes) { l.Add(ExGallery.GetGalleryListItemFromNode(node)); } l.PageCount = ReadPageCount(htmlDocument); l.CurrentPageNumber = ReadCurrentPageNumber(htmlDocument); } catch (Exception ex) { } return(l); }
private static ExFavoriteList FromHtml(string htmlSource, ExFavoriteSortingMode sortingMode) { if (htmlSource == null) { return(null); } var l = new ExFavoriteList(); HtmlDocument htmlDocument = new HtmlDocument(); htmlDocument.OptionFixNestedTags = true; htmlDocument.LoadHtml(htmlSource); try { HtmlNodeCollection favoriteItemNodes = htmlDocument.DocumentNode.SelectNodes("//tr[@class]"); foreach (var node in favoriteItemNodes) { l.Add(ExFavorite.FromHtmlNode(node)); } l.PageCount = ReadPageCount(htmlDocument); l.CurrentPageNumber = ReadCurrentPageNumber(htmlDocument); } catch (Exception ex) { throw new Exception("Cannot load favorite list html"); } l.SortingMode = sortingMode; return(l); }