public ModVariableView(ModVariable modVar)
        {
            this.type   = modVar.getVariableTypeString();
            this.name   = modVar.name;
            this.defVal = modVar.getVariableValueString();

            this.tag = modVar;
        }
        private void modVars_dataGridView_SelectionChanged(object sender, EventArgs e)
        {
            DataGridView gridview_sender = (DataGridView)sender;

            foreach (DataGridViewRow row in this.modVars_dataGridView.SelectedRows)
            {
                ModVariable temp = ((ModVariableView)row.DataBoundItem).tag;

                this.setVarData(temp.var);
                this.varName_textbox.Text                 = temp.name;
                this.varDisplayName_textBox.Text          = temp.displayname;
                this.varInFileRepresentation_TextBox.Text = "{Var:" + temp.name + "}";
            }
        }
        private void removeVarButton_Click(object sender, EventArgs e)
        {
            if (this.modVars_dataGridView.SelectedRows.Count <= 0)
            {
                MessageBox.Show(
                    "You did not select any mod variables to remove.",
                    "No mod variable selected");
                return;
            }

            foreach (DataGridViewRow row in this.modVars_dataGridView.SelectedRows)
            {
                ModVariable temp = (ModVariable)row.DataBoundItem;

                this.modVars.Remove(temp);
            }

            this.removeVarButton.Enabled = (modVars.Count > 0 ? true : false);

            this.modVars_dataGridView.DataSource = getModVariableViews(this.modVars.ToList());
            this.modVars_dataGridView.Refresh();
        }
        private void addVarButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.varName_textbox.Text))
            {
                MessageBox.Show("You must enter a name for this mod variable.");
                return;
            }
            else if (String.IsNullOrWhiteSpace(this.varDefaultValue_combobox.Text))
            {
                MessageBox.Show("You must enter a default value for this mod variable.");
                return;
            }

            object newVar = new object();

            try
            {
                switch(this.varType_combobox.SelectedIndex)
                {
                    case 0:
                        newVar = Boolean.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 1:
                        newVar = this.varDefaultValue_combobox.Text;
                        break;
                    case 2:
                        newVar = float.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 3:
                        newVar = Double.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 4:
                        newVar = Int16.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 5:
                        newVar = UInt16.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 6:
                        newVar = Int32.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 7:
                        newVar = UInt32.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 8:
                        newVar = Int64.Parse(this.varDefaultValue_combobox.Text);
                        break;
                    case 9:
                        newVar = UInt64.Parse(this.varDefaultValue_combobox.Text);
                        break;
                }

            }
            catch(Exception exc)
            {
                MessageBox.Show("Default Variable Value:\n" + this.varDefaultValue_combobox.Text + "\nIs not valid to the " + this.varType_combobox.Text + " data type." +
                    "\n\nException:\n" + exc.Message, "Invalid Default Variable");
                return;
            }

            ModVariable newmodvar = new ModVariable(newVar, this.varName_textbox.Text, this.varDisplayName_textBox.Text);
            if (this.modVars.Contains(newmodvar))
                this.modVars.Remove(newmodvar);
            this.modVars.Add(newmodvar);

            this.removeVarButton.Enabled = (modVars.Count > 0 ? true : false);

            this.modVars_dataGridView.DataSource = getModVariableViews(this.modVars.ToList());
            this.modVars_dataGridView.Refresh();
        }
        public ModVariableView(ModVariable modVar)
        {
            this.type = modVar.getVariableTypeString();
            this.name = modVar.name;
            this.defVal = modVar.getVariableValueString();

            this.tag = modVar;
        }
        public override bool Equals(object obj)
        {
            ModVariable q = obj as ModVariable;

            return(q != null && q.name == this.name);
        }
        private void addVarButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.varName_textbox.Text))
            {
                MessageBox.Show("You must enter a name for this mod variable.");
                return;
            }
            else if (String.IsNullOrWhiteSpace(this.varDefaultValue_combobox.Text))
            {
                MessageBox.Show("You must enter a default value for this mod variable.");
                return;
            }

            object newVar = new object();

            try
            {
                switch (this.varType_combobox.SelectedIndex)
                {
                case 0:
                    newVar = Boolean.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 1:
                    newVar = this.varDefaultValue_combobox.Text;
                    break;

                case 2:
                    newVar = float.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 3:
                    newVar = Double.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 4:
                    newVar = Int16.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 5:
                    newVar = UInt16.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 6:
                    newVar = Int32.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 7:
                    newVar = UInt32.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 8:
                    newVar = Int64.Parse(this.varDefaultValue_combobox.Text);
                    break;

                case 9:
                    newVar = UInt64.Parse(this.varDefaultValue_combobox.Text);
                    break;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Default Variable Value:\n" + this.varDefaultValue_combobox.Text + "\nIs not valid to the " + this.varType_combobox.Text + " data type." +
                                "\n\nException:\n" + exc.Message, "Invalid Default Variable");
                return;
            }

            ModVariable newmodvar = new ModVariable(newVar, this.varName_textbox.Text, this.varDisplayName_textBox.Text);

            if (this.modVars.Contains(newmodvar))
            {
                this.modVars.Remove(newmodvar);
            }
            this.modVars.Add(newmodvar);

            this.removeVarButton.Enabled = (modVars.Count > 0 ? true : false);

            this.modVars_dataGridView.DataSource = getModVariableViews(this.modVars.ToList());
            this.modVars_dataGridView.Refresh();
        }