private void WebBrowser_DocumentCompleted() { try { System.IO.File.WriteAllText("dumpedCode.txt", webBrowser.DocumentText); System.IO.Directory.CreateDirectory("dumpedImages"); var images = webBrowser.Document .GetElementsByTagName("img") .OfType <HtmlElement>() .Select(x => x.GetAttribute("src")) .ToList(); List <List <string> > dumpingList = ImageScrape.GetAllImageLinks(images); //Main functionality DumpNLogEverything(dumpingList); pictureBox_preview.Image = ImageScrape.DumpedList[0].Image; maxShow = ImageScrape.DumpedList.Count; //Shows how long the operation took timer.Stop(); Duration1.Text = timer.ElapsedMilliseconds + " ms"; if (check_openDirectory.Checked == true) { Process.Start("dumpedImages"); } } catch (Exception ex) { MessageBox.Show("WebBrowser: " + ex.Message); } }
private void button1_Click(object sender, EventArgs e) { ImageScrape.LoadFilter(); if (ImageScrape.FilterList.Count <= 0) { MessageBox.Show("You need to add an filter first! (ex: .png, .bmp, .gif)"); } else { progessBar_dump.Value = 0; string webUrl = ImageScrape.PrepareUrl(textBox_url.Text); textBox_log.Text = ""; string dumpedCode = ImageScrape.DumpHTML(webUrl); System.IO.File.WriteAllText("dumpedCode.txt", dumpedCode); System.IO.Directory.CreateDirectory("dumpedImages"); List <List <string> > dumpingList = ImageScrape.GetAllImageLinks(); label_progress.Text = "0/" + GetMaxCount(dumpingList); DumpNLogEverything(dumpingList); if (check_openDirectory.Checked == true) { Process.Start("dumpedImages"); } pictureBox_preview.Image = ImageScrape.DumpedList[0]; maxShow = ImageScrape.DumpedList.Count; } }