Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs @ 14:0770e5cbba7c
Closes #21 - File loading in order
* Reworked LoadFiles to smaller methods for readability (also re #10) and structure
* Now determine expected load return before loading then load all "expected GameSystem" before "expected Race"
* Make "can load as race/game system/army" methods public in interface
Re #22 - Get errored file loading
* Created FileLoadFailure class and made LoadFiles return a list of them
Also
* Some code cleanup
* Change to DictionaryUtils calls
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Jan 2009 14:03:20 +0000 |
parents | 520818033bb6 |
children | 306558904c2a |
line wrap: on
line diff
--- a/api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs Thu Jan 22 20:26:08 2009 +0000 +++ b/api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs Sun Jan 25 14:03:20 2009 +0000 @@ -33,20 +33,20 @@ protected override bool CheckCanHandleFileFormat (FileInfo file) { - return IsArmyFile(file) || IsRaceFile(file) || IsSystemFile(file); + return CheckCanHandleFileAsArmy(file) || CheckCanHandleFileAsRace(file) || CheckCanHandleFileAsGameSystem(file); } - protected bool IsArmyFile(FileInfo file) + protected override bool CheckCanHandleFileAsArmy(FileInfo file) { return ArmyFileExtension!=null && file.Name.ToLower().EndsWith(ArmyFileExtension); } - protected bool IsRaceFile(FileInfo file) + protected override bool CheckCanHandleFileAsRace(FileInfo file) { return RaceFileExtension!=null && file.Name.ToLower().EndsWith(RaceFileExtension); } - protected bool IsSystemFile(FileInfo file) + protected override bool CheckCanHandleFileAsGameSystem(FileInfo file) { return GameSystemFileExtension!=null && file.Name.ToLower().EndsWith(GameSystemFileExtension); } @@ -54,8 +54,7 @@ protected override FileInfo GetFileAsSupportedType (FileInfo file) { return file; - } - + } protected abstract Army CreateArmyFromFile(FileInfo file); protected abstract Race CreateRaceFromFile(FileInfo file);