Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
diff API/Factories/Xml/SingleXmlObjectLoader.cs @ 52:97ea355f9564
Re #270: Add multiple categories to API
* Add tests for army loading to make sure that units go back in same category
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 19 May 2010 20:05:52 +0000 |
parents | 82cd08385bfe |
children | b2517bb113d0 |
line wrap: on
line diff
--- a/API/Factories/Xml/SingleXmlObjectLoader.cs Wed May 19 19:22:20 2010 +0000 +++ b/API/Factories/Xml/SingleXmlObjectLoader.cs Wed May 19 20:05:52 2010 +0000 @@ -21,20 +21,25 @@ try { - return factory.GetRaceFactory().CreateRaceFromElement(null, CreateDocumentElementFromStream (stream)); + return factory.GetRaceFactory().CreateRaceFromElement(null, CreateDocumentElementFromStream(stream)); } - finally + finally { - if (stream !=null) + if (stream != null) { stream.Close(); } } } - private static XmlElement CreateDocumentElementFromStream (Stream stream) + public static XmlElement CreateDocumentElementFromFile(FileInfo file) { - return WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream (stream).DocumentElement; + return CreateDocumentElementFromStream(file.OpenRead()); + } + + private static XmlElement CreateDocumentElementFromStream(Stream stream) + { + return WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(stream).DocumentElement; } public static GameSystem LoadGameSystemFromXML(WarFoundryXmlFactory factory, FileInfo file)