comparison api/WarFoundryLoader.cs @ 27:e7de5c96f5c2

Re #44 - Fix API tests * Make AbstractNative factory silently dispose of IOExceptions - test data triggers one on the SharpZipLib DLL * Remove unused MakeZipFile method * Rename GetGameSystemLoadingFactoryForFile to remove reference to Race
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2009 17:10:26 +0000
parents f9846f896df3
children 92cf25b0493b
comparison
equal deleted inserted replaced
26:67db7f97b4ab 27:e7de5c96f5c2
186 List<FileLoadFailure> fails = new List<FileLoadFailure>(); 186 List<FileLoadFailure> fails = new List<FileLoadFailure>();
187 LogNotifier.Debug(GetType(), "Load from "+directory.FullName); 187 LogNotifier.Debug(GetType(), "Load from "+directory.FullName);
188 188
189 foreach (FileInfo file in directory.GetFiles()) 189 foreach (FileInfo file in directory.GetFiles())
190 { 190 {
191 IWarFoundryFactory factory = GetGameSystemRaceLoadingFactoryForFile(file); 191 IWarFoundryFactory factory = GetGameSystemLoadingFactoryForFile(file);
192 192
193 if (factory != null) 193 if (factory != null)
194 { 194 {
195 loadableGameSystems.Add(file, factory); 195 loadableGameSystems.Add(file, factory);
196 } 196 }
210 } 210 }
211 211
212 return fails; 212 return fails;
213 } 213 }
214 214
215 private IWarFoundryFactory GetGameSystemRaceLoadingFactoryForFile(FileInfo file) 215 private IWarFoundryFactory GetGameSystemLoadingFactoryForFile(FileInfo file)
216 { 216 {
217 IWarFoundryFactory loadingFactory = null; 217 IWarFoundryFactory loadingFactory = null;
218 218
219 foreach (INonNativeWarFoundryFactory factory in nonNativeFactories) 219 foreach (INonNativeWarFoundryFactory factory in nonNativeFactories)
220 { 220 {
475 StoreRace((Race)loadedObject); 475 StoreRace((Race)loadedObject);
476 } 476 }
477 } 477 }
478 } 478 }
479 479
480 protected virtual ZipFile MakeZipFile(FileInfo file)
481 {
482 return new ZipFile(file.FullName);
483 }
484
485 protected void StoreGameSystem(GameSystem system) 480 protected void StoreGameSystem(GameSystem system)
486 { 481 {
487 string sysid = system.ID.ToLower(); 482 string sysid = system.ID.ToLower();
488 483
489 if (systemsTable.ContainsKey(sysid)) 484 if (systemsTable.ContainsKey(sysid))