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 wrap: on
line diff
--- a/IBBoard.WarFoundry.API.csproj	Sun Feb 20 20:36:48 2011 +0000
+++ b/IBBoard.WarFoundry.API.csproj	Wed Feb 23 20:44:37 2011 +0000
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -184,6 +184,8 @@
     <Compile Include="api\Objects\UnitMemberType.cs" />
     <Compile Include="api\Factories\Xml\WarFoundryXmlLimitParser.cs" />
     <Compile Include="api\Factories\DummyWarFoundryFactory.cs" />
+    <Compile Include="api\Savers\IWarFoundryArmySaver.cs" />
+    <Compile Include="api\Savers\IWarFoundryRaceSaver.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System.Xml" />
--- a/api/Factories/Xml/WarFoundryXmlSaver.cs	Sun Feb 20 20:36:48 2011 +0000
+++ b/api/Factories/Xml/WarFoundryXmlSaver.cs	Wed Feb 23 20:44:37 2011 +0000
@@ -182,5 +182,15 @@
 			containedUnitElem.SetAttribute("containedID", XmlTools.GetAsciiXmlIdForString(unit.ID));
 			return containedUnitElem;
 		}
+
+		public bool Save (Race race, string path)
+		{
+			throw new System.NotImplementedException ();
+		}
+	
+		public bool Save (GameSystem system, string path)
+		{
+			throw new System.NotImplementedException ();
+		}
 	}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Savers/IWarFoundryArmySaver.cs	Wed Feb 23 20:44:37 2011 +0000
@@ -0,0 +1,27 @@
+// This file (IWarFoundryArmySaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard.
+//
+// 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.
+
+using System;
+using IBBoard.WarFoundry.API.Objects;
+
+namespace IBBoard.WarFoundry.API.Savers
+{
+	public interface IWarFoundryArmySaver
+	{
+		/// <summary>
+		/// Saves an <see cref="Army"/> to a file on disk.
+		/// </summary>
+		/// <param name="army">
+		/// The <see cref="Army"/> to save
+		/// </param>
+		/// <param name="path">
+		/// The path to save the army to
+		/// </param>
+		/// <returns>
+		/// TRUE if saving succedes, else FALSE
+		/// </returns>
+		bool Save(Army army, string path);
+	}
+}
+
--- a/api/Savers/IWarFoundryFileSaver.cs	Sun Feb 20 20:36:48 2011 +0000
+++ b/api/Savers/IWarFoundryFileSaver.cs	Wed Feb 23 20:44:37 2011 +0000
@@ -7,20 +7,8 @@
 
 namespace IBBoard.WarFoundry.API.Savers
 {
-	public interface IWarFoundryFileSaver
+	public interface IWarFoundryFileSaver : IWarFoundryGameSystemSaver, IWarFoundryRaceSaver, IWarFoundryArmySaver
 	{
-		/// <summary>
-		/// Saves an <see cref="Army"/> to a file on disk.
-		/// </summary>
-		/// <param name="army">
-		/// The <see cref="Army"/> to save
-		/// </param>
-		/// <param name="path">
-		/// The path to save the army to
-		/// </param>
-		/// <returns>
-		/// TRUE if saving succedes, else FALSE
-		/// </returns>
-		bool Save(Army army, string path);
+		//Marker interface
 	}
 }
--- a/api/Savers/IWarFoundryGameSystemSaver.cs	Sun Feb 20 20:36:48 2011 +0000
+++ b/api/Savers/IWarFoundryGameSystemSaver.cs	Wed Feb 23 20:44:37 2011 +0000
@@ -1,4 +1,4 @@
-// This file (IWarFoundrySystemSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard.
+// This file (IWarFoundryGameSystemSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009, 2011 IBBoard.
 //
 // 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.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Savers/IWarFoundryRaceSaver.cs	Wed Feb 23 20:44:37 2011 +0000
@@ -0,0 +1,27 @@
+// This file (IWarFoundryRaceSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard.
+//
+// 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.
+
+using System;
+using IBBoard.WarFoundry.API.Objects;
+
+namespace IBBoard.WarFoundry.API
+{
+	public interface IWarFoundryRaceSaver
+	{
+		/// <summary>
+		/// Saves an <see cref="Race"/> to a file on disk.
+		/// </summary>
+		/// <param name="race">
+		/// The <see cref="Race"/> to save
+		/// </param>
+		/// <param name="path">
+		/// The path to save the army to
+		/// </param>
+		/// <returns>
+		/// TRUE if saving succedes, else FALSE
+		/// </returns>
+		bool Save(Race race, string path);
+	}
+}
+