# HG changeset patch # User IBBoard # Date 1253559530 0 # Node ID 721891008b5ca0658b1396fc5756705569f796ce # Parent 7f13ffcb876583f948d4c41efa5158f14b301eeb Fixes #22: Add functionality to get failed file loads and reason * Add event for file load start and end - end event has list of failures as parameter diff -r 7f13ffcb8765 -r 721891008b5c api/WarFoundryLoader.cs --- a/api/WarFoundryLoader.cs Sat Sep 19 19:42:53 2009 +0000 +++ b/api/WarFoundryLoader.cs Mon Sep 21 18:58:50 2009 +0000 @@ -40,8 +40,11 @@ private Dictionary systemsTable; private Dictionary>> racesTable; //Keys are: System, Race, SubRace private Dictionary> loadedObjects; + public delegate void FileLoadingCompleteDelegate(List failures); + public event MethodInvoker FileLoadingStarted; + public event FileLoadingCompleteDelegate FileLoadingFinished; - protected WarFoundryLoader() + private WarFoundryLoader() { directories = new List(); factories = new List(); @@ -148,12 +151,18 @@ List failedLoads = FillLoadableFiles(loadableRaces, loadableGameSystems); failedLoads.AddRange(LoadGameSystems(loadableGameSystems)); failedLoads.AddRange(LoadRaces(loadableRaces)); - - LogNotifier.Debug(GetType(), failedLoads.Count + " failed file loads"); - + OnFileLoadingFinished(failedLoads); return failedLoads; } + private void OnFileLoadingFinished(List failures) + { + if (FileLoadingFinished!=null) + { + FileLoadingFinished(failures); + } + } + protected void PrepareForFileLoad() { //Just set up blank dictionaries for now - may try different and more complex handling in future