Exemplo n.º 1
0
        private void popListFromSettings()
        {
            string dlstr = String.Format("https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={0}", getCharIDs());
            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(dlstr);
            List<Character> charlist = new List<Character>();
            while (reader.Read()) {
                if (reader.HasAttributes) {
                    if (reader.IsEmptyElement) {
                        Character cha = new Character(this);
                        cha.charName.Text = reader.GetAttribute(0);
                        cha.charID = Convert.ToInt32(reader.GetAttribute(1));
                        foreach (Account a in main.accountsPanel.Children) {
                            if (a.charIDs.Contains(cha.charID)) {
                                cha.accountID = Convert.ToInt32(a.accountID.Text);
                                break;
                            }
                            else {
                                cha.accountID = 0;
                            }
                        }

                        charlist.Add(cha);
                    }
                }

            }
            foreach (Character c in charlist) {
                List<int> idList = new List<int>();
                if (this.CharacterPanel.Children.Count == 0) {
                    foreach (Character chara in charlist) {
                        this.CharacterPanel.Children.Add(chara);
                    }
                }
                foreach( Character chara in this.CharacterPanel.Children ) {
                    idList.Add(chara.charID);
                }
                if (!idList.Contains(c.charID)) {
                    this.CharacterPanel.Children.Add(c);
                }
            }
        }
Exemplo n.º 2
0
 private void popListFromFile()
 {
     if (Properties.Settings.Default.Characters == null) {
         return;
     }
     foreach ( string chara in Properties.Settings.Default.Characters ) {
         string[] split = chara.Split(new char[] {','});
         Character m8 = new Character(this);
         m8.charID = Convert.ToInt32(split[0]);;
         m8.charName.Text = split[1];
         foreach (Account a in this.main.accountsPanel.Children) {
             if (a.charIDs.Contains(m8.charID)) {
                 m8.accountID = Convert.ToInt32(a.accountID.Text);
                 break;
             }
             else {
                 m8.accountID = 0;
             }
         }
         this.CharacterPanel.Children.Add(m8);
     }
 }