private bool Parse_Spell(XmlTextReader xml) { string name = null; string power = null; while (xml.MoveToNextAttribute()) { switch (xml.Name) { case "name": { name = xml.Value; continue; } case "power": { power = xml.Value; continue; } } return false; } if (name != null) { if (power == null) { power = ""; } Spell spell = new Spell(name, power, this.m_Start + this.m_SpellID); this.m_Spells[this.m_SpellID++] = spell; while (xml.Read()) { XmlNodeType nodeType = xml.NodeType; if (nodeType != XmlNodeType.Element) { if (nodeType != XmlNodeType.Comment) { return (nodeType == XmlNodeType.EndElement); } } else { switch (xml.Name) { case "reagent": { if (!this.Parse_Reagent(xml, spell)) { return false; } continue; } case "tithing": { if (!this.Parse_Tithing(xml, spell)) { return false; } continue; } case "skill": { if (!this.Parse_Skill(xml, spell)) { return false; } continue; } case "mana": if (this.Parse_Mana(xml, spell)) { continue; } return false; } return false; } } } return false; }
private bool Parse_Tithing(XmlTextReader xml, Spell spell) { string str = null; while (xml.MoveToNextAttribute()) { string str2; if (((str2 = xml.Name) != null) && (string.IsInterned(str2) == "value")) { str = xml.Value; } else { return false; } } if (str == null) { return false; } spell.Tithing = Convert.ToInt32(str); return true; }
private bool Parse_Reagent(XmlTextReader xml, Spell spell) { string name = null; while (xml.MoveToNextAttribute()) { string str2; if (((str2 = xml.Name) != null) && (string.IsInterned(str2) == "name")) { name = xml.Value; } else { return false; } } if (name == null) { return false; } spell.Reagents.Add(new Reagent(name)); return true; }