Esempio n. 1
0
 public void AddDeck(carddeck newdeck)
 {
     this.decklist.Add(newdeck);
     string[] values = new string[15];
     values[0] = newdeck.name;
     values[1] = newdeck.cardids.Count.ToString();
     values[2] = newdeck.getLeader();
     for (int i = 0; i < ((newdeck.cardids.Count > 12) ? 12 : newdeck.cardids.Count); i++)
     {
         values[3 + i] = newdeck.cardids[i].ToString();
     }
     base.Rows.Add(values);
     this.saveconfig();
 }
Esempio n. 2
0
 public void UpdateDeck(carddeck newdeck, int index)
 {
     this.decklist[index] = newdeck;
     base.Rows[index][0] = newdeck.name;
     base.Rows[index][1] = newdeck.cardids.Count.ToString();
     base.Rows[index][2] = newdeck.getLeader();
     for (int i = 0; i < 12; i++)
     {
         if (i < newdeck.cardids.Count)
         {
             base.Rows[index][3 + i] = newdeck.cardids[i].ToString();
         }
         else
         {
             base.Rows[index][3 + i] = "";
         }
     }
     this.saveconfig();
 }
Esempio n. 3
0
 private void loadconfig()
 {
     this.decklist.Clear();
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load("cards.xml");
         if (document.InnerXml != "")
         {
             int num = int.Parse(document.SelectSingleNode("cards").Attributes[0].InnerText);
             for (int i = 0; i < num; i++)
             {
                 carddeck carddeck3 = new carddeck(document.SelectSingleNode("cards").Attributes[(i * 3) + 1].InnerText, document.SelectSingleNode("cards").Attributes[(i * 3) + 2].InnerText) {
                     name = document.SelectSingleNode("cards").Attributes[(i * 3) + 3].InnerText
                 };
                 carddeck carddeck = carddeck3;
                 carddeck newdeck = carddeck;
                 this.AddDeck(newdeck);
             }
         }
         else
         {
             this.saveconfig();
         }
     }
     catch (Exception)
     {
         this.saveconfig();
     }
 }
Esempio n. 4
0
 private void button20_Click(object sender, EventArgs e)
 {
     if (this.listBox2.Items.Count >= 1)
     {
         string[] dec = new string[this.listBox2.Items.Count];
         int index = 0;
         foreach (object obj2 in this.listBox2.Items)
         {
             dec[index] = obj2.ToString();
             index++;
         }
         if (this.textBox8.Text != "")
         {
             carddeck newdeck = new carddeck(dec, this.textBox8.Text);
             this.cardset.AddDeck(newdeck);
         }
         else
         {
             carddeck carddeck2 = new carddeck(dec, null);
             this.cardset.AddDeck(carddeck2);
         }
     }
 }