changeset 293:a1657c6f41a0

Re #319: WarFoundry Forge - No Factory set failure * Add a dummy factory for use by the Forge app
author IBBoard <dev@ibboard.co.uk>
date Fri, 17 Dec 2010 20:09:06 +0000
parents 4dcb038e4f55
children 52985d48b263
files IBBoard.WarFoundry.API.csproj api/Factories/DummyWarFoundryFactory.cs
diffstat 2 files changed, 50 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/IBBoard.WarFoundry.API.csproj	Thu Dec 16 23:03:50 2010 +0000
+++ b/IBBoard.WarFoundry.API.csproj	Fri Dec 17 20:09:06 2010 +0000
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -180,6 +180,7 @@
     <Compile Include="api\DefaultWarFoundryLoader.cs" />
     <Compile Include="api\Objects\UnitMemberType.cs" />
     <Compile Include="api\Factories\Xml\WarFoundryXmlLimitParser.cs" />
+    <Compile Include="api\Factories\DummyWarFoundryFactory.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System.Xml" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Factories/DummyWarFoundryFactory.cs	Fri Dec 17 20:09:06 2010 +0000
@@ -0,0 +1,48 @@
+//  This file (DummyWarFoundryFactory.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2010 IBBoard
+// 
+//  The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+
+using IBBoard.WarFoundry.API.Factories;
+using IBBoard.WarFoundry.API.Objects;
+using System.IO;
+using System.Collections.Generic;
+
+namespace IBBoard.WarFoundry.API.Factories
+{
+	///<summary>
+	///A dummy factory for use with <see cref="WarFoundryStagedLoadingObject"/>s that implements the bare minimum of the methods but won't load anything
+	///</summary>
+	public class DummyWarFoundryFactory : IWarFoundryFactory
+	{
+		public void CompleteLoading(IWarFoundryStagedLoadObject obj)
+		{
+			obj.SetAsFullyLoaded();
+		}
+
+		public bool CanHandleFileFormat(FileInfo file)
+		{
+			return false;
+		}
+
+		public bool CanHandleFileAsRace(FileInfo file)
+		{
+			return false;
+		}
+
+		public bool CanHandleFileAsGameSystem(FileInfo file)
+		{
+			return false;
+		}
+
+		public bool CanHandleFileAsArmy(FileInfo file)
+		{
+			return false;
+		}
+
+		public ICollection<IWarFoundryObject> CreateObjectsFromFile(FileInfo file)
+		{
+			return new List<IWarFoundryObject>();
+		}
+	}
+}
+