# HG changeset patch # User IBBoard # Date 1266699433 0 # Node ID ca2905c9b2256ac9facf014bf7c575726075b0ff # Parent 0ebb1b80a2bd8f0035232730ca099177e0af2c0a Fixes #252: Remove need for text in zip file comments * Made checks work on just content rather than zip comment to determine what file type it is * Remove public static strings with comment strings in them diff -r 0ebb1b80a2bd -r ca2905c9b225 api/Factories/AbstractNativeWarFoundryFactory.cs --- a/api/Factories/AbstractNativeWarFoundryFactory.cs Sat Jan 30 17:21:15 2010 +0000 +++ b/api/Factories/AbstractNativeWarFoundryFactory.cs Sat Feb 20 20:57:13 2010 +0000 @@ -22,11 +22,7 @@ /// Base abstract class for all factories that load native WarFoundry data. /// public abstract class AbstractNativeWarFoundryFactory : AbstractWarFoundryFactory, INativeWarFoundryFactory - { - public static readonly string SYSTEM_ZIP_IDENTIFIER = "WarFoundry_System"; - public static readonly string RACE_ZIP_IDENTIFIER = "WarFoundry_Race"; - public static readonly string ARMY_ZIP_IDENTIFIER = "WarFoundry_Army"; - + { protected AbstractNativeWarFoundryFactory() { //Do nothing - just make the constructor non-public @@ -59,21 +55,21 @@ protected override bool CheckCanHandleFileAsGameSystem(ZipFile file) { - return file.ZipFileComment.StartsWith(SYSTEM_ZIP_IDENTIFIER) && CheckCanFindSystemFileContent(file); + return CheckCanFindSystemFileContent(file); } protected abstract bool CheckCanFindSystemFileContent(ZipFile file); protected override bool CheckCanHandleFileAsRace(ZipFile file) { - return file.ZipFileComment.StartsWith(RACE_ZIP_IDENTIFIER) && CheckCanFindRaceFileContent(file); + return CheckCanFindRaceFileContent(file); } protected abstract bool CheckCanFindRaceFileContent(ZipFile file); protected override bool CheckCanHandleFileAsArmy(ZipFile file) { - return file.ZipFileComment.StartsWith(ARMY_ZIP_IDENTIFIER) && CheckCanFindArmyFileContent(file); + return CheckCanFindArmyFileContent(file); } protected abstract bool CheckCanFindArmyFileContent(ZipFile file); @@ -81,20 +77,19 @@ protected override ICollection DoCreateObjectsFromFile (ZipFile file) { ICollection objects = null; - string comment = file.ZipFileComment; IWarFoundryObject obj = null; try { - if (comment.StartsWith(SYSTEM_ZIP_IDENTIFIER)) + if (CheckCanFindSystemFileContent(file)) { obj = CreateGameSystemFromFile(file); } - else if (comment.StartsWith(RACE_ZIP_IDENTIFIER)) + else if (CheckCanFindRaceFileContent(file)) { obj = CreateRaceFromFile(file); } - else if (comment.StartsWith(ARMY_ZIP_IDENTIFIER)) + else if (CheckCanFindArmyFileContent(file)) { obj = CreateArmyFromFile(file); } diff -r 0ebb1b80a2bd -r ca2905c9b225 api/Factories/Xml/WarFoundryXmlSaver.cs --- a/api/Factories/Xml/WarFoundryXmlSaver.cs Sat Jan 30 17:21:15 2010 +0000 +++ b/api/Factories/Xml/WarFoundryXmlSaver.cs Sat Feb 20 20:57:13 2010 +0000 @@ -36,7 +36,6 @@ file = ZipFile.Create(savePath); file.BeginUpdate(); file.Add(new StringZipEntrySource(CreateXmlString(toSave)), "data.armyx"); - file.SetComment(AbstractNativeWarFoundryFactory.ARMY_ZIP_IDENTIFIER); file.CommitUpdate(); success = true; }