public void Load(int dexNum) { DexNum = dexNum; using (XmlReader reader = XmlReader.Create(Paths.DataPath + "Dex\\" + DexNum + ".xml")) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "DexNum": { DexNum = reader.ReadString().ToInt(); break; } case "Name": { Name = reader.ReadString(); break; } case "SpeciesName": { SpeciesName = reader.ReadString(); break; } case "GrowthGroup": { Growth = reader.ReadString().ToEnum <Enums.GrowthGroup>(); break; } case "EggGroup1": { string group = reader.ReadString(); if (group.IsEnum <Enums.EggGroup>()) { EggGroup1 = group.ToEnum <Enums.EggGroup>(); } break; } case "EggGroup2": { string group = reader.ReadString(); if (group.IsEnum <Enums.EggGroup>()) { EggGroup2 = group.ToEnum <Enums.EggGroup>(); } break; } } } } } int formNum = 0; while (File.Exists(Paths.DataPath + "Dex\\" + DexNum + "-" + formNum + ".xml")) { DexFormEntry form = new DexFormEntry(); form.Load(DexNum, formNum); Forms.Add(form); formNum++; } }
public void Load(int dexNum) { DexNum = dexNum; using (XmlReader reader = XmlReader.Create(Paths.DataPath + "Dex\\" + DexNum + ".xml")) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "DexNum": { DexNum = reader.ReadString().ToInt(); break; } case "Name": { Name = reader.ReadString(); break; } case "SpeciesName": { SpeciesName = reader.ReadString(); break; } case "GrowthGroup": { Growth = reader.ReadString().ToEnum<Enums.GrowthGroup>(); break; } case "EggGroup1": { string group = reader.ReadString(); if (group.IsEnum<Enums.EggGroup>()) EggGroup1 = group.ToEnum<Enums.EggGroup>(); break; } case "EggGroup2": { string group = reader.ReadString(); if (group.IsEnum<Enums.EggGroup>()) EggGroup2 = group.ToEnum<Enums.EggGroup>(); break; } } } } } int formNum = 0; while (File.Exists(Paths.DataPath + "Dex\\" + DexNum + "-" + formNum + ".xml")) { DexFormEntry form = new DexFormEntry(); form.Load(DexNum, formNum); Forms.Add(form); formNum++; } }