diff api/Factories/Xml/WarFoundryXmlArmyParser.cs @ 238:d1068f4b6d1c

Fixes #141: Check IDs of units on loading army * IDs were already checked - now exceptions instead of ignoring (exception is already caught for other reasons) Also: * Code cleanup of main XML file factory
author IBBoard <dev@ibboard.co.uk>
date Sun, 21 Feb 2010 20:25:52 +0000
parents df61d26c23fb
children 35dc06030355
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Sun Feb 21 20:13:44 2010 +0000
+++ b/api/Factories/Xml/WarFoundryXmlArmyParser.cs	Sun Feb 21 20:25:52 2010 +0000
@@ -5,6 +5,7 @@
 using System;
 using System.Collections.Generic;
 using System.Xml;
+using IBBoard.IO;
 using IBBoard.Xml;
 using ICSharpCode.SharpZipLib.Zip;
 using IBBoard.WarFoundry.API.Objects;
@@ -85,6 +86,10 @@
 
 					LoadUnitEquipment(unitElem, unit);
 				}
+				else
+				{
+					throw new InvalidFileException("Duplicate unit ID found in army file: "+id);
+				}
 			}
 		}