Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
        void DumpNLogEverything(List <List <string> > imageLists)
        {
            progessBar_dump.Maximum = 0;
            foreach (var item in imageLists)
            {
                progessBar_dump.Maximum = progessBar_dump.Maximum + item.Count;
            }

            foreach (var item in imageLists)
            {
                foreach (var listItem in item)
                {
                    textBox_log.Text = textBox_log.Text + Environment.NewLine + listItem;
                    textBox_log.Update();
                    Bitmap tmp = ImageScrape.GetImageFromURL(listItem);
                    ImageScrape.DumpedList.Add(tmp);
                    pictureBox_preview.Image = tmp;
                    pictureBox_preview.Update();
                    progessBar_dump.Value = progessBar_dump.Value + 1;
                    progessBar_dump.Update();
                    label_progress.Text = progessBar_dump.Value + "/" + GetMaxCount(imageLists);
                    label_progress.Update();
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// Inits the dumping process - Here is where the magic starts
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Dump_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
     {
         Duration1.Text        = "...";
         progessBar_dump.Value = 0;
         textBox_log.Text      = "";
         timer.Restart();
         Dump_Thread();
     }
 }
Beispiel #5
0
        /// <summary>
        /// Will download all images in the imageLists list and write everything into the logConsoleTextBox
        /// </summary>
        /// <param name="imageLists"></param>
        void DumpNLogEverything(List <List <string> > imageLists)
        {
            progessBar_dump.Value   = 0;
            progessBar_dump.Maximum = imageLists.Count;


            if (check_duplicates.Checked == false)
            {
                imageLists = ImageScrape.RemoveAllDuplicates(imageLists);
            }

            if (checkBox1.Checked == true)
            {
                // 4chan mode downloads the thumbnails and the full image
                // thumbnails will go in the "dump/4chan_thumb" folder
                // and the full images go in the "dump/4chan_full
                foreach (var item in imageLists)
                {
                    foreach (var listItem in item)
                    {
                        //  s.jpg
                        string tfullUrl = listItem;

                        string[] parts = tfullUrl.Split(new string[] { "s." }, StringSplitOptions.None);
                        tfullUrl = parts[0] + ".png";

                        textBox_log.AppendText(Environment.NewLine + tfullUrl);
                        textBox_log.Update();
                        Bitmap tmp = ImageScrape.GetImageFromURL(tfullUrl);

                        if (tmp.Tag == null)
                        {
                            tfullUrl = listItem;

                            parts    = tfullUrl.Split(new string[] { "s." }, StringSplitOptions.None);
                            tfullUrl = parts[0] + ".jpg";

                            textBox_log.AppendText(Environment.NewLine + tfullUrl);
                            textBox_log.Update();
                            tmp = ImageScrape.GetImageFromURL(tfullUrl);
                        }


                        if (tmp.Width != 1 && tmp.Height != 1)
                        {
                            //Grabs extension
                            parts = tfullUrl.Split('.');
                            string extension = parts[parts.Length - 1]; //Assumes the last section is the file name
                            ImageScrape.DumpedList.Add(new DumpImage(tmp, "." + extension));

                            pictureBox_preview.Image = tmp;
                            pictureBox_preview.Update();
                            progessBar_dump.Value = progessBar_dump.Value + 1;
                            progessBar_dump.Update();
                            label_progress.Text = progessBar_dump.Value + "/" + GetMaxCount(imageLists);
                            label_progress.Update();
                        }
                    }
                }
            }
            else
            {
                progessBar_dump.Maximum = 0;
                foreach (var item in imageLists)
                {
                    progessBar_dump.Maximum = progessBar_dump.Maximum + item.Count;
                }

                foreach (var item in imageLists)
                {
                    foreach (var listItem in item)
                    {
                        textBox_log.AppendText(Environment.NewLine + listItem);
                        textBox_log.Update();
                        Bitmap tmp = ImageScrape.GetImageFromURL(listItem);

                        //Grabs extension
                        string[] parts     = listItem.Split('.');
                        string   extension = parts[parts.Length - 1]; //Assumes the last section is the file name
                        ImageScrape.DumpedList.Add(new DumpImage(tmp, "." + extension));

                        pictureBox_preview.Image = tmp;
                        pictureBox_preview.Update();
                        progessBar_dump.Value = progessBar_dump.Value + 1;
                        progessBar_dump.Update();
                        label_progress.Text = progessBar_dump.Value + "/" + GetMaxCount(imageLists);
                        label_progress.Update();
                    }
                }
            }
        }
Beispiel #6
0
 private void button_addFilter_Click(object sender, EventArgs e)
 {
     ImageScrape.FilterList.Add(textBox_filter.Text);
     ImageScrape.SaveFilter();
     textBox_filter.Text = "";
 }
Beispiel #7
0
 private void Peview_Clean_Click(object sender, EventArgs e)
 {
     pictureBox_preview.Image = null;
     ImageScrape.ResetDumpedList();
 }
Beispiel #8
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ImageScrape.LoadFilter();
 }