comparison 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
comparison
equal deleted inserted replaced
51:9d68b5dd70b3 52:97ea355f9564
19 { 19 {
20 Stream stream = file.OpenRead(); 20 Stream stream = file.OpenRead();
21 21
22 try 22 try
23 { 23 {
24 return factory.GetRaceFactory().CreateRaceFromElement(null, CreateDocumentElementFromStream (stream)); 24 return factory.GetRaceFactory().CreateRaceFromElement(null, CreateDocumentElementFromStream(stream));
25 } 25 }
26 finally 26 finally
27 { 27 {
28 if (stream !=null) 28 if (stream != null)
29 { 29 {
30 stream.Close(); 30 stream.Close();
31 } 31 }
32 } 32 }
33 } 33 }
34 34
35 private static XmlElement CreateDocumentElementFromStream (Stream stream) 35 public static XmlElement CreateDocumentElementFromFile(FileInfo file)
36 { 36 {
37 return WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream (stream).DocumentElement; 37 return CreateDocumentElementFromStream(file.OpenRead());
38 }
39
40 private static XmlElement CreateDocumentElementFromStream(Stream stream)
41 {
42 return WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(stream).DocumentElement;
38 } 43 }
39 44
40 public static GameSystem LoadGameSystemFromXML(WarFoundryXmlFactory factory, FileInfo file) 45 public static GameSystem LoadGameSystemFromXML(WarFoundryXmlFactory factory, FileInfo file)
41 { 46 {
42 Stream stream = file.OpenRead(); 47 Stream stream = file.OpenRead();