private void OnGenerate(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(terrariaPathTextBox.Text)) {
                MessageBox.Show("The Terraria installation path has not been set. Please select the base directory of your Terraria installation.", "Terraria Map Generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!Directory.Exists(terrariaPathTextBox.Text)) {
                MessageBox.Show("The Terraria installation path is not valid. Please select the base directory of your Terraria installation.", "Terraria Map Generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (string.IsNullOrWhiteSpace(worldTextBox.Text)) {
                MessageBox.Show("The world file has not been set. Please enter the path to the world to generate the map tiles for.", "Terraria Map Generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!File.Exists(worldTextBox.Text)) {
                MessageBox.Show("The world file does not exist. Please enter a valid path for the world to generate the map tiles for.", "Terraria Map Generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (string.IsNullOrWhiteSpace(outputTextBox.Text)) {
                MessageBox.Show("The output directory was not specified. Please select the directory to write the map tiles to.", "Terraria Map Generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SetControlsEnabled(false);

            MapGeneratorForm generatorForm = new MapGeneratorForm();

            generatorForm.Generate(Options);
            generatorForm.ShowDialog(this);

            SetControlsEnabled(true);
        }
            public GuiMapGeneratorProgressHandler(MapGeneratorForm form)
            {
                if (form == null) {
                    throw new ArgumentNullException("form");
                }

                this.form = form;
            }