예제 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(textBox1.Text))
     {
         DnDMasterTool frm = new DnDMasterTool(textBox1.Text);
         this.Visible = false;
         frm.ShowDialog();
         this.Close();
     }
 }
예제 #2
0
        private void btnAddPlayer_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(TxtAddPlayer.Text))
            {
                var btn = (Button)sender;
                TxtAddPlayer.Location = new System.Drawing.Point(TxtAddPlayer.Location.X, TxtAddPlayer.Location.Y + 125);
                btnAddPlayer.Location = new System.Drawing.Point(10, btnAddPlayer.Location.Y + 125);
                this.Height          += 125;


                List <String> lines = new List <String>();
                using (StreamReader reader = new StreamReader(csvFile))
                {
                    String line;

                    while ((line = reader.ReadLine()) != null)
                    {
                        lines.Add(line);
                    }
                    lines.Add(TxtAddPlayer.Text + ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,placeholder,placeholder,Bard,1");
                }
                using (StreamWriter writer = new StreamWriter(csvFile, false))
                {
                    foreach (String line in lines)
                    {
                        writer.WriteLine(line);
                    }
                }
                InitiativeList.Clear();
                for (int i = 0; i < PlayerList.Count(); i++)
                {
                    InitiativeList.Add(TextBoxList[i].Text);
                }
                DnDMasterTool frm = new DnDMasterTool(csvFile, InitiativeList);
                this.Visible = false;
                frm.ShowDialog();
                this.Close();
            }
        }
예제 #3
0
        private void DeletePlayerCSV(int playerNumber)
        {
            int           count = 1;
            List <String> lines = new List <String>();

            using (StreamReader reader = new StreamReader(csvFile))
            {
                String line;

                while ((line = reader.ReadLine()) != null)
                {
                    lines.Add(line);
                }
            }

            using (StreamWriter writer = new StreamWriter(csvFile, false))
            {
                foreach (String line in lines)
                {
                    if (count != playerNumber)
                    {
                        writer.WriteLine(line);
                    }
                    count++;
                }
            }
            InitiativeList.Clear();
            for (int i = 0; i < PlayerList.Count(); i++)
            {
                InitiativeList.Add(TextBoxList[i].Text);
            }
            DnDMasterTool frm = new DnDMasterTool(csvFile, InitiativeList);

            this.Visible = false;
            frm.ShowDialog();
            this.Close();
        }