changeset 130:e147a1e9399b

Re #68: Add "export army list" function * Add initial interface for exporting * Add stub implementation for exporting HTML (does nothing so far)
author IBBoard <dev@ibboard.co.uk>
date Fri, 28 Aug 2009 19:57:10 +0000
parents 52cacdbcb001
children 5145b7c61ae0
files IBBoard.WarFoundry.API.csproj api/Exporters/IWarFoundryExporter.cs api/Exporters/WarFoundryHtmlExporter.cs
diffstat 3 files changed, 67 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.API.csproj	Wed Aug 26 19:00:50 2009 +0000
     1.2 +++ b/IBBoard.WarFoundry.API.csproj	Fri Aug 28 19:57:10 2009 +0000
     1.3 @@ -135,6 +135,8 @@
     1.4      <Compile Include="api\Factories\Xml\Zip\StringZipEntrySource.cs" />
     1.5      <Compile Include="api\Factories\RequiredDataMissingException.cs" />
     1.6      <Compile Include="api\Factories\Xml\WarFoundryXmlArmyParser.cs" />
     1.7 +    <Compile Include="api\Exporters\IWarFoundryExporter.cs" />
     1.8 +    <Compile Include="api\Exporters\WarFoundryHtmlExporter.cs" />
     1.9    </ItemGroup>
    1.10    <ItemGroup>
    1.11      <Content Include="libs\ICSharpCode.SharpZipLib.dll" />
    1.12 @@ -154,4 +156,7 @@
    1.13        <HintPath>libs\ICSharpCode.SharpZipLib.dll</HintPath>
    1.14      </Reference>
    1.15    </ItemGroup>
    1.16 +  <ItemGroup>
    1.17 +    <Folder Include="api\Exporters\" />
    1.18 +  </ItemGroup>
    1.19  </Project>
    1.20 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/api/Exporters/IWarFoundryExporter.cs	Fri Aug 28 19:57:10 2009 +0000
     2.3 @@ -0,0 +1,26 @@
     2.4 +// This file (IWarFoundryExporter.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard
     2.5 +// 
     2.6 +// 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.
     2.7 +
     2.8 +using System;
     2.9 +using IBBoard.WarFoundry.API.Objects;
    2.10 +
    2.11 +namespace IBBoard.WarFoundry.API.Exporters
    2.12 +{
    2.13 +	/// <summary>
    2.14 +	/// An interface to be implemented by classes that export WarFoundry armies to other formats than "saved armies" (e.g. HTML)
    2.15 +	/// </summary>
    2.16 +	public interface IWarFoundryExporter
    2.17 +	{
    2.18 +		/// <summary>
    2.19 +		/// Exports the army to the specified path
    2.20 +		/// </summary>
    2.21 +		/// <param name="army">
    2.22 +		/// The <see cref="Army"/> to export
    2.23 +		/// </param>
    2.24 +		/// <param name="path">
    2.25 +		/// The file path to export to
    2.26 +		/// </param>
    2.27 +		void ExportArmy(Army army, string path);
    2.28 +	}
    2.29 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/api/Exporters/WarFoundryHtmlExporter.cs	Fri Aug 28 19:57:10 2009 +0000
     3.3 @@ -0,0 +1,36 @@
     3.4 +// This file (WarFoundryHtmlExporter.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard
     3.5 +// 
     3.6 +// 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.
     3.7 +
     3.8 +using System;
     3.9 +using IBBoard.WarFoundry.API.Objects;
    3.10 +
    3.11 +namespace IBBoard.WarFoundry.API.Exporters
    3.12 +{
    3.13 +	/// <summary>
    3.14 +	/// Custom exporter that exports an army as a basic HTML file
    3.15 +	/// </summary>
    3.16 +	public class WarFoundryHtmlExporter : IWarFoundryExporter
    3.17 +	{
    3.18 +		private static WarFoundryHtmlExporter exporter;
    3.19 +		
    3.20 +		public static WarFoundryHtmlExporter GetDefault()
    3.21 +		{
    3.22 +			if (exporter == null)
    3.23 +			{
    3.24 +				exporter = new WarFoundryHtmlExporter();
    3.25 +			}
    3.26 +			
    3.27 +			return exporter;
    3.28 +		}
    3.29 +		
    3.30 +		private WarFoundryHtmlExporter()
    3.31 +		{
    3.32 +			//Hide constructor
    3.33 +		}
    3.34 +		
    3.35 +		public void ExportArmy(Army army, string path)
    3.36 +		{
    3.37 +		}
    3.38 +	}
    3.39 +}