Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff API/Factories/AbstractNativeWarFoundryFactory.cs @ 463:cbeee87dc2d3
Re #58: Remove LogNotifier from API
* Remove LogNotifier from API - mostly unnecessary logging
Also:
* Formatting auto-corrected
* LoadFile() "try...catch {silently dispose}" removed. Code shouldn't be throwing those errors and needs to be handled elsewhere if it does
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 17 Mar 2012 20:02:32 +0000 |
parents | 86725e88052e |
children | 1ed2f3ab5e35 |
line wrap: on
line diff
--- a/API/Factories/AbstractNativeWarFoundryFactory.cs Tue Mar 06 20:31:31 2012 +0000 +++ b/API/Factories/AbstractNativeWarFoundryFactory.cs Sat Mar 17 20:02:32 2012 +0000 @@ -1,7 +1,6 @@ // This file (AbstractNativeWarFoundryFactory.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard. // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. - using System; using System.IO; using System.Xml; @@ -11,7 +10,6 @@ using IBBoard; using IBBoard.IO; using IBBoard.Lang; -using IBBoard.Logging; using IBBoard.Xml; using IBBoard.WarFoundry.API.Objects; using ICSharpCode.SharpZipLib.Zip; @@ -52,7 +50,7 @@ return zip; } - protected override bool CheckCanHandleFileFormat (ZipFile file) + protected override bool CheckCanHandleFileFormat(ZipFile file) { return CheckCanHandleFileAsGameSystem(file) || CheckCanHandleFileAsRace(file) || CheckCanHandleFileAsArmy(file); } @@ -78,7 +76,7 @@ protected abstract bool CheckCanFindArmyFileContent(ZipFile file); - protected override ICollection<IWarFoundryObject> DoCreateObjectsFromFile (ZipFile file) + protected override ICollection<IWarFoundryObject> DoCreateObjectsFromFile(ZipFile file) { ICollection<IWarFoundryObject> objects = new List<IWarFoundryObject>(); @@ -94,9 +92,9 @@ { try { - CreateSystemObjectsFromZip (file, objects); - CreateRaceObjectsFromZip (file, objects); - CreateArmyObjectsFromZip (file, objects); + CreateSystemObjectsFromZip(file, objects); + CreateRaceObjectsFromZip(file, objects); + CreateArmyObjectsFromZip(file, objects); } finally { @@ -104,7 +102,7 @@ } } - private void CreateSystemObjectsFromZip (ZipFile file, ICollection<IWarFoundryObject> objects) + private void CreateSystemObjectsFromZip(ZipFile file, ICollection<IWarFoundryObject> objects) { if (CheckCanFindSystemFileContent(file)) { @@ -116,11 +114,11 @@ } } - void CreateRaceObjectsFromZip (ZipFile file, ICollection<IWarFoundryObject> objects) + void CreateRaceObjectsFromZip(ZipFile file, ICollection<IWarFoundryObject> objects) { if (CheckCanFindRaceFileContent(file)) { - foreach(Race race in CreateRacesFromFile(file)) + foreach (Race race in CreateRacesFromFile(file)) { OnRaceLoaded(race); objects.Add(race); @@ -128,7 +126,7 @@ } } - void CreateArmyObjectsFromZip (ZipFile file, ICollection<IWarFoundryObject> objects) + void CreateArmyObjectsFromZip(ZipFile file, ICollection<IWarFoundryObject> objects) { if (CheckCanFindArmyFileContent(file)) { @@ -169,6 +167,7 @@ } protected abstract ICollection<ZipEntry> GetArmyZipEntries(ZipFile file); + protected abstract Army CreateArmyFromStream(ZipFile file, Stream dataStream); protected ICollection<Race> CreateRacesFromFile(ZipFile file) @@ -193,6 +192,7 @@ } protected abstract ICollection<ZipEntry> GetRaceZipEntries(ZipFile file); + protected abstract Race CreateRaceFromStream(ZipFile file, Stream dataStream); protected ICollection<GameSystem> CreateGameSystemsFromFile(ZipFile file) @@ -217,9 +217,10 @@ } protected abstract ICollection<ZipEntry> GetGameSystemZipEntries(ZipFile file); + protected abstract GameSystem CreateGameSystemFromStream(ZipFile file, Stream dataStream); - public override bool Equals (object o) + public override bool Equals(object o) { if (o == this) { @@ -233,7 +234,7 @@ return true; } - public override int GetHashCode () + public override int GetHashCode() { return GetType().FullName.GetHashCode(); }