annotate API/WarFoundryLoader.cs @ 404:5d7584a73d7f xsl-output

XSL with transform operations
author Dan.Kulinski@dank-laptop.Global.Local
date Thu, 18 Aug 2011 11:14:58 -0600
parents 04f4c2fea356
children 1a632b133606
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (WarFoundryLoader.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
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.
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using System;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using ICSharpCode.SharpZipLib.Zip;
379
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
6 using System.Collections.Generic;
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
7 using IBBoard.WarFoundry.API.Factories.Requirement;
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
8 using IBBoard.WarFoundry.API.Objects.Requirement;
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 namespace IBBoard.WarFoundry.API
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 public class WarFoundryLoader
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 private static AbstractWarFoundryLoader loader;
379
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
15 private static Dictionary<string, IRequirementFactory> requirementFactories = new Dictionary<string, IRequirementFactory>();
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
16
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 /// <summary>
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 /// Gets the default <see cref="WarFoundryLoader"/> used to load WarFoundry data files.
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 /// </summary>
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 /// <returns>
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 /// The default <see cref="WarFoundryLoader"/>
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 /// </returns>
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 public static AbstractWarFoundryLoader GetDefault()
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 if (loader == null)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 loader = new DefaultWarFoundryLoader();
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 return loader;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 public static void SetDefault(AbstractWarFoundryLoader newLoader)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 {
379
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
35 loader = newLoader;
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 }
379
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
37
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 private WarFoundryLoader()
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 //Hide constructor
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 }
379
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
42
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
43 public static void RegisterRequirementFactory(IRequirementFactory factory)
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
44 {
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
45 requirementFactories[factory.AppliesToID] = factory;
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
46 }
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
47
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
48 public static IRequirementFactory GetRequirementFactory(string requirementID)
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
49 {
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
50 return DictionaryUtils.GetValue(requirementFactories, requirementID);
04f4c2fea356 Re #351: Add extensible requirement handling method
IBBoard <dev@ibboard.co.uk>
parents: 337
diff changeset
51 }
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 }