Mercurial > repos > snowblizz-super-API-ideas
comparison api/Factories/Xml/WarFoundryXmlFactory.cs @ 238:d1068f4b6d1c
Fixes #141: Check IDs of units on loading army
* IDs were already checked - now exceptions instead of ignoring (exception is already caught for other reasons)
Also:
* Code cleanup of main XML file factory
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 21 Feb 2010 20:25:52 +0000 |
parents | 06b4beb3e156 |
children | b9b8b0e60c31 |
comparison
equal
deleted
inserted
replaced
237:ec7fe85116cf | 238:d1068f4b6d1c |
---|---|
133 | 133 |
134 public override void CompleteLoading(IWarFoundryStagedLoadObject obj) | 134 public override void CompleteLoading(IWarFoundryStagedLoadObject obj) |
135 { | 135 { |
136 LogNotifier.DebugFormat(GetType(), "Complete loading of {0} with ID {1}", obj.GetType().Name, obj.ID); | 136 LogNotifier.DebugFormat(GetType(), "Complete loading of {0} with ID {1}", obj.GetType().Name, obj.ID); |
137 | 137 |
138 if (obj is GameSystem) | 138 if (obj is GameSystem) |
139 { | 139 { |
140 CompleteLoadingGameSystem((GameSystem) obj); | 140 CompleteLoadingGameSystem((GameSystem) obj); |
141 } | 141 } |
142 else if (obj is Race) | 142 else if (obj is Race) |
143 { | 143 { |
144 CompleteLoadingRace((Race) obj); | 144 CompleteLoadingRace((Race) obj); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 private void CompleteLoadingRace(Race race) | 148 private void CompleteLoadingRace(Race race) |
149 { | 149 { |
150 try | 150 try |
160 | 160 |
161 private void CompleteLoadingGameSystem(GameSystem system) | 161 private void CompleteLoadingGameSystem(GameSystem system) |
162 { | 162 { |
163 try | 163 try |
164 { | 164 { |
165 gameSystemFactory.CompleteLoading(system); | 165 gameSystemFactory.CompleteLoading(system); |
166 | 166 } |
167 } | 167 catch (InvalidFileException ex) |
168 catch (InvalidFileException ex) | 168 { |
169 { | 169 WarFoundryLoader.GetDefault().RemoveGameSystem(system); |
170 WarFoundryLoader.GetDefault().RemoveGameSystem(system); | 170 throw; |
171 throw; | 171 } |
172 } | |
173 } | 172 } |
174 } | 173 } |
175 } | 174 } |