diff api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs @ 18:3c228f093a71

Re #16 - Complete Rollcall file loading * Add default implementation to "do create" method in non-native factory Also commit csproj changes and removal of old mdp file
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Feb 2009 14:23:53 +0000
parents 306558904c2a
children b7c93a5821cd
line wrap: on
line diff
--- a/api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs	Mon Jan 26 20:29:37 2009 +0000
+++ b/api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs	Sat Feb 21 14:23:53 2009 +0000
@@ -43,5 +43,25 @@
 		protected abstract Army CreateArmyFromFile(FileInfo file);
 		protected abstract Race CreateRaceFromFile(FileInfo file);
 		protected abstract GameSystem CreateGameSystemFromFile(FileInfo file);
+		
+		protected override ICollection<IWarFoundryObject> DoCreateObjectsFromFile (FileInfo file)
+		{
+			ICollection<IWarFoundryObject> objects = new List<IWarFoundryObject>();
+			
+			if (CheckCanHandleFileAsRace(file))
+			{
+				objects.Add(CreateRaceFromFile(file));
+			}
+			else if (CheckCanHandleFileAsGameSystem(file))
+			{
+				objects.Add(CreateGameSystemFromFile(file));
+			}
+			else if (CheckCanHandleFileAsArmy(file))
+			{
+				objects.Add(CreateArmyFromFile(file));
+			}
+			
+			return objects;
+		}
 	}
 }