view API/Factories/DummyWarFoundryFactory.cs @ 483:4d6c92744254

Re #419: Remove assumptions of a file-based install * Embed sample files as resources * Load the sample files as a "hack"
author IBBoard <dev@ibboard.co.uk>
date Wed, 11 Jul 2012 20:39:34 +0100
parents 1ed2f3ab5e35
children
line wrap: on
line source

//  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;
using IBBoard.WarFoundry.API.Loading;

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 event SingleArgMethodInvoker<GameSystem> GameSystemLoaded;

		public event SingleArgMethodInvoker<Race> RaceLoaded;

		public event SingleArgMethodInvoker<Army> ArmyLoaded;

		public DummyWarFoundryFactory()
		{
			if (GameSystemLoaded != null && RaceLoaded != null && ArmyLoaded != null)
			{
				//Do nothing special - we're hiding "unused code" warnings for events our interface requires
			}
		}

		public void CompleteLoading(IWarFoundryStagedLoadObject obj)
		{
			obj.SetAsFullyLoaded();
		}

		public bool CanHandleFileFormat(ILoadableObject file)
		{
			return false;
		}

		public bool CanHandleFileAsRace(ILoadableObject file)
		{
			return false;
		}

		public bool CanHandleFileAsGameSystem(ILoadableObject file)
		{
			return false;
		}

		public bool CanHandleFileAsArmy(ILoadableObject file)
		{
			return false;
		}

		public ICollection<IWarFoundryObject> CreateObjectsFromFile(ILoadableObject file)
		{
			return new List<IWarFoundryObject>();
		}
	}
}