changeset 311:5434e648379c

Re #328: Add saving of Race and System data to files * Turn IWarFoundryFileSaver into a marker interface * Add missing Army and Race saver classes * Add stub implementations to IWarFoundryFileSaver
author IBBoard <dev@ibboard.co.uk>
date Wed, 23 Feb 2011 20:44:37 +0000
parents f7c3c1b39726
children 3854c26073c4
files IBBoard.WarFoundry.API.csproj api/Factories/Xml/WarFoundryXmlSaver.cs api/Savers/IWarFoundryArmySaver.cs api/Savers/IWarFoundryFileSaver.cs api/Savers/IWarFoundryGameSystemSaver.cs api/Savers/IWarFoundryRaceSaver.cs
diffstat 6 files changed, 71 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.API.csproj	Sun Feb 20 20:36:48 2011 +0000
     1.2 +++ b/IBBoard.WarFoundry.API.csproj	Wed Feb 23 20:44:37 2011 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4 -<?xml version="1.0" encoding="utf-8"?>
     1.5 -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     1.6 +<?xml version="1.0" encoding="utf-8"?>
     1.7 +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     1.8    <PropertyGroup>
     1.9      <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    1.10      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    1.11 @@ -184,6 +184,8 @@
    1.12      <Compile Include="api\Objects\UnitMemberType.cs" />
    1.13      <Compile Include="api\Factories\Xml\WarFoundryXmlLimitParser.cs" />
    1.14      <Compile Include="api\Factories\DummyWarFoundryFactory.cs" />
    1.15 +    <Compile Include="api\Savers\IWarFoundryArmySaver.cs" />
    1.16 +    <Compile Include="api\Savers\IWarFoundryRaceSaver.cs" />
    1.17    </ItemGroup>
    1.18    <ItemGroup>
    1.19      <Reference Include="System.Xml" />
     2.1 --- a/api/Factories/Xml/WarFoundryXmlSaver.cs	Sun Feb 20 20:36:48 2011 +0000
     2.2 +++ b/api/Factories/Xml/WarFoundryXmlSaver.cs	Wed Feb 23 20:44:37 2011 +0000
     2.3 @@ -182,5 +182,15 @@
     2.4  			containedUnitElem.SetAttribute("containedID", XmlTools.GetAsciiXmlIdForString(unit.ID));
     2.5  			return containedUnitElem;
     2.6  		}
     2.7 +
     2.8 +		public bool Save (Race race, string path)
     2.9 +		{
    2.10 +			throw new System.NotImplementedException ();
    2.11 +		}
    2.12 +	
    2.13 +		public bool Save (GameSystem system, string path)
    2.14 +		{
    2.15 +			throw new System.NotImplementedException ();
    2.16 +		}
    2.17  	}
    2.18  }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/api/Savers/IWarFoundryArmySaver.cs	Wed Feb 23 20:44:37 2011 +0000
     3.3 @@ -0,0 +1,27 @@
     3.4 +// This file (IWarFoundryArmySaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 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.Savers
    3.12 +{
    3.13 +	public interface IWarFoundryArmySaver
    3.14 +	{
    3.15 +		/// <summary>
    3.16 +		/// Saves an <see cref="Army"/> to a file on disk.
    3.17 +		/// </summary>
    3.18 +		/// <param name="army">
    3.19 +		/// The <see cref="Army"/> to save
    3.20 +		/// </param>
    3.21 +		/// <param name="path">
    3.22 +		/// The path to save the army to
    3.23 +		/// </param>
    3.24 +		/// <returns>
    3.25 +		/// TRUE if saving succedes, else FALSE
    3.26 +		/// </returns>
    3.27 +		bool Save(Army army, string path);
    3.28 +	}
    3.29 +}
    3.30 +
     4.1 --- a/api/Savers/IWarFoundryFileSaver.cs	Sun Feb 20 20:36:48 2011 +0000
     4.2 +++ b/api/Savers/IWarFoundryFileSaver.cs	Wed Feb 23 20:44:37 2011 +0000
     4.3 @@ -7,20 +7,8 @@
     4.4  
     4.5  namespace IBBoard.WarFoundry.API.Savers
     4.6  {
     4.7 -	public interface IWarFoundryFileSaver
     4.8 +	public interface IWarFoundryFileSaver : IWarFoundryGameSystemSaver, IWarFoundryRaceSaver, IWarFoundryArmySaver
     4.9  	{
    4.10 -		/// <summary>
    4.11 -		/// Saves an <see cref="Army"/> to a file on disk.
    4.12 -		/// </summary>
    4.13 -		/// <param name="army">
    4.14 -		/// The <see cref="Army"/> to save
    4.15 -		/// </param>
    4.16 -		/// <param name="path">
    4.17 -		/// The path to save the army to
    4.18 -		/// </param>
    4.19 -		/// <returns>
    4.20 -		/// TRUE if saving succedes, else FALSE
    4.21 -		/// </returns>
    4.22 -		bool Save(Army army, string path);
    4.23 +		//Marker interface
    4.24  	}
    4.25  }
     5.1 --- a/api/Savers/IWarFoundryGameSystemSaver.cs	Sun Feb 20 20:36:48 2011 +0000
     5.2 +++ b/api/Savers/IWarFoundryGameSystemSaver.cs	Wed Feb 23 20:44:37 2011 +0000
     5.3 @@ -1,4 +1,4 @@
     5.4 -// This file (IWarFoundrySystemSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard.
     5.5 +// This file (IWarFoundryGameSystemSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009, 2011 IBBoard.
     5.6  //
     5.7  // 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.
     5.8  
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/api/Savers/IWarFoundryRaceSaver.cs	Wed Feb 23 20:44:37 2011 +0000
     6.3 @@ -0,0 +1,27 @@
     6.4 +// This file (IWarFoundryRaceSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard.
     6.5 +//
     6.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.
     6.7 +
     6.8 +using System;
     6.9 +using IBBoard.WarFoundry.API.Objects;
    6.10 +
    6.11 +namespace IBBoard.WarFoundry.API
    6.12 +{
    6.13 +	public interface IWarFoundryRaceSaver
    6.14 +	{
    6.15 +		/// <summary>
    6.16 +		/// Saves an <see cref="Race"/> to a file on disk.
    6.17 +		/// </summary>
    6.18 +		/// <param name="race">
    6.19 +		/// The <see cref="Race"/> to save
    6.20 +		/// </param>
    6.21 +		/// <param name="path">
    6.22 +		/// The path to save the army to
    6.23 +		/// </param>
    6.24 +		/// <returns>
    6.25 +		/// TRUE if saving succedes, else FALSE
    6.26 +		/// </returns>
    6.27 +		bool Save(Race race, string path);
    6.28 +	}
    6.29 +}
    6.30 +