changeset 87:9fba3b4ccdcd

Re #50: Complete core XML loading * Fix exception naming * Cast enum parsed value to enum type
author IBBoard <dev@ibboard.co.uk>
date Sat, 01 Aug 2009 19:45:24 +0000
parents 129636305ad7
children 110a7b0bcab5
files api/Factories/Xml/WarFoundryXmlRaceFactory.cs
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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);