diff api/Factories/Xml/WarFoundryXmlFactory.cs @ 199:70ba3bee0c2e

Fixes #207: WarFoundry still keeps file handles on failure * Move close of zip file into a "finally" block * Remove unnecessary extra Close()
author IBBoard <dev@ibboard.co.uk>
date Mon, 02 Nov 2009 20:58:01 +0000
parents 1d13820b3d96
children c931684f9024
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlFactory.cs	Sat Oct 31 20:55:19 2009 +0000
+++ b/api/Factories/Xml/WarFoundryXmlFactory.cs	Mon Nov 02 20:58:01 2009 +0000
@@ -76,7 +76,7 @@
 		private XmlElement GetRootElementFromStream(Stream stream, WarFoundryXmlElementName elementName)
 		{
 			XmlDocument doc = WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(stream);
-			stream.Close();
+
 			XmlElement elem = (XmlElement)doc.LastChild;
 			
 			if (!elem.LocalName.Equals(elementName.Value))
@@ -108,12 +108,12 @@
 		{
 			XmlElement elem = GetRootElementFromStream(dataStream, WarFoundryXmlElementName.RACE_ELEMENT);
 			LogNotifier.Debug(GetType(), "Create Race");
-			return raceFactory.CreateRaceFromElement(file, elem);
-		}
-
-		protected override void CleanUpFileAsSupportedType(ZipFile typedFile)
-		{
-			typedFile.Close();
+			return raceFactory.CreateRaceFromElement(file, elem);
+		}
+
+		protected override void CleanUpFileAsSupportedType(ZipFile typedFile)
+		{
+			typedFile.Close();
 		}
 
 		public override void CompleteLoading(IWarFoundryStagedLoadObject obj)