comparison api/Factories/Xml/WarFoundryXmlFactory.cs @ 44:db951aad24b9

Re #50 - Complete loading of WarFoundry XML * Fix loading of armour type by fixing typo in Race schema * Revert to an exception if there is a parse error on the armour type (since the schema should validate it)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Mar 2009 17:10:49 +0000
parents d0812d7de39d
children 75a44b7753d4
comparison
equal deleted inserted replaced
43:d0812d7de39d 44:db951aad24b9
540 { 540 {
541 armourType = (ArmourType)Enum.Parse(typeof(ArmourType), elem.GetAttribute("armourType")); 541 armourType = (ArmourType)Enum.Parse(typeof(ArmourType), elem.GetAttribute("armourType"));
542 } 542 }
543 catch(ArgumentException ex) 543 catch(ArgumentException ex)
544 { 544 {
545 //throw new InvalidFileException("Attribute 'armourType' of equipment "+id+" was not a valid value from the enumeration"); 545 throw new InvalidFileException("Attribute 'armourType' of equipment "+id+" was not a valid value from the enumeration");
546 LogNotifier.WarnFormat(GetType(), "Invalid 'armourType' for equipment {0} - {1}", id, ex.Message); 546 }
547 armourType = ArmourType.None; 547
548 } 548 //TODO: Parse equipment stats if there are any
549
550 if (elem.ChildNodes.Count>0)
551 {
552 //It has stats!
553 //TODO: Parse equipment stats
554 }
555 549
556 return new EquipmentItem(id, name, cost, min, max, armourType, race); 550 return new EquipmentItem(id, name, cost, min, max, armourType, race);
557 } 551 }
558 } 552 }
559 } 553 }