예제 #1
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[] { ',' });
                CSelect character = new CSelect();
                character.charID = Convert.ToInt32(split[0]);
                character.charName.Text = split[1];

                // Handles old files that do not have the userID
                if (split.Length > 2)
                    character.userID = Convert.ToInt32(split[2]);
                // Only show if no id was specified, or character matches id
                if (SpecificIDs.Count == 0 || SpecificIDs.Contains(character.userID.ToString()))
                    this.CharacterPanel.Children.Add(character);

            }
        }
예제 #2
0
        private void popListFromSettings()
        {
            string dlstr = String.Format("https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={0}", getIDs());
            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(dlstr);
            List<CSelect> charlist = new List<CSelect>();
            while (reader.Read()) {
                if (reader.HasAttributes) {
                    if (reader.IsEmptyElement) {
                        CSelect cha = new CSelect();
                        cha.charName.Text = reader.GetAttribute(0);
                        cha.charID = Convert.ToInt32(reader.GetAttribute(1));
                        charlist.Add(cha);
                    }
                }

            }
            foreach (CSelect c in charlist) {
                List<int> idList = new List<int>();
                if (this.CharacterPanel.Children.Count == 0) {
                    foreach (CSelect chara in charlist) {
                        this.CharacterPanel.Children.Add(chara);
                    }
                }
                foreach (CSelect chara in this.CharacterPanel.Children) {
                    idList.Add(chara.charID);
                }
                if (!idList.Contains(c.charID)) {
                    this.CharacterPanel.Children.Add(c);
                }
            }
        }