# HG changeset patch # User IBBoard # Date 1322509346 0 # Node ID 6345a683fd75b4d640aeb4b117ef8444517c6402 # Parent c32bb2a53b873704e34a7ba642527b4dd65fe0aa * Add missing hacks file diff -r c32bb2a53b87 -r 6345a683fd75 API/WarFoundryHacks.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/API/WarFoundryHacks.cs Mon Nov 28 19:42:26 2011 +0000 @@ -0,0 +1,33 @@ +// This file (WarFoundryHacks.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 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 System; +using System.IO; +using IBBoard; +using IBBoard.WarFoundry.API.Factories.Requirement; +using IBBoard.WarFoundry.API.Factories.Xml; +using IBBoard.WarFoundry.API.Savers; +using IBBoard.WarFoundry.API.Savers.Xml; + +namespace IBBoard.WarFoundry.API +{ + /// + /// A collection of hacks and work-arounds to make things work correctly. + /// + public class WarFoundryHacks + { + public static void Initialise() + { + //Set default data path - should be a preference + WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Path.Combine(Constants.ExecutablePath, "data"))); + //Make sure we have at least one loader - should be controlled by plugins + WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); + //Make sure we have a way to save files - should be controlled by plugins + WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver()); + //Make sure we have the requirement factories - should be controlled by plugins + WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresAtLeastNUnitsRequirementFactory()); + WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNoMoreThanNOfUnitTypeRequirementFactory()); + } + } +} +