annotate api/WarFoundryLoader.cs @ 323:8a64b36d36b8

Re #324: Add saving of Race and System data to files * As per GameSystem changes for using existing code: * Make XML creation method public * Make sure we're encoding in UTF-8 * Implement saving method for Army
author IBBoard <dev@ibboard.co.uk>
date Wed, 09 Mar 2011 20:59:34 +0000
parents a36a0e9cc05d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 102
diff changeset
1 // This file (WarFoundryLoader.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard.
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 102
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.
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using ICSharpCode.SharpZipLib.Zip;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 namespace IBBoard.WarFoundry.API
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 public class WarFoundryLoader
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 {
233
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
12 private static AbstractWarFoundryLoader loader;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 /// <summary>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 /// Gets the default <see cref="WarFoundryLoader"/> used to load WarFoundry data files.
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 /// </summary>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 /// <returns>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 /// The default <see cref="WarFoundryLoader"/>
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 /// </returns>
233
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
20 public static AbstractWarFoundryLoader GetDefault()
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 if (loader == null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 {
233
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
24 loader = new DefaultWarFoundryLoader();
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 return loader;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
233
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
30 public static void SetDefault(AbstractWarFoundryLoader newLoader)
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
31 {
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
32 loader = newLoader;
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
33 }
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34
144
721891008b5c Fixes #22: Add functionality to get failed file loads and reason
IBBoard <dev@ibboard.co.uk>
parents: 141
diff changeset
35 private WarFoundryLoader()
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 {
233
a36a0e9cc05d Re #228: Crash with missing abilityID
IBBoard <dev@ibboard.co.uk>
parents: 226
diff changeset
37 //Hide constructor
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 }