annotate API/EventListeningWarFoundryLoader.cs @ 139:3e4864e206ea

Re #140: Equality methods * Add equality testing to RequiresNoMoreThanN requirement * Add extra different races for testing more of equality method
author IBBoard <dev@ibboard.co.uk>
date Tue, 26 Apr 2011 19:47:36 +0000
parents 3c2c108a2f08
children 0f144576e5eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 using System;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 using IBBoard.WarFoundry.API.Factories;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 using System.Collections.Generic;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using IBBoard.WarFoundry.API.Objects;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 namespace IBBoard.WarFoundry.API
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 public class EventListeningWarFoundryLoader : AbstractWarFoundryLoader
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 private IDictionary<string, GameSystem> gameSystems;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 private IDictionary<string, Race> races;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 private IDictionary<string, Army> armies;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 public EventListeningWarFoundryLoader()
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 gameSystems = new Dictionary<string, GameSystem>();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 races = new Dictionary<string, Race>();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 armies = new Dictionary<string, Army>();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 public override void RegisterFactory (INativeWarFoundryFactory factory)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 base.RegisterFactory (factory);
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 factory.GameSystemLoaded+= DoStoreGameSystem;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 factory.RaceLoaded+= DoStoreRace;
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27
96
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
28 public override void UnregisterFactory (INativeWarFoundryFactory factory)
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
29 {
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
30 base.UnregisterFactory(factory);
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
31 factory.GameSystemLoaded-= DoStoreGameSystem;
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
32 factory.RaceLoaded-= DoStoreRace;
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
33 }
3c2c108a2f08 Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 90
diff changeset
34
89
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 protected override GameSystem GetExistingSystemForSystem (GameSystem system)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 throw new System.NotImplementedException();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 protected override void DoStoreGameSystem (GameSystem system)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 gameSystems.Add(system.ID, system);
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 protected override void DoStoreRace (Race race)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 {
90
5d19fee8e9dc Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents: 89
diff changeset
49 races.Add(race.GameSystem.ID + race.ID, race);
89
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 public override GameSystem[] GetGameSystems ()
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 throw new System.NotImplementedException();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 public override GameSystem GetGameSystem (string systemID)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 return DictionaryUtils.GetValue(gameSystems, systemID);
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 protected override void RemoveGameSystem (GameSystem system)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 throw new System.NotImplementedException();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 public override Race[] GetRaces (GameSystem system)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73 throw new System.NotImplementedException();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 public override Race GetRace (GameSystem system, string raceID)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 return GetRace(system, raceID, "");
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 public override Race GetRace (GameSystem system, string raceID, string raceSubID)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85 return DictionaryUtils.GetValue(races, raceID);
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 protected override void RemoveRace (Race race)
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 {
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 throw new System.NotImplementedException();
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 }
90dee8d781ee Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 }