Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/EventListeningWarFoundryLoader.cs @ 175:0f144576e5eb
Code tidy-up - remove warnings
* Remove unused variable
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Sep 2011 20:53:47 +0100 |
parents | 3c2c108a2f08 |
children |
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 |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 public EventListeningWarFoundryLoader() |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 gameSystems = new Dictionary<string, GameSystem>(); |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 races = new Dictionary<string, Race>(); |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 } |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 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
|
20 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 base.RegisterFactory (factory); |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 factory.GameSystemLoaded+= DoStoreGameSystem; |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 factory.RaceLoaded+= DoStoreRace; |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 } |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
26 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
|
27 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
28 base.UnregisterFactory(factory); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
29 factory.GameSystemLoaded-= DoStoreGameSystem; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
30 factory.RaceLoaded-= DoStoreRace; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
31 } |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
32 |
89
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 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
|
34 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 throw new System.NotImplementedException(); |
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 |
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 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
|
40 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 gameSystems.Add(system.ID, 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 |
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 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
|
46 { |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
47 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
|
48 } |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 |
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 public override GameSystem[] GetGameSystems () |
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 throw new System.NotImplementedException(); |
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 |
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 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
|
58 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 return DictionaryUtils.GetValue(gameSystems, 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 |
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 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
|
64 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
65 throw new System.NotImplementedException(); |
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 |
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 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
|
70 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
71 throw new System.NotImplementedException(); |
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 |
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 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
|
76 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
77 return GetRace(system, 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 |
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 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
|
82 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 return DictionaryUtils.GetValue(races, raceID); |
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 |
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 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
|
88 { |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 throw new System.NotImplementedException(); |
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 } |
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
92 } |