示例#1
0
        private void processNodes(List <HtmlNode> nodes)
        {
            foreach (HtmlNode link in nodes)
            {
                HtmlNode img         = link.Descendants("img").ToList()[0];
                HtmlNode a           = link.Descendants("a").ToList()[0];
                String   imageString = img.GetAttributeValue("src", null);
                String   imageTitle  = img.GetAttributeValue("alt", null);
                String   classString = a.GetAttributeValue("class", "no class");
                if (classString.Equals("badge-animated-cover"))
                {
                    imageString = a.Descendants("div").ToList()[0].GetAttributeValue("data-image", null);
                }
                if (!imageString.Substring(0, 4).Equals("http"))
                {
                    imageString = "http:" + imageString;
                }
                if (!imageString.Contains("nsfw"))
                {
                    outputBoxSetter(imageString);
                    SiteImage image = new SiteImage(imageString, imageTitle, "9gag");
                    images.Add(image);
                }
            }

            String last = images.Last().Address;

            lastImageId = last.Split('/').Last().Split('_').First();
        }
示例#2
0
        private void loadSiteImage(SiteImage siteImage)
        {
            try
            {
                pictureBox.Load(siteImage.Address);
                Console.WriteLine(pictureBox.Size);
                Console.WriteLine(panel1.Size);
            }
            catch (Exception exception)
            {
                pictureBox.Image = pictureBox.ErrorImage;
            }
            titleLabel.Text = WebUtility.HtmlDecode(siteImage.Title);
            int total   = imagesManager.Count();
            int current = imagesManager.CurrentIndex();

            countLabel.Text = current + 1 + "/" + total;
            siteLabel.Text  = siteImage.Site;
        }