Expand|Select|Wrap|Line Numbers
- public void Load_ClassData(string c) {
- // Global Data Class init
- CGlobalData gd = new CGlobalData();
- gd.Talent = new List<string>();
- gd.Discription = new List<string>();
- // To Load new Data. Must reset old data
- // URI = InstallFolder / Version Folder / Using Version / Class Name / .xml
- // Later will be replaced with GetClassVersion()
- string uri = _settings[18] + "/wowv/" + "[3.2.2]" + c + ".xml";
- //try {
- XDocument doc = XDocument.Load(uri);
- //gd.TreeBG = doc.Root.Descendants().Where(x => x.Name == "Class").First().Attribute("bg").Value;
- //gd.TreeIco = doc.Root.Descendants().Where(x => x.Name == "Class").First().Attribute("treeico").Value;
- var qTalent = from x in doc.Root.Descendants()
- where x.Name == "Talent"
- select x;
- var qDisc = from z in doc.Root.Descendants()
- where z.Name == "disc"
- select z;
- foreach (XElement x in qTalent) {
- // <Talent> Parsing
- if (Int32.Parse(x.Attribute("pts").Value) > 0) {
- // If <Talent> Has another talent requirement attribute
- // Data = ID / Points / Title / Icon / Requirement (if has one)
- if (x.LastAttribute.Name == "req") { gd.Talent.Add(x.Attribute("id").Value + "," + x.Attribute("pts").Value + "," + x.Attribute("title").Value + "," + x.Attribute("icon").Value + "," + x.Attribute("req").Value); }
- else { gd.Talent.Add(x.Attribute("id").Value + "," + x.Attribute("pts").Value + "," + x.Attribute("title").Value + "," + x.Attribute("icon").Value); }
- // Write descripition
- // If Talent Points is over 1
- // Data = Replace String / Description paragraph
- ***** if (Int32.Parse(x.Attribute("pts").Value) > 1) { gd.Discription.Add(x.Descendants().First().Attribute("replace").Value + "]|[" + x.Descendants().First().Value); }
- else { gd.Discription.Add(x.Descendants().First().Value); }
- }
- else
- {
- // If Talent is "Empty", has 0 points, no description
- gd.Talent.Add(x.Attribute("id").Value + "," + x.Attribute("pts").Value);
- gd.Discription.Add("none");
- }
- }
- //} catch (Exception EX) { MessageBox.Show("Error: " + EX.Message); }
- }
- public class CGlobalData {
- // Current Class
- public int SelectedClass { get; set; }
- // This holds the Tree BG data
- public string TreeBG { get; set; }
- // This holds Tree Icon data
- public string TreeIco { get; set; }
- // This holds the actual data for each Talent: (id,title,icon,req*)
- public List<string> Talent;
- // This holds the Talent discription: [Replace Strings]
- public List<string> Discription;
- }
Any ideas?