예제 #1
0
        private void btn_SpellMouseClick(object sender, MouseEventArgs e)
        {
            var    btn = (Button)sender;
            string str = Regex.Replace(btn.Name, "\\D+", "");
            int    n;

            int.TryParse(str, out n);


            String       file_name = csvFile;
            StreamReader sr        = new StreamReader(file_name);
            String       line;
            int          count = 0;

            while ((line = sr.ReadLine()) != null)
            {
                String[] tokens = line.Split(',');
                if (count == (n - 1))
                {
                    PlayerList[n - 1].KnownSpells = tokens[18];
                    PopulateForm(count);
                }
                count++;
            }
            sr.Close();


            KnownSpellsForm frm = new KnownSpellsForm(PlayerList[n - 1].KnownSpells, spellArr, csvFile, n);

            frm.ShowDialog();
        }
예제 #2
0
        private void btnAddSpell_Click(object sender, EventArgs e)
        {
            var    item      = spellArr.FirstOrDefault(o => o.name.ToLower() == txtSpellSearch.Text.ToLower());
            string spellName = "";

            try
            {
                spellName = spellArr[spellArr.FindIndex(o => o.name.ToLower() == txtSpellSearch.Text.ToLower())].name;
            }
            catch (Exception ex)
            {
            }
            if (item != null && spellName != "")
            {
                updateCSV(spellName);
                knownSpells += "#" + spellName;
                CreateLabel(spellName, 10, 40, 14.25F, count, spellName);
                KnownSpellsForm frm = new KnownSpellsForm(knownSpells, spellArr, csvFile, playerNumber);
                this.Visible = false;
                frm.ShowDialog();
                this.Close();
            }
        }