entity.MapForms.MapForm.injectBSPVisualMeshToolStripMenuItem_Click C# (CSharp) Method

injectBSPVisualMeshToolStripMenuItem_Click() private method

The inject bsp visual mesh tool strip menu item_ click.
private injectBSPVisualMeshToolStripMenuItem_Click ( object sender, EventArgs e ) : void
sender object The sender.
e System.EventArgs The e.
return void
        private void injectBSPVisualMeshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.SelectedPath = Prefs.pathExtractsFolder;
            if (folderBrowserDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            Prefs.pathExtractsFolder = folderBrowserDialog.SelectedPath;

            Form tempForm = new Form();
            tempForm.ControlBox = false;
            tempForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            tempForm.Size = new Size(250, 100);
            Label tempLabel = new Label();
            tempLabel.AutoSize = true;
            tempLabel.Location = new Point(20, 20);
            tempLabel.Text = "Loading BSP, please wait...";
            ProgressBar tempPB = new ProgressBar();
            tempPB.Location = new Point(20, 60);
            tempPB.Size = new Size(210, 20);
            tempPB.Minimum = 0;
            tempPB.Maximum = 100;
            tempForm.Controls.Add(tempLabel);
            tempForm.Controls.Add(tempPB);
            tempForm.Show();
            Application.DoEvents();

            BSPModel pm = new BSPModel(ref map.SelectedMeta);
            tempLabel.Text = "Loading Model...";
            tempPB.Value = 35;
            Application.DoEvents();
            Meta addme = pm.InjectModel(folderBrowserDialog.SelectedPath, map.SelectedMeta);

            /*
            addme.name += "(new)";
            addme.name = getNameDialog.Show("Choose injection name", "Meta Name:", addme.name, "OK");
            */
            ArrayList oi = new ArrayList();
            oi.Add(addme);

            tempLabel.Text = "Analyzing Layout...";
            tempPB.Value = 60;
            Application.DoEvents();

            MapAnalyzer analyze = new MapAnalyzer();
            MapLayout layout = analyze.ScanMapForLayOut(map, false);
            layout.ReadChunks(map);

            tempLabel.Text = "Rebuilding Map...";
            tempPB.Value = 70;
            Application.DoEvents();

            Builder build = new Builder();
            build.MapBuilder(oi, ref layout, map, false);

            tempLabel.Text = "Refreshing Map...";
            tempPB.Value = 95;
            Application.DoEvents();
            map = Map.Refresh(map);
            formFuncs.AddMetasToTreeView(map, treeView1, metaView, false);
            this.Enabled = true;

            #region Remove form that shows progress

            tempForm.Dispose();

            #endregion

            MessageBox.Show("Done");
        }
MapForm