Mercurial > repos > snowblizz-super-API-ideas
changeset 321:2ba88d5fb881
Re #324: Add saving of Race and System data to files
* Construct correct names for entries
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 05 Mar 2011 20:08:41 +0000 |
parents | 4be289645c4f |
children | 3e9b0603afad |
files | api/Savers/Xml/WarFoundryXmlFileSaver.cs |
diffstat | 1 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Savers/Xml/WarFoundryXmlFileSaver.cs Sat Mar 05 15:51:24 2011 +0000 +++ b/api/Savers/Xml/WarFoundryXmlFileSaver.cs Sat Mar 05 20:08:41 2011 +0000 @@ -30,13 +30,33 @@ public void AddFile(ZipOutputStream zipStream, WarFoundryLoadedObject obj) { - ZipEntry entry = new ZipEntry(obj.ID); + ZipEntry entry = new ZipEntry(GetZipEntryName(obj)); zipStream.PutNextEntry(entry); } + + private string GetZipEntryName(WarFoundryLoadedObject obj) + { + return obj.ID + GetFileExtension(obj); + } public string GetFileExtension (WarFoundryLoadedObject obj) { - return ""; + string ext = ""; + + if (obj is Army) + { + ext = ".armyx"; + } + else if (obj is Race) + { + ext = ".racex"; + } + else if (obj is GameSystem) + { + ext = ".systemx"; + } + + return ext; } } }