diff API/Factories/AbstractWarFoundryFactory.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 3c4a6403a88c
children
line wrap: on
line diff
--- a/API/Factories/AbstractWarFoundryFactory.cs	Mon Jun 25 21:04:02 2012 +0100
+++ b/API/Factories/AbstractWarFoundryFactory.cs	Sat Jul 07 21:01:32 2012 +0100
@@ -6,6 +6,7 @@
 using System.IO;
 using System.Collections.Generic;
 using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Loading;
 
 namespace IBBoard.WarFoundry.API.Factories
 {
@@ -23,7 +24,7 @@
 			obj.SetAsFullyLoaded();
 		}
 
-		public bool CanHandleFileFormat (FileInfo file)
+		public bool CanHandleFileFormat(ILoadableObject file)
 		{
 			FILE_TYPE typedFile = GetFileAsSupportedType(file);
 			bool canHandle = typedFile != null && CheckCanHandleFileFormat(typedFile);
@@ -36,7 +37,7 @@
 			return canHandle;
 		}
 
-		public bool CanHandleFileAsRace(FileInfo file)
+		public bool CanHandleFileAsRace(ILoadableObject file)
 		{
 			FILE_TYPE typedFile = GetFileAsSupportedType(file);
 			bool canHandle = typedFile != null && CheckCanHandleFileAsRace(typedFile);
@@ -49,7 +50,7 @@
 			return canHandle;
 		}
 
-		public bool CanHandleFileAsGameSystem(FileInfo file)
+		public bool CanHandleFileAsGameSystem(ILoadableObject file)
 		{
 			FILE_TYPE typedFile = GetFileAsSupportedType(file);
 			bool canHandle = typedFile != null && CheckCanHandleFileAsGameSystem(typedFile);
@@ -62,7 +63,7 @@
 			return canHandle;
 		}
 
-		public bool CanHandleFileAsArmy(FileInfo file)
+		public bool CanHandleFileAsArmy(ILoadableObject file)
 		{
 			FILE_TYPE typedFile = GetFileAsSupportedType(file);
 			bool canHandle = typedFile != null && CheckCanHandleFileAsArmy(typedFile);
@@ -81,16 +82,16 @@
 		}
 		
 		/// <summary>
-		/// Converts the <see cref="FileInfo"/> object in to the appropriate type for this class so that it can perform its checks. If no conversion is required (the test can be performed on a <see cref="FileInfo"/> object) the object should be returned with no modification. 
+		/// Converts the <see cref="ILoadableObject"/> object in to the appropriate type for this class so that it can perform its checks. If no conversion is required (the test can be performed on a <see cref="ILoadableObject"/> object) the object should be returned with no modification. 
 		/// If the file is not of supported type the <code>null</code> should be returned.
 		/// </summary>
 		/// <param name="file">
-		/// A <see cref="FileInfo"/> to get the supported source object from.
+		/// A <see cref="ILoadableObject"/> to get the supported source object from.
 		/// </param>
 		/// <returns>
-		/// An object of type <see cref="FILE_TYPE"/> that has been converted from the input <see cref="FileInfo"/> object, or <code>null</code> if the conversion cannot be made.
+		/// An object of type <see cref="FILE_TYPE"/> that has been converted from the input <see cref="ILoadableObject"/> object, or <code>null</code> if the conversion cannot be made.
 		/// </returns>
-		protected abstract FILE_TYPE GetFileAsSupportedType(FileInfo file);
+		protected abstract FILE_TYPE GetFileAsSupportedType(ILoadableObject file);
 		
 		/// <summary>
 		/// Checks whether the factory thinks it can load data from the file in its paramaterised type.
@@ -137,7 +138,7 @@
 		protected abstract bool CheckCanHandleFileAsArmy(FILE_TYPE file);
 		
 		
-		public ICollection<IWarFoundryObject> CreateObjectsFromFile(FileInfo file)
+		public ICollection<IWarFoundryObject> CreateObjectsFromFile(ILoadableObject file)
 		{
 			return DoCreateObjectsFromFile(GetFileAsSupportedType(file));
 		}