Example #1
0
        private void btGrab_Click(object sender, EventArgs e)
        {
            try
            {
                //So the user has clicked the Grab Button! Before we start grabbing, we need to validate all the Input.

                //We start by gathering settings and this will be null if any setting is invalid
                SettingsObject settings = GetSettings();

                if (settings != null)
                {
                    //The settings are valid and we are good to go!
                    btGrab.Enabled     = false;
                    progressBar1.Value = 0;


                    //Create a new webGrabber object to start our work! :D
                    WebPageGrabber Grabber = new WebPageGrabber(settings);
                    GrabberThread = new Thread(() => Grabber.StartGrab());
                    GrabberThread.Start();

                    btAbort.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception Occured!" + Environment.NewLine + Environment.NewLine + "Details: " + Environment.NewLine + ex.Message);
            }
        }
Example #2
0
        private SettingsObject GetSettings()
        {
            //////////////////////////////////////////
            string DestinationFolder = strCmdTextEdit;
            //////////////////////////////////////////

            //Create new Settings Object:
            SettingsObject Settings = new SettingsObject(this);

            Settings.DestinationFolder = DestinationFolder;
            Settings.Depth             = Convert.ToInt16(information_aboutclient[3]);
            //////////////////////////////////////////
            Settings.URL = information_aboutclient[0];
            /////////////////////////////////////////
            return(Settings);
        }
Example #3
0
        private void btGrab_Click(object sender, EventArgs e)
        {
            try
            {
                SettingsObject settings = GetSettings();
                if (settings != null)
                {
                    //The settings are valid and we are good to go!
                    btGrab.Enabled = false;


                    //Create a new webGrabber object to start our work! :D
                    WebPageGrabber Grabber = new WebPageGrabber(settings);
                    GrabberThread = new Thread(() => Grabber.StartGrab());
                    GrabberThread.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception Occured!" + Environment.NewLine + Environment.NewLine + "Details: " + Environment.NewLine + ex.Message);
            }
        }
Example #4
0
        private SettingsObject GetSettings()
        {
            //Check if entered URL is valid
            if (!Utilities.IsUrlValid(tbURL.Text))
            {
                UpdateStatusText("Invalid URL! Make sure you begin with http://");
                return(null);
            }

            //Get Destination Folder
            string DestinationFolder = Utilities.GetFolderSelection();

            if (DestinationFolder == string.Empty || !System.IO.Directory.Exists(DestinationFolder))
            {
                //Error due to invalid Directory.
                UpdateStatusText("Invalid Directory! Please try again and select a correct directory.");
                return(null);
            }


            //Check Other Settings
            tbSavePath.Text = DestinationFolder;
            tbProgress.Clear();

            //validate depth


            //Create new Settings Object:
            SettingsObject Settings = new SettingsObject(this);

            Settings.DestinationFolder = DestinationFolder;
            Settings.Depth             = Convert.ToInt16(tbDepth.Text);
            Settings.URL = tbURL.Text;



            return(Settings);
        }
Example #5
0
 public WebPageGrabber(SettingsObject _settings)
 {
     Settings     = _settings;
     VisitedLinks = new Dictionary <string, string>();
 }