Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs @ 15:306558904c2a
Re #1 - LGPL license all code
* Add LGPL header to all files
* Add COPYING.LGPL and COPYING.GPL with content of license
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Jan 2009 14:50:36 +0000 |
parents | 0770e5cbba7c |
children | 3c228f093a71 |
rev | line source |
---|---|
15 | 1 // This file (AbstractNonNativeFileExtensionWarFoundryFactory.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard. |
0 | 2 // |
15 | 3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
0 | 4 |
5 using System; | |
6 using System.Collections.Generic; | |
7 using System.IO; | |
8 using IBBoard.WarFoundry.API.Objects; | |
9 | |
10 namespace IBBoard.WarFoundry.API.Factories | |
11 { | |
12 public abstract class AbstractNonNativeFileExtensionWarFoundryFactory : AbstractNonNativeWarFoundryFactory<FileInfo> | |
13 { | |
14 protected abstract string ArmyFileExtension { get; } | |
15 protected abstract string RaceFileExtension { get; } | |
16 protected abstract string GameSystemFileExtension { get; } | |
17 | |
18 protected override bool CheckCanHandleFileFormat (FileInfo file) | |
19 { | |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
20 return CheckCanHandleFileAsArmy(file) || CheckCanHandleFileAsRace(file) || CheckCanHandleFileAsGameSystem(file); |
0 | 21 } |
22 | |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
23 protected override bool CheckCanHandleFileAsArmy(FileInfo file) |
0 | 24 { |
25 return ArmyFileExtension!=null && file.Name.ToLower().EndsWith(ArmyFileExtension); | |
26 } | |
27 | |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
28 protected override bool CheckCanHandleFileAsRace(FileInfo file) |
0 | 29 { |
30 return RaceFileExtension!=null && file.Name.ToLower().EndsWith(RaceFileExtension); | |
31 } | |
32 | |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
33 protected override bool CheckCanHandleFileAsGameSystem(FileInfo file) |
0 | 34 { |
35 return GameSystemFileExtension!=null && file.Name.ToLower().EndsWith(GameSystemFileExtension); | |
36 } | |
37 | |
38 protected override FileInfo GetFileAsSupportedType (FileInfo file) | |
39 { | |
40 return file; | |
14
0770e5cbba7c
Closes #21 - File loading in order
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
41 } |
0 | 42 |
43 protected abstract Army CreateArmyFromFile(FileInfo file); | |
44 protected abstract Race CreateRaceFromFile(FileInfo file); | |
45 protected abstract GameSystem CreateGameSystemFromFile(FileInfo file); | |
46 } | |
47 } |