annotate API/Factories/Mock/FileSearchingWarFoundryFactory.cs @ 212:325943cb1db0

Re #379: Fix validation of requirements to check for unit * Create common base class for requirement testing with helper methods * Rework unit adding tests in UnitRequiresNoMoreThanNOfUnitTypeRequirementTest to new structure
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Feb 2012 15:20:48 +0000
parents 498396c77601
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (FileSearchingWarFoundryFactory.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // 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.
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using System;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System.Collections.Generic;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using ICSharpCode.SharpZipLib.Zip;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.WarFoundry.API.Factories.Xml;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using System.IO;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.WarFoundry.API.Objects;
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 namespace IBBoard.WarFoundry.API.Factories.Mock
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 public class FileSearchingWarFoundryFactory : WarFoundryXmlFactory
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 public FileSearchingWarFoundryFactory()
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 //Do nothing special
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 public ICollection<ZipEntry> GetGameSystemZipEntries(FileInfo file)
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 ZipFile zip = new ZipFile(file.FullName);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 return GetGameSystemZipEntries(zip);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 public ICollection<ZipEntry> GetRaceZipEntries(FileInfo file)
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 ZipFile zip = new ZipFile(file.FullName);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 return GetRaceZipEntries(zip);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 public ICollection<ZipEntry> GetArmyZipEntries(FileInfo file)
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 {
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 ZipFile zip = new ZipFile(file.FullName);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 return GetArmyZipEntries(zip);
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 }
498396c77601 Re #380: WarFoundry chokes on zips written by Mac OS X
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39