annotate API/WarFoundryHacks.cs @ 481:81f32062c9fa

Re #419: Remove assumptions of a file-based install * Convert schemas to resources and load them from there * Remove use of "data" folder relative to exe location from default "Hacks" (GTK/WinForms GUIs can re-add it locally)
author IBBoard <dev@ibboard.co.uk>
date Mon, 25 Jun 2012 21:04:02 +0100
parents 1a632b133606
children 4d6c92744254
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
435
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (WarFoundryHacks.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // 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.
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using System;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System.IO;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using IBBoard;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.WarFoundry.API.Factories.Requirement;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.WarFoundry.API.Factories.Xml;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.WarFoundry.API.Savers;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using IBBoard.WarFoundry.API.Savers.Xml;
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 namespace IBBoard.WarFoundry.API
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 {
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 /// <summary>
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 /// A collection of hacks and work-arounds to make things work correctly.
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 /// </summary>
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 public class WarFoundryHacks
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 {
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 public static void Initialise()
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 {
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 //Set default data path - should be a preference
481
81f32062c9fa Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents: 477
diff changeset
22 //WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Path.Combine(Constants.ExecutablePath, "data")));
435
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 //Make sure we have at least one loader - should be controlled by plugins
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory());
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 //Make sure we have a way to save files - should be controlled by plugins
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver());
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 //Make sure we have the requirement factories - should be controlled by plugins
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresAtLeastNUnitsRequirementFactory());
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNoMoreThanNOfUnitTypeRequirementFactory());
449
ba6c762cdfc3 * Add missing line to Hacks class to add third factory
IBBoard <dev@ibboard.co.uk>
parents: 435
diff changeset
30 WarFoundryLoader.RegisterRequirementFactory(new UnitRequiresNUnitsForMUnitsRequirementFactory());
435
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 }
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 }
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 }
6345a683fd75 * Add missing hacks file
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34