diff API/Factories/AbstractNativeWarFoundryFactory.cs @ 482:1ed2f3ab5e35

Re #419: Remove assumptions of a file-based install * Swap API to using new "loadable object" and "loadable object source" wrappers to allow file-based or memory-based loading
author IBBoard <dev@ibboard.co.uk>
date Sat, 07 Jul 2012 21:01:32 +0100
parents cbeee87dc2d3
children
line wrap: on
line diff
--- a/API/Factories/AbstractNativeWarFoundryFactory.cs	Mon Jun 25 21:04:02 2012 +0100
+++ b/API/Factories/AbstractNativeWarFoundryFactory.cs	Sat Jul 07 21:01:32 2012 +0100
@@ -14,6 +14,7 @@
 using IBBoard.WarFoundry.API.Objects;
 using ICSharpCode.SharpZipLib.Zip;
 using IBBoard.Collections;
+using IBBoard.WarFoundry.API.Loading;
 
 namespace IBBoard.WarFoundry.API.Factories
 {
@@ -27,16 +28,17 @@
 			//Do nothing - just make the constructor non-public
 		}
 				
-		protected override ZipFile GetFileAsSupportedType(FileInfo file)
+		protected override ZipFile GetFileAsSupportedType(ILoadableObject file)
 		{
-			ZipFile zip = null;
-			string ext = file.Extension.ToLower();
+			ZipFile zip = null;
+			string name = file.Name;
+			string ext = file.Name.Substring(name.LastIndexOf('.')).ToLower();
 
 			if (ext == ".race" || ext == ".army" || ext == ".system")
 			{
 				try
 				{
-					zip = new ZipFile(file.FullName);
+					zip = new ZipFile(file.GetStream());
 				}
 				catch (ZipException)
 				{