private void btn_ConfirmXmls_Click(object sender, EventArgs e) { TreeNode node = Settings_Tree.SelectedNode; if (node.Text != "Settings") { string[] temp = new string[Settings_CheckBoxList.Items.Count]; for (int i = 0; i < Settings_CheckBoxList.Items.Count; i++) { if (Settings_CheckBoxList.GetItemChecked(i)) { temp[i] = Settings_CheckBoxList.Items[i].ToString(); } // Do selected stuff else { // Do unselected stuff } } temp = temp.Where(x => !string.IsNullOrEmpty(x)).ToArray(); if (node.Text == "Monsters") { Utillities.monsterTable.Clear(); Utillities.monsters.Clear(); XmlReader.monsterDefaults = temp; XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Monsters\", "monster"); Utillities.InitType("monster", monster_gridView); } if (node.Text == "Spells") { Utillities.spellTable.Clear(); Utillities.spells.Clear(); XmlReader.spellDefaults = temp; XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Spells\", "spell"); Utillities.InitType("spell", spell_gridView); } if (node.Text == "Items") { Utillities.itemTable.Clear(); Utillities.items.Clear(); XmlReader.itemDefaults = temp; XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Items\", "item"); Utillities.InitType("item", item_gridView); } if (node.Text == "Players") { Utillities.playerTable.Clear(); XmlReader.playerDefaults = temp; XmlReader.LoadEncounter(Directory.GetCurrentDirectory() + @"\xmlFiles\Players\", XmlReader.playerDefaults, Utillities.playerTable); } if (node.Text == "Encounters") { Utillities.monsterPoolTable.Clear(); XmlReader.monsterPoolDefaults = temp; XmlReader.LoadEncounter(Directory.GetCurrentDirectory() + @"\xmlFiles\Encounters\", XmlReader.monsterPoolDefaults, Utillities.monsterPoolTable); } } }
public DndHelperForm() { InitializeComponent(); XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Monsters\", "monster"); Utillities.InitType("monster", monster_gridView); XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Spells\", "spell"); Utillities.InitType("spell", spell_gridView); XmlReader.TypeSpecificLoad(Utillities.monsters, @"\xmlFiles\Items\", "item"); Utillities.InitType("item", item_gridView); XmlReader.InitPlayers(); XmlReader.LoadEncounter(Directory.GetCurrentDirectory() + @"\xmlFiles\Players\", XmlReader.playerDefaults, Utillities.playerTable); player_gridView.DataSource = Utillities.playerTable; player_gridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; XmlReader.InitMonsterPool(); monsterPool_gridView.DataSource = Utillities.monsterPoolTable; monsterPool_gridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; Settings_Tree.ExpandAll(); }