# HG changeset patch # User IBBoard # Date 1249155924 0 # Node ID 9fba3b4ccdcdd226ec2dca0d813c68516f6fe523 # Parent 129636305ad73f827c26afdff2f22f71d156a7fc Re #50: Complete core XML loading * Fix exception naming * Cast enum parsed value to enum type diff -r 129636305ad7 -r 9fba3b4ccdcd api/Factories/Xml/WarFoundryXmlRaceFactory.cs --- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Aug 01 17:55:35 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs Sat Aug 01 19:45:24 2009 +0000 @@ -167,7 +167,7 @@ } catch(FormatException e) { - throw new InvalidFileException("Attribute 'required' of unit equipment item " + id + " for " + type.Name + " was not a valid boolean", ex); + throw new InvalidFileException("Attribute 'required' of unit equipment item " + id + " for " + type.Name + " was not a valid boolean", e); } try @@ -176,7 +176,7 @@ } catch (FormatException e) { - throw new InvalidFileException("Attribute 'minNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", ex); + throw new InvalidFileException("Attribute 'minNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", e); } try @@ -185,7 +185,7 @@ } catch (FormatException e) { - throw new InvalidFileException("Attribute 'maxNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", ex); + throw new InvalidFileException("Attribute 'maxNum' of unit equipment item " + id + " for " + type.Name + " was not a valid integer", e); } try @@ -194,7 +194,7 @@ } catch (FormatException e) { - throw new InvalidFileException("Attribute 'minPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", ex); + throw new InvalidFileException("Attribute 'minPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", e); } try @@ -203,7 +203,7 @@ } catch (FormatException e) { - throw new InvalidFileException("Attribute 'maxPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", ex); + throw new InvalidFileException("Attribute 'maxPercentage' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", e); } try @@ -212,16 +212,16 @@ } catch (FormatException e) { - throw new InvalidFileException("Attribute 'costMultiplier' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", ex); + throw new InvalidFileException("Attribute 'costMultiplier' of unit equipment item " + id + " for " + type.Name + " was not a valid decimal number", e); } try { - unitEquipItem.CostRoundType = Enum.Parse(typeof(RoundType), elem.GetAttribute("costRounding")); + unitEquipItem.CostRoundType = (RoundType) Enum.Parse(typeof(RoundType), elem.GetAttribute("costRounding")); } catch (ArgumentException e) { - throw new InvalidFileException("Attribute 'costRounding' of unit equipment item " + id + " for " + type.Name + " was not a valid rounding type", ex); + throw new InvalidFileException("Attribute 'costRounding' of unit equipment item " + id + " for " + type.Name + " was not a valid rounding type", e); } type.AddEquipmentItem(unitEquipItem);