changeset 0:520818033bb6

Initial commit of WarFoundry code
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 15:57:51 +0000
parents
children df7211c5c448
files AssemblyInfo.cs IBBoard.WarFoundry.API.csproj IBBoard.WarFoundry.API.csproj.user IBBoard.WarFoundry.API.mdp IBBoard.WarFoundry.API.pidb api/Commands/CreateAndAddUnitCommand.cs api/Commands/RemoveUnitCommand.cs api/Commands/ReplaceUnitEquipmentCommand.cs api/Commands/SetNameCommand.cs api/Commands/SetUnitEquipmentAmountCommand.cs api/Commands/SetUnitSizeCommand.cs api/Delegates.cs api/Factories/AbstractNativeWarFoundryFactory.cs api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs api/Factories/AbstractNonNativeWarFoundryFactory.cs api/Factories/AbstractWarFoundryFactory.cs api/Factories/INativeWarFoundryFactory.cs api/Factories/INonNativeWarFoundryFactory.cs api/Factories/IWarFoundryFactory.cs api/Factories/WarFoundryFactoryFactory.cs api/Factories/Xml/WarFoundryXmlElementName.cs api/Factories/Xml/WarFoundryXmlFactory.cs api/Factories/Xml/WarFoundryXmlSaver.cs api/Objects/Ability.cs api/Objects/ArmourType.cs api/Objects/Army.cs api/Objects/ArmyCategory.cs api/Objects/Category.cs api/Objects/EquipmentItem.cs api/Objects/GameSystem.cs api/Objects/IWarFoundryNativeSourceObject.cs api/Objects/IWarFoundryObject.cs api/Objects/IWarFoundryStagedLoadObject.cs api/Objects/Race.cs api/Objects/StagedLoadingGameSystem.cs api/Objects/StagedLoadingRace.cs api/Objects/Stat.cs api/Objects/StatSlot.cs api/Objects/Stats.cs api/Objects/SystemStats.cs api/Objects/SystemStatsSet.cs api/Objects/Unit.cs api/Objects/UnitEquipmentItem.cs api/Objects/UnitEquipmentItemObj.cs api/Objects/UnitType.cs api/Objects/WarFoundryObject.cs api/Requirements/AbstractArmyRequirement.cs api/Requirements/AbstractFailedRequirement.cs api/Requirements/AbstractRequirement.cs api/Requirements/AbstractUnitRequirement.cs api/Requirements/Delegates.cs api/Requirements/FailedRequirement.cs api/Requirements/FailedUnitRequirement.cs api/Requirements/RequirementAND.cs api/Requirements/RequirementOR.cs api/Requirements/UnitExcludesRequirement.cs api/Requirements/UnitExclusion.cs api/Requirements/UnitMaxNumberReached.cs api/Requirements/UnitMinNumberReached.cs api/Requirements/UnitRequirement.cs api/Requirements/UnitRequirementItem.cs api/Requirements/UnitRequirementMaxNumber.cs api/Requirements/UnitRequirementMinNumber.cs api/Requirements/UnitRequiresAtLeastRequirement.cs api/Savers/IWarFoundryFileSaver.cs api/Savers/WarFoundrySaver.cs api/WarFoundryCore.cs api/WarFoundryLoader.cs libs/ICSharpCode.SharpZipLib.dll libs/log4net.dll libs/log4net.xml test.c
diffstat 72 files changed, 34490 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/AssemblyInfo.cs	Fri Dec 19 15:57:51 2008 +0000
     1.3 @@ -0,0 +1,58 @@
     1.4 +using System.Reflection;
     1.5 +using System.Runtime.CompilerServices;
     1.6 +
     1.7 +//
     1.8 +// General Information about an assembly is controlled through the following 
     1.9 +// set of attributes. Change these attribute values to modify the information
    1.10 +// associated with an assembly.
    1.11 +//
    1.12 +[assembly: AssemblyTitle("WarFoundry API")]
    1.13 +[assembly: AssemblyDescription("The API for the WarFoundry army builder")]
    1.14 +[assembly: AssemblyConfiguration("")]
    1.15 +[assembly: AssemblyCompany("")]
    1.16 +[assembly: AssemblyProduct("WarFoundry.API")]
    1.17 +[assembly: AssemblyCopyright("IBBoard, 2007")]
    1.18 +[assembly: AssemblyTrademark("")]
    1.19 +[assembly: AssemblyCulture("")]		
    1.20 +
    1.21 +//
    1.22 +// Version information for an assembly consists of the following four values:
    1.23 +//
    1.24 +//      Major Version
    1.25 +//      Minor Version 
    1.26 +//      Build Number
    1.27 +//      Revision
    1.28 +//
    1.29 +// You can specify all the values or you can default the Revision and Build Numbers 
    1.30 +// by using the '*' as shown below:
    1.31 +
    1.32 +[assembly: AssemblyVersion("1.0.0.*")]
    1.33 +
    1.34 +//
    1.35 +// In order to sign your assembly you must specify a key to use. Refer to the 
    1.36 +// Microsoft .NET Framework documentation for more information on assembly signing.
    1.37 +//
    1.38 +// Use the attributes below to control which key is used for signing. 
    1.39 +//
    1.40 +// Notes: 
    1.41 +//   (*) If no key is specified, the assembly is not signed.
    1.42 +//   (*) KeyName refers to a key that has been installed in the Crypto Service
    1.43 +//       Provider (CSP) on your machine. KeyFile refers to a file which contains
    1.44 +//       a key.
    1.45 +//   (*) If the KeyFile and the KeyName values are both specified, the 
    1.46 +//       following processing occurs:
    1.47 +//       (1) If the KeyName can be found in the CSP, that key is used.
    1.48 +//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
    1.49 +//           in the KeyFile is installed into the CSP and used.
    1.50 +//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
    1.51 +//       When specifying the KeyFile, the location of the KeyFile should be
    1.52 +//       relative to the project output directory which is
    1.53 +//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
    1.54 +//       located in the project directory, you would specify the AssemblyKeyFile 
    1.55 +//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
    1.56 +//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
    1.57 +//       documentation for more information on this.
    1.58 +//
    1.59 +[assembly: AssemblyDelaySign(false)]
    1.60 +[assembly: AssemblyKeyFile("")]
    1.61 +[assembly: AssemblyKeyName("")]
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.csproj	Fri Dec 19 15:57:51 2008 +0000
     2.3 @@ -0,0 +1,212 @@
     2.4 +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.5 +  <PropertyGroup>
     2.6 +    <ProjectType>Local</ProjectType>
     2.7 +    <ProductVersion>8.0.50727</ProductVersion>
     2.8 +    <SchemaVersion>2.0</SchemaVersion>
     2.9 +    <ProjectGuid>{59EC117B-F955-44D5-8461-8F44F3A7481A}</ProjectGuid>
    2.10 +    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    2.11 +    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    2.12 +    <ApplicationIcon>
    2.13 +    </ApplicationIcon>
    2.14 +    <AssemblyKeyContainerName>
    2.15 +    </AssemblyKeyContainerName>
    2.16 +    <AssemblyName>IBBoard.WarFoundry.API</AssemblyName>
    2.17 +    <AssemblyOriginatorKeyFile>
    2.18 +    </AssemblyOriginatorKeyFile>
    2.19 +    <DefaultClientScript>JScript</DefaultClientScript>
    2.20 +    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
    2.21 +    <DefaultTargetSchema>IE50</DefaultTargetSchema>
    2.22 +    <DelaySign>false</DelaySign>
    2.23 +    <OutputType>Library</OutputType>
    2.24 +    <RootNamespace>IBBoard.WarFoundry</RootNamespace>
    2.25 +    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
    2.26 +    <StartupObject>
    2.27 +    </StartupObject>
    2.28 +    <FileUpgradeFlags>
    2.29 +    </FileUpgradeFlags>
    2.30 +    <UpgradeBackupLocation>
    2.31 +    </UpgradeBackupLocation>
    2.32 +  </PropertyGroup>
    2.33 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    2.34 +    <OutputPath>bin\Debug\</OutputPath>
    2.35 +    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    2.36 +    <BaseAddress>285212672</BaseAddress>
    2.37 +    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    2.38 +    <ConfigurationOverrideFile>
    2.39 +    </ConfigurationOverrideFile>
    2.40 +    <DefineConstants>DEBUG;TRACE</DefineConstants>
    2.41 +    <DocumentationFile>
    2.42 +    </DocumentationFile>
    2.43 +    <DebugSymbols>true</DebugSymbols>
    2.44 +    <FileAlignment>4096</FileAlignment>
    2.45 +    <NoStdLib>false</NoStdLib>
    2.46 +    <NoWarn>
    2.47 +    </NoWarn>
    2.48 +    <Optimize>false</Optimize>
    2.49 +    <RegisterForComInterop>false</RegisterForComInterop>
    2.50 +    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    2.51 +    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    2.52 +    <WarningLevel>4</WarningLevel>
    2.53 +    <DebugType>full</DebugType>
    2.54 +    <ErrorReport>prompt</ErrorReport>
    2.55 +  </PropertyGroup>
    2.56 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    2.57 +    <OutputPath>bin\Release\</OutputPath>
    2.58 +    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    2.59 +    <BaseAddress>285212672</BaseAddress>
    2.60 +    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    2.61 +    <ConfigurationOverrideFile>
    2.62 +    </ConfigurationOverrideFile>
    2.63 +    <DefineConstants>TRACE</DefineConstants>
    2.64 +    <DocumentationFile>
    2.65 +    </DocumentationFile>
    2.66 +    <DebugSymbols>false</DebugSymbols>
    2.67 +    <FileAlignment>4096</FileAlignment>
    2.68 +    <NoStdLib>false</NoStdLib>
    2.69 +    <NoWarn>
    2.70 +    </NoWarn>
    2.71 +    <Optimize>true</Optimize>
    2.72 +    <RegisterForComInterop>false</RegisterForComInterop>
    2.73 +    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    2.74 +    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    2.75 +    <WarningLevel>4</WarningLevel>
    2.76 +    <DebugType>none</DebugType>
    2.77 +    <ErrorReport>prompt</ErrorReport>
    2.78 +  </PropertyGroup>
    2.79 +  <ItemGroup>
    2.80 +    <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" />
    2.81 +    <Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
    2.82 +    <Reference Include="System">
    2.83 +      <Name>System</Name>
    2.84 +    </Reference>
    2.85 +    <Reference Include="System.Data">
    2.86 +      <Name>System.Data</Name>
    2.87 +    </Reference>
    2.88 +    <Reference Include="System.Windows.Forms">
    2.89 +      <Name>System.Windows.Forms</Name>
    2.90 +    </Reference>
    2.91 +    <Reference Include="System.Xml">
    2.92 +      <Name>System.XML</Name>
    2.93 +    </Reference>
    2.94 +    <ProjectReference Include="..\..\IBBoard\IBBoard.csproj">
    2.95 +      <Name>IBBoard</Name>
    2.96 +      <Project>{5DFD64F6-FC2B-4B4F-B92E-483BAC468105}</Project>
    2.97 +      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
    2.98 +    </ProjectReference>
    2.99 +  </ItemGroup>
   2.100 +  <ItemGroup>
   2.101 +    <Compile Include="API\Ability.cs" />
   2.102 +    <Compile Include="API\ArmourType.cs" />
   2.103 +    <Compile Include="API\Army.cs">
   2.104 +      <SubType>Code</SubType>
   2.105 +    </Compile>
   2.106 +    <Compile Include="API\ArmyCategory.cs">
   2.107 +      <SubType>Code</SubType>
   2.108 +    </Compile>
   2.109 +    <Compile Include="API\Category.cs">
   2.110 +      <SubType>Code</SubType>
   2.111 +    </Compile>
   2.112 +    <Compile Include="API\Commands\CreateAndAddUnitCommand.cs" />
   2.113 +    <Compile Include="API\Commands\RemoveUnitCommand.cs">
   2.114 +      <SubType>Code</SubType>
   2.115 +    </Compile>
   2.116 +    <Compile Include="API\Commands\ReplaceUnitEquipmentCommand.cs">
   2.117 +      <SubType>Code</SubType>
   2.118 +    </Compile>
   2.119 +    <Compile Include="API\Commands\SetNameCommand.cs">
   2.120 +      <SubType>Code</SubType>
   2.121 +    </Compile>
   2.122 +    <Compile Include="API\Commands\SetUnitEquipmentAmountCommand.cs">
   2.123 +      <SubType>Code</SubType>
   2.124 +    </Compile>
   2.125 +    <Compile Include="API\Commands\SetUnitSizeCommand.cs">
   2.126 +      <SubType>Code</SubType>
   2.127 +    </Compile>
   2.128 +    <Compile Include="API\Delegates.cs">
   2.129 +      <SubType>Code</SubType>
   2.130 +    </Compile>
   2.131 +    <Compile Include="API\EquipmentItem.cs">
   2.132 +      <SubType>Code</SubType>
   2.133 +    </Compile>
   2.134 +    <Compile Include="API\GameSystem.cs">
   2.135 +      <SubType>Code</SubType>
   2.136 +    </Compile>
   2.137 +    <Compile Include="API\Race.cs">
   2.138 +      <SubType>Code</SubType>
   2.139 +    </Compile>
   2.140 +    <Compile Include="API\Requirements\AbstractArmyRequirement.cs" />
   2.141 +    <Compile Include="API\Requirements\AbstractFailedRequirement.cs" />
   2.142 +    <Compile Include="API\Requirements\AbstractRequirement.cs" />
   2.143 +    <Compile Include="API\Requirements\AbstractUnitRequirement.cs" />
   2.144 +    <Compile Include="API\Requirements\Delegates.cs" />
   2.145 +    <Compile Include="API\Requirements\FailedRequirement.cs" />
   2.146 +    <Compile Include="API\Requirements\FailedUnitRequirement.cs" />
   2.147 +    <Compile Include="API\Requirements\RequirementAND.cs" />
   2.148 +    <Compile Include="API\Requirements\RequirementOR.cs" />
   2.149 +    <Compile Include="API\Requirements\UnitExcludesRequirement.cs" />
   2.150 +    <Compile Include="API\Requirements\UnitExclusion.cs" />
   2.151 +    <Compile Include="API\Requirements\UnitMaxNumberReached.cs" />
   2.152 +    <Compile Include="API\Requirements\UnitMinNumberReached.cs" />
   2.153 +    <Compile Include="API\Requirements\UnitRequirement.cs" />
   2.154 +    <Compile Include="API\Requirements\UnitRequirementItem.cs" />
   2.155 +    <Compile Include="API\Requirements\UnitRequirementMaxNumber.cs" />
   2.156 +    <Compile Include="API\Requirements\UnitRequirementMinNumber.cs" />
   2.157 +    <Compile Include="API\Requirements\UnitRequiresAtLeastRequirement.cs" />
   2.158 +    <Compile Include="API\Stat.cs">
   2.159 +      <SubType>Code</SubType>
   2.160 +    </Compile>
   2.161 +    <Compile Include="API\Stats.cs">
   2.162 +      <SubType>Code</SubType>
   2.163 +    </Compile>
   2.164 +    <Compile Include="API\StatSlot.cs">
   2.165 +      <SubType>Code</SubType>
   2.166 +    </Compile>
   2.167 +    <Compile Include="API\SystemStats.cs">
   2.168 +      <SubType>Code</SubType>
   2.169 +    </Compile>
   2.170 +    <Compile Include="API\SystemStatsSet.cs" />
   2.171 +    <Compile Include="API\Unit.cs">
   2.172 +      <SubType>Code</SubType>
   2.173 +    </Compile>
   2.174 +    <Compile Include="API\UnitEquipmentItem.cs">
   2.175 +      <SubType>Code</SubType>
   2.176 +    </Compile>
   2.177 +    <Compile Include="API\UnitEquipmentItemObj.cs">
   2.178 +      <SubType>Code</SubType>
   2.179 +    </Compile>
   2.180 +    <Compile Include="API\UnitType.cs">
   2.181 +      <SubType>Code</SubType>
   2.182 +    </Compile>
   2.183 +    <Compile Include="API\WarFoundryCore.cs" />
   2.184 +    <Compile Include="API\WarFoundryFactory.cs">
   2.185 +      <SubType>Code</SubType>
   2.186 +    </Compile>
   2.187 +    <Compile Include="API\WarFoundryFactoryFactory.cs" />
   2.188 +    <Compile Include="API\WarFoundryObject.cs">
   2.189 +      <SubType>Code</SubType>
   2.190 +    </Compile>
   2.191 +    <Compile Include="API\WarFoundrySaver.cs" />
   2.192 +    <Compile Include="API\WarFoundryStagedLoadObject.cs" />
   2.193 +    <Compile Include="API\WarFoundryXmlElementName.cs" />
   2.194 +    <Compile Include="API\WarFoundryXmlFactory.cs" />
   2.195 +    <Compile Include="AssemblyInfo.cs">
   2.196 +      <SubType>Code</SubType>
   2.197 +    </Compile>
   2.198 +    <Compile Include="tests\WarFoundryFactoryFactoryTest.cs" />
   2.199 +    <Compile Include="tests\WarFoundryFactoryTest.cs" />
   2.200 +  </ItemGroup>
   2.201 +  <ItemGroup>
   2.202 +    <Content Include="libs\log4net.dll" />
   2.203 +    <Content Include="libs\log4net.xml" />
   2.204 +  </ItemGroup>
   2.205 +  <ItemGroup>
   2.206 +    <Folder Include="testdata\" />
   2.207 +  </ItemGroup>
   2.208 +  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   2.209 +  <PropertyGroup>
   2.210 +    <PreBuildEvent>
   2.211 +    </PreBuildEvent>
   2.212 +    <PostBuildEvent>
   2.213 +    </PostBuildEvent>
   2.214 +  </PropertyGroup>
   2.215 +</Project>
   2.216 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/IBBoard.WarFoundry.API.csproj.user	Fri Dec 19 15:57:51 2008 +0000
     3.3 @@ -0,0 +1,58 @@
     3.4 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3.5 +  <PropertyGroup>
     3.6 +    <LastOpenVersion>7.10.3077</LastOpenVersion>
     3.7 +    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     3.8 +    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     3.9 +    <ReferencePath>
    3.10 +    </ReferencePath>
    3.11 +    <CopyProjectDestinationFolder>
    3.12 +    </CopyProjectDestinationFolder>
    3.13 +    <CopyProjectUncPath>
    3.14 +    </CopyProjectUncPath>
    3.15 +    <CopyProjectOption>0</CopyProjectOption>
    3.16 +    <ProjectView>ShowAllFiles</ProjectView>
    3.17 +    <ProjectTrust>0</ProjectTrust>
    3.18 +  </PropertyGroup>
    3.19 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    3.20 +    <EnableASPDebugging>false</EnableASPDebugging>
    3.21 +    <EnableASPXDebugging>false</EnableASPXDebugging>
    3.22 +    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    3.23 +    <EnableSQLServerDebugging>false</EnableSQLServerDebugging>
    3.24 +    <RemoteDebugEnabled>false</RemoteDebugEnabled>
    3.25 +    <RemoteDebugMachine>
    3.26 +    </RemoteDebugMachine>
    3.27 +    <StartAction>Project</StartAction>
    3.28 +    <StartArguments>
    3.29 +    </StartArguments>
    3.30 +    <StartPage>
    3.31 +    </StartPage>
    3.32 +    <StartProgram>
    3.33 +    </StartProgram>
    3.34 +    <StartURL>
    3.35 +    </StartURL>
    3.36 +    <StartWorkingDirectory>
    3.37 +    </StartWorkingDirectory>
    3.38 +    <StartWithIE>true</StartWithIE>
    3.39 +  </PropertyGroup>
    3.40 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    3.41 +    <EnableASPDebugging>false</EnableASPDebugging>
    3.42 +    <EnableASPXDebugging>false</EnableASPXDebugging>
    3.43 +    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
    3.44 +    <EnableSQLServerDebugging>false</EnableSQLServerDebugging>
    3.45 +    <RemoteDebugEnabled>false</RemoteDebugEnabled>
    3.46 +    <RemoteDebugMachine>
    3.47 +    </RemoteDebugMachine>
    3.48 +    <StartAction>Project</StartAction>
    3.49 +    <StartArguments>
    3.50 +    </StartArguments>
    3.51 +    <StartPage>
    3.52 +    </StartPage>
    3.53 +    <StartProgram>
    3.54 +    </StartProgram>
    3.55 +    <StartURL>
    3.56 +    </StartURL>
    3.57 +    <StartWorkingDirectory>
    3.58 +    </StartWorkingDirectory>
    3.59 +    <StartWithIE>true</StartWithIE>
    3.60 +  </PropertyGroup>
    3.61 +</Project>
    3.62 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/IBBoard.WarFoundry.API.mdp	Fri Dec 19 15:57:51 2008 +0000
     4.3 @@ -0,0 +1,98 @@
     4.4 +<Project name="IBBoard.WarFoundry.API" fileversion="2.0" DefaultNamespace="IBBoard.WarFoundry" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
     4.5 +  <Configurations active="Debug">
     4.6 +    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
     4.7 +      <Output directory="bin/Debug/" assemblyKeyFile="." assembly="IBBoard.WarFoundry.API" />
     4.8 +      <Build debugmode="True" target="Library" />
     4.9 +      <Execution runwithwarnings="False" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
    4.10 +      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
    4.11 +    </Configuration>
    4.12 +    <Configuration name="Release" ctype="DotNetProjectConfiguration">
    4.13 +      <Output directory="bin/Release/" assembly="IBBoard.WarFoundry.API" />
    4.14 +      <Build debugmode="False" target="Library" />
    4.15 +      <Execution runwithwarnings="False" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
    4.16 +      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="True" ctype="CSharpCompilerParameters" />
    4.17 +    </Configuration>
    4.18 +  </Configurations>
    4.19 +  <Contents>
    4.20 +    <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
    4.21 +    <File name="api/Delegates.cs" subtype="Code" buildaction="Compile" />
    4.22 +    <File name="api/Commands/CreateAndAddUnitCommand.cs" subtype="Code" buildaction="Compile" />
    4.23 +    <File name="api/Commands/RemoveUnitCommand.cs" subtype="Code" buildaction="Compile" />
    4.24 +    <File name="api/Commands/ReplaceUnitEquipmentCommand.cs" subtype="Code" buildaction="Compile" />
    4.25 +    <File name="api/Commands/SetNameCommand.cs" subtype="Code" buildaction="Compile" />
    4.26 +    <File name="api/Commands/SetUnitEquipmentAmountCommand.cs" subtype="Code" buildaction="Compile" />
    4.27 +    <File name="api/Commands/SetUnitSizeCommand.cs" subtype="Code" buildaction="Compile" />
    4.28 +    <File name="libs/log4net.dll" subtype="Code" buildaction="Nothing" />
    4.29 +    <File name="libs/log4net.xml" subtype="Code" buildaction="Nothing" />
    4.30 +    <File name="api/Requirements" subtype="Directory" buildaction="Compile" />
    4.31 +    <File name="api/Requirements/UnitExcludesRequirement.cs" subtype="Code" buildaction="Compile" />
    4.32 +    <File name="api/Requirements/UnitRequirementItem.cs" subtype="Code" buildaction="Compile" />
    4.33 +    <File name="api/Requirements/UnitRequirement.cs" subtype="Code" buildaction="Compile" />
    4.34 +    <File name="api/Requirements/RequirementAND.cs" subtype="Code" buildaction="Compile" />
    4.35 +    <File name="api/Requirements/RequirementOR.cs" subtype="Code" buildaction="Compile" />
    4.36 +    <File name="api/Requirements/UnitRequiresAtLeastRequirement.cs" subtype="Code" buildaction="Compile" />
    4.37 +    <File name="api/Requirements/UnitMinNumberReached.cs" subtype="Code" buildaction="Compile" />
    4.38 +    <File name="api/Requirements/UnitMaxNumberReached.cs" subtype="Code" buildaction="Compile" />
    4.39 +    <File name="api/Requirements/FailedUnitRequirement.cs" subtype="Code" buildaction="Compile" />
    4.40 +    <File name="api/Requirements/UnitExclusion.cs" subtype="Code" buildaction="Compile" />
    4.41 +    <File name="api/Requirements/AbstractArmyRequirement.cs" subtype="Code" buildaction="Compile" />
    4.42 +    <File name="api/Requirements/FailedRequirement.cs" subtype="Code" buildaction="Compile" />
    4.43 +    <File name="api/Requirements/UnitRequirementMaxNumber.cs" subtype="Code" buildaction="Compile" />
    4.44 +    <File name="api/Requirements/UnitRequirementMinNumber.cs" subtype="Code" buildaction="Compile" />
    4.45 +    <File name="api/Requirements/AbstractFailedRequirement.cs" subtype="Code" buildaction="Compile" />
    4.46 +    <File name="api/Requirements/Delegates.cs" subtype="Code" buildaction="Compile" />
    4.47 +    <File name="api/WarFoundryCore.cs" subtype="Code" buildaction="Compile" />
    4.48 +    <File name="api/Requirements/AbstractRequirement.cs" subtype="Code" buildaction="Compile" />
    4.49 +    <File name="api/Requirements/AbstractUnitRequirement.cs" subtype="Code" buildaction="Compile" />
    4.50 +    <File name="libs/ICSharpCode.SharpZipLib.dll" subtype="Code" buildaction="Nothing" />
    4.51 +    <File name="api/WarFoundryLoader.cs" subtype="Code" buildaction="Compile" />
    4.52 +    <File name="api/Factories" subtype="Directory" buildaction="Compile" />
    4.53 +    <File name="api/Factories/AbstractNativeWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.54 +    <File name="api/Factories/WarFoundryFactoryFactory.cs" subtype="Code" buildaction="Compile" />
    4.55 +    <File name="api/Objects" subtype="Directory" buildaction="Compile" />
    4.56 +    <File name="api/Objects/Ability.cs" subtype="Code" buildaction="Compile" />
    4.57 +    <File name="api/Objects/ArmourType.cs" subtype="Code" buildaction="Compile" />
    4.58 +    <File name="api/Objects/Army.cs" subtype="Code" buildaction="Compile" />
    4.59 +    <File name="api/Objects/ArmyCategory.cs" subtype="Code" buildaction="Compile" />
    4.60 +    <File name="api/Objects/Category.cs" subtype="Code" buildaction="Compile" />
    4.61 +    <File name="api/Objects/EquipmentItem.cs" subtype="Code" buildaction="Compile" />
    4.62 +    <File name="api/Objects/GameSystem.cs" subtype="Code" buildaction="Compile" />
    4.63 +    <File name="api/Objects/StagedLoadingRace.cs" subtype="Code" buildaction="Compile" />
    4.64 +    <File name="api/Objects/Stat.cs" subtype="Code" buildaction="Compile" />
    4.65 +    <File name="api/Objects/Stats.cs" subtype="Code" buildaction="Compile" />
    4.66 +    <File name="api/Objects/StatSlot.cs" subtype="Code" buildaction="Compile" />
    4.67 +    <File name="api/Objects/SystemStats.cs" subtype="Code" buildaction="Compile" />
    4.68 +    <File name="api/Objects/SystemStatsSet.cs" subtype="Code" buildaction="Compile" />
    4.69 +    <File name="api/Objects/Unit.cs" subtype="Code" buildaction="Compile" />
    4.70 +    <File name="api/Objects/UnitEquipmentItem.cs" subtype="Code" buildaction="Compile" />
    4.71 +    <File name="api/Objects/UnitEquipmentItemObj.cs" subtype="Code" buildaction="Compile" />
    4.72 +    <File name="api/Objects/UnitType.cs" subtype="Code" buildaction="Compile" />
    4.73 +    <File name="api/Objects/IWarFoundryStagedLoadObject.cs" subtype="Code" buildaction="Compile" />
    4.74 +    <File name="api/Objects/WarFoundryObject.cs" subtype="Code" buildaction="Compile" />
    4.75 +    <File name="api/Factories/Xml" subtype="Directory" buildaction="Compile" />
    4.76 +    <File name="api/Factories/Xml/WarFoundryXmlSaver.cs" subtype="Code" buildaction="Compile" />
    4.77 +    <File name="api/Factories/Xml/WarFoundryXmlFactory.cs" subtype="Code" buildaction="Compile" />
    4.78 +    <File name="api/Factories/Xml/WarFoundryXmlElementName.cs" subtype="Code" buildaction="Compile" />
    4.79 +    <File name="api/Factories/AbstractNonNativeWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.80 +    <File name="api/Factories/IWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.81 +    <File name="api/Factories/AbstractWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.82 +    <File name="api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.83 +    <File name="api/Savers" subtype="Directory" buildaction="Compile" />
    4.84 +    <File name="api/Savers/IWarFoundryFileSaver.cs" subtype="Code" buildaction="Compile" />
    4.85 +    <File name="api/Savers/WarFoundrySaver.cs" subtype="Code" buildaction="Compile" />
    4.86 +    <File name="api/Factories/INonNativeWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.87 +    <File name="api/Factories/INativeWarFoundryFactory.cs" subtype="Code" buildaction="Compile" />
    4.88 +    <File name="api/Objects/Race.cs" subtype="Code" buildaction="Compile" />
    4.89 +    <File name="api/Objects/IWarFoundryNativeSourceObject.cs" subtype="Code" buildaction="Compile" />
    4.90 +    <File name="api/Objects/IWarFoundryObject.cs" subtype="Code" buildaction="Compile" />
    4.91 +    <File name="api/Objects/StagedLoadingGameSystem.cs" subtype="Code" buildaction="Compile" />
    4.92 +  </Contents>
    4.93 +  <References>
    4.94 +    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    4.95 +    <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    4.96 +    <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    4.97 +    <ProjectReference type="Project" localcopy="True" refto="IBBoard" />
    4.98 +    <ProjectReference type="Gac" localcopy="True" refto="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    4.99 +    <ProjectReference type="Assembly" localcopy="True" refto="libs/ICSharpCode.SharpZipLib.dll" />
   4.100 +  </References>
   4.101 +</Project>
   4.102 \ No newline at end of file
     5.1 Binary file IBBoard.WarFoundry.API.pidb has changed
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/api/Commands/CreateAndAddUnitCommand.cs	Fri Dec 19 15:57:51 2008 +0000
     6.3 @@ -0,0 +1,67 @@
     6.4 +using System;
     6.5 +using IBBoard.Commands;
     6.6 +using IBBoard.Lang;
     6.7 +using IBBoard.WarFoundry.API.Objects;
     6.8 +
     6.9 +namespace IBBoard.WarFoundry.API.Commands
    6.10 +{
    6.11 +	/// <summary>
    6.12 +	/// Summary description for AddUnitCommand.
    6.13 +	/// </summary>
    6.14 +	public class CreateAndAddUnitCommand : Command
    6.15 +	{
    6.16 +		private UnitType addedUnitType;
    6.17 +		private Army army;
    6.18 +		private ArmyCategory cat;
    6.19 +		private Unit addedUnit;
    6.20 +
    6.21 +		public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory catTo, Army armyTo)
    6.22 +		{
    6.23 +			addedUnitType = toAdd;
    6.24 +			cat = catTo;
    6.25 +			army = armyTo;
    6.26 +		}
    6.27 +
    6.28 +		public CreateAndAddUnitCommand(UnitType toAdd, Category catTo, Army armyTo) : this (toAdd, armyTo.GetCategory(catTo), armyTo)
    6.29 +		{
    6.30 +		}
    6.31 +
    6.32 +		public override bool CanExecute()
    6.33 +		{
    6.34 +			return (addedUnitType!=null && army!=null);
    6.35 +		}
    6.36 +
    6.37 +		public override string Description
    6.38 +		{
    6.39 +			get { return "Add unit of "+StringManipulation.CutToLength(addedUnitType.Name, 20)+" to the army"; }
    6.40 +		}
    6.41 +
    6.42 +		public override string UndoDescription
    6.43 +		{
    6.44 +			get { return "Remove unit of "+StringManipulation.CutToLength(addedUnitType.Name, 20)+" from army"; }
    6.45 +		}
    6.46 +
    6.47 +		public override bool Execute()
    6.48 +		{
    6.49 +			addedUnit = new Unit(addedUnitType, army);
    6.50 +			this.Redo();
    6.51 +			return true;
    6.52 +		}
    6.53 +
    6.54 +		public override void Redo()
    6.55 +		{
    6.56 +			cat.AddUnit(addedUnit);
    6.57 +		}
    6.58 +
    6.59 +		public override void Undo()
    6.60 +		{
    6.61 +			cat.RemoveUnit(addedUnit);
    6.62 +		}
    6.63 +
    6.64 +
    6.65 +		public override string Name
    6.66 +		{
    6.67 +			get { return "Add new unit"; }
    6.68 +		}
    6.69 +	}
    6.70 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/api/Commands/RemoveUnitCommand.cs	Fri Dec 19 15:57:51 2008 +0000
     7.3 @@ -0,0 +1,57 @@
     7.4 +using System;
     7.5 +using IBBoard.Commands;
     7.6 +using IBBoard.WarFoundry.API.Objects;
     7.7 +
     7.8 +namespace IBBoard.WarFoundry.API.Commands
     7.9 +{
    7.10 +	/// <summary>
    7.11 +	/// Summary description for RemoveUnitCommand.
    7.12 +	/// </summary>
    7.13 +	public class RemoveUnitCommand : Command
    7.14 +	{
    7.15 +		private Unit unit;
    7.16 +		private ArmyCategory cat;
    7.17 +
    7.18 +		public RemoveUnitCommand(Unit toRemove)
    7.19 +		{
    7.20 +			unit = toRemove;
    7.21 +			cat = unit.Category;
    7.22 +		}
    7.23 +
    7.24 +		public override bool CanExecute()
    7.25 +		{
    7.26 +			return (unit!=null);
    7.27 +		}
    7.28 +
    7.29 +		public override string Description
    7.30 +		{
    7.31 +			get { return "Remove an existing unit from the army"; }
    7.32 +		}
    7.33 +
    7.34 +		public override string UndoDescription
    7.35 +		{
    7.36 +			get { return "Replace a removed unit"; }
    7.37 +		}
    7.38 +
    7.39 +		public override bool Execute()
    7.40 +		{
    7.41 +			this.Redo();
    7.42 +			return true;
    7.43 +		}
    7.44 +
    7.45 +		public override void Redo()
    7.46 +		{
    7.47 +			cat.RemoveUnit(unit);
    7.48 +		}
    7.49 +
    7.50 +		public override void Undo()
    7.51 +		{
    7.52 +			cat.AddUnit(unit);
    7.53 +		}
    7.54 +
    7.55 +		public override string Name
    7.56 +		{
    7.57 +			get { return "Remove unit"; }
    7.58 +		}
    7.59 +	}
    7.60 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/api/Commands/ReplaceUnitEquipmentCommand.cs	Fri Dec 19 15:57:51 2008 +0000
     8.3 @@ -0,0 +1,63 @@
     8.4 +using System;
     8.5 +using IBBoard.Commands;
     8.6 +using IBBoard.Lang;
     8.7 +using IBBoard.WarFoundry.API.Objects;
     8.8 +
     8.9 +namespace IBBoard.WarFoundry.API.Commands
    8.10 +{
    8.11 +	/// <summary>
    8.12 +	/// Summary description for ReplaceUnitEquipmentCommand.
    8.13 +	/// </summary>
    8.14 +	public class ReplaceUnitEquipmentCommand : Command
    8.15 +	{
    8.16 +		private SetUnitEquipmentAmountCommand removeOldCommand, addNewCommand;
    8.17 +		//private Unit unit;
    8.18 +		//private EquipmentItem oldEquip, newEquip;
    8.19 +		//private float newAmount, oldAmount;
    8.20 +		
    8.21 +		public ReplaceUnitEquipmentCommand(Unit unit, EquipmentItem oldItem, EquipmentItem newItem, float amount)
    8.22 +		{
    8.23 +			removeOldCommand = new SetUnitEquipmentAmountCommand(unit, oldItem, 0);
    8.24 +			addNewCommand = new SetUnitEquipmentAmountCommand(unit, newItem, amount);
    8.25 +		}
    8.26 +
    8.27 +		public override bool CanExecute()
    8.28 +		{
    8.29 +			return removeOldCommand.CanExecute() && addNewCommand.CanExecute();
    8.30 +		}
    8.31 +
    8.32 +		public override string Description
    8.33 +		{
    8.34 +			get { return "Replace "+StringManipulation.CutToLength(removeOldCommand.EquipItem.Name, 20)+" with "+StringManipulation.CutToLength(addNewCommand.EquipItem.Name, 20)+ " for "+StringManipulation.CutToLength(removeOldCommand.Unit.Name, 20); }
    8.35 +		}
    8.36 +
    8.37 +		public override string UndoDescription
    8.38 +		{
    8.39 +			get { return "Replace "+StringManipulation.CutToLength(addNewCommand.EquipItem.Name, 20)+" with "+StringManipulation.CutToLength(removeOldCommand.EquipItem.Name, 20)+ " for "+StringManipulation.CutToLength(removeOldCommand.Unit.Name, 20); }
    8.40 +		}
    8.41 +
    8.42 +		public override bool Execute()
    8.43 +		{
    8.44 +			this.Redo();
    8.45 +			return true;
    8.46 +		}
    8.47 +
    8.48 +		public override void Redo()
    8.49 +		{
    8.50 +			removeOldCommand.Redo();
    8.51 +			addNewCommand.Redo();
    8.52 +		}
    8.53 +
    8.54 +		public override void Undo()
    8.55 +		{
    8.56 +			addNewCommand.Undo();
    8.57 +			removeOldCommand.Undo();
    8.58 +		}
    8.59 +
    8.60 +
    8.61 +		public override string Name
    8.62 +		{
    8.63 +			get { return "Replace required equipment"; }
    8.64 +		}
    8.65 +	}
    8.66 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/api/Commands/SetNameCommand.cs	Fri Dec 19 15:57:51 2008 +0000
     9.3 @@ -0,0 +1,58 @@
     9.4 +using System;
     9.5 +using IBBoard.Commands;
     9.6 +using IBBoard.WarFoundry.API.Objects;
     9.7 +
     9.8 +namespace IBBoard.WarFoundry.API.Commands
     9.9 +{
    9.10 +	/// <summary>
    9.11 +	/// Summary description for SetNameCommand.
    9.12 +	/// </summary>
    9.13 +	public class SetNameCommand : Command
    9.14 +	{
    9.15 +		private WarFoundryObject obj;
    9.16 +		private string newName, oldName;
    9.17 +
    9.18 +		public SetNameCommand(WarFoundryObject toRename, string name)
    9.19 +		{
    9.20 +			obj = toRename;
    9.21 +			newName = name;
    9.22 +			oldName = obj.Name;
    9.23 +		}
    9.24 +
    9.25 +		public override bool CanExecute()
    9.26 +		{
    9.27 +			return (obj!=null && newName!=null && newName!="");
    9.28 +		}
    9.29 +
    9.30 +		public override string Description
    9.31 +		{
    9.32 +			get { return "Rename "+oldName; }
    9.33 +		}
    9.34 +
    9.35 +		public override string UndoDescription
    9.36 +		{
    9.37 +			get { return "Revert name of "+newName; }
    9.38 +		}
    9.39 +
    9.40 +		public override bool Execute()
    9.41 +		{
    9.42 +			this.Redo();
    9.43 +			return true;
    9.44 +		}
    9.45 +
    9.46 +		public override void Redo()
    9.47 +		{
    9.48 +			obj.Name = newName;
    9.49 +		}
    9.50 +
    9.51 +		public override void Undo()
    9.52 +		{
    9.53 +			obj.Name = oldName;
    9.54 +		}
    9.55 +
    9.56 +		public override string Name
    9.57 +		{
    9.58 +			get { return "Rename item"; }
    9.59 +		}
    9.60 +	}
    9.61 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/api/Commands/SetUnitEquipmentAmountCommand.cs	Fri Dec 19 15:57:51 2008 +0000
    10.3 @@ -0,0 +1,71 @@
    10.4 +using System;
    10.5 +using IBBoard.Commands;
    10.6 +using IBBoard.Lang;
    10.7 +using IBBoard.WarFoundry.API.Objects;
    10.8 +
    10.9 +namespace IBBoard.WarFoundry.API.Commands
   10.10 +{
   10.11 +	/// <summary>
   10.12 +	/// Summary description for SetUnitEquipmentAmountCommand.
   10.13 +	/// </summary>
   10.14 +	public class SetUnitEquipmentAmountCommand : Command
   10.15 +	{
   10.16 +		private Unit unit;
   10.17 +		private EquipmentItem equip;
   10.18 +		private float newAmount, oldAmount;
   10.19 +		
   10.20 +		public SetUnitEquipmentAmountCommand(Unit unit, EquipmentItem item, float amount)
   10.21 +		{
   10.22 +			this.unit = unit;
   10.23 +			equip = item;
   10.24 +			newAmount = amount;
   10.25 +			oldAmount = unit.GetEquipmentAmount(equip.ID);
   10.26 +		}
   10.27 +
   10.28 +		public override bool CanExecute()
   10.29 +		{
   10.30 +			return (unit!=null && equip!=null);
   10.31 +		}
   10.32 +
   10.33 +		public override string Description
   10.34 +		{
   10.35 +			get { return "Set "+StringManipulation.CutToLength(equip.Name, 20)+" amount for "+StringManipulation.CutToLength(unit.Name, 20)+" to "+UnitEquipmentItemObj.FormatEquipmentAmount(equip, newAmount); }
   10.36 +		}
   10.37 +
   10.38 +		public override string UndoDescription
   10.39 +		{
   10.40 +			get { return "Set "+StringManipulation.CutToLength(equip.Name, 20)+" amount for "+StringManipulation.CutToLength(unit.Name, 20)+" to "+UnitEquipmentItemObj.FormatEquipmentAmount(equip, oldAmount); }
   10.41 +		}
   10.42 +
   10.43 +		public override bool Execute()
   10.44 +		{
   10.45 +			this.Redo();
   10.46 +			return true;
   10.47 +		}
   10.48 +
   10.49 +		public override void Redo()
   10.50 +		{
   10.51 +			unit.SetEquipmentAmount(equip.ID, newAmount);
   10.52 +		}
   10.53 +
   10.54 +		public override void Undo()
   10.55 +		{
   10.56 +			unit.SetEquipmentAmount(equip.ID, oldAmount);
   10.57 +		}
   10.58 +
   10.59 +		public override string Name
   10.60 +		{
   10.61 +			get { return "Set equipment amount"; }
   10.62 +		}
   10.63 +
   10.64 +		public EquipmentItem EquipItem
   10.65 +		{
   10.66 +			get { return equip; }
   10.67 +		}
   10.68 +
   10.69 +		public Unit Unit
   10.70 +		{
   10.71 +			get { return unit; }
   10.72 +		}
   10.73 +	}
   10.74 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/api/Commands/SetUnitSizeCommand.cs	Fri Dec 19 15:57:51 2008 +0000
    11.3 @@ -0,0 +1,58 @@
    11.4 +using System;
    11.5 +using IBBoard.Commands;
    11.6 +using IBBoard.WarFoundry.API.Objects;
    11.7 +
    11.8 +namespace IBBoard.WarFoundry.API.Commands
    11.9 +{
   11.10 +	/// <summary>
   11.11 +	/// Summary description for SetNameCommand.
   11.12 +	/// </summary>
   11.13 +	public class SetUnitSizeCommand : Command
   11.14 +	{
   11.15 +		private Unit unit;
   11.16 +		private int newSize, oldSize;
   11.17 +
   11.18 +		public SetUnitSizeCommand(Unit toResize, int size)
   11.19 +		{
   11.20 +			unit = toResize;
   11.21 +			newSize = size;
   11.22 +			oldSize = unit.Size;
   11.23 +		}
   11.24 +
   11.25 +		public override bool CanExecute()
   11.26 +		{
   11.27 +			return (unit!=null && newSize >0 && oldSize > 0);
   11.28 +		}
   11.29 +
   11.30 +		public override string Description
   11.31 +		{
   11.32 +			get { return "Change size of "+unit.Name; }
   11.33 +		}
   11.34 +
   11.35 +		public override string UndoDescription
   11.36 +		{
   11.37 +			get { return "Revert size of "+unit.Name; }
   11.38 +		}
   11.39 +
   11.40 +		public override bool Execute()
   11.41 +		{
   11.42 +			this.Redo();
   11.43 +			return true;
   11.44 +		}
   11.45 +
   11.46 +		public override void Redo()
   11.47 +		{
   11.48 +			unit.Size = newSize;
   11.49 +		}
   11.50 +
   11.51 +		public override void Undo()
   11.52 +		{
   11.53 +			unit.Size = oldSize;
   11.54 +		}
   11.55 +
   11.56 +		public override string Name
   11.57 +		{
   11.58 +			get { return "Change unit size"; }
   11.59 +		}
   11.60 +	}
   11.61 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/api/Delegates.cs	Fri Dec 19 15:57:51 2008 +0000
    12.3 @@ -0,0 +1,19 @@
    12.4 +using System;
    12.5 +using System.Collections.Generic;
    12.6 +using IBBoard.WarFoundry.API.Objects;
    12.7 +
    12.8 +namespace IBBoard.WarFoundry.API
    12.9 +{
   12.10 +	public delegate void ObjectChangedDelegate(WarFoundryObject oldValue, WarFoundryObject newValue);
   12.11 +	public delegate void ArmyChangedDelegate(Army oldValue, Army newValue);
   12.12 +	public delegate void GameSystemChangedDelegate(GameSystem oldValue, GameSystem newValue);
   12.13 +	public delegate void ObjectAddDelegate(WarFoundryObject val);
   12.14 +	public delegate void ObjectRemoveDelegate(WarFoundryObject val);	
   12.15 +	public delegate void UnitAddDelegate(Unit val);
   12.16 +	public delegate void UnitRemoveDelegate(Unit val);
   12.17 +	public delegate void ObjectUpdatedDelegate(WarFoundryObject val, string updatedValName);
   12.18 +	public delegate void DoubleValChangedDelegate(WarFoundryObject obj, double oldValue, double newValue);
   12.19 +	public delegate void FloatValChangedDelegate(WarFoundryObject obj, float oldValue, float newValue);
   12.20 +	public delegate void StringValChangedDelegate(WarFoundryObject obj, string oldValue, string newValue);
   12.21 +	public delegate void IntValChangedDelegate(WarFoundryObject obj, int oldValue, int newValue);
   12.22 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/api/Factories/AbstractNativeWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    13.3 @@ -0,0 +1,282 @@
    13.4 +// WarFoundryXmlFactory.cs
    13.5 +//
    13.6 +//  Copyright (C) 2007 IBBoard
    13.7 +//
    13.8 +// This library is free software; you can redistribute it and/or
    13.9 +// modify it under the terms of the GNU Lesser General Public
   13.10 +// License version 2.1 of the License as published by the Free
   13.11 +// Software Foundation.
   13.12 +//
   13.13 +// This library is distributed in the hope that it will be useful,
   13.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   13.16 +// Lesser General Public License for more details.
   13.17 +//
   13.18 +// You should have received a copy of the GNU Lesser General Public
   13.19 +// License along with this library; if not, write to the Free Software
   13.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   13.21 +//
   13.22 +//
   13.23 +
   13.24 +using System;
   13.25 +using System.IO;
   13.26 +using System.Xml;
   13.27 +using System.Xml.Schema;
   13.28 +using System.Collections.Generic;
   13.29 +using System.Text;
   13.30 +using IBBoard;
   13.31 +using IBBoard.IO;
   13.32 +using IBBoard.Lang;
   13.33 +using IBBoard.Logging;
   13.34 +using IBBoard.Xml;
   13.35 +using IBBoard.WarFoundry.API.Objects;
   13.36 +using ICSharpCode.SharpZipLib.Zip;
   13.37 +
   13.38 +namespace IBBoard.WarFoundry.API.Factories
   13.39 +{
   13.40 +	/// <summary>
   13.41 +	/// Base abstract class for all factories that load native WarFoundry data.
   13.42 +	/// </summary>
   13.43 +	public abstract class AbstractNativeWarFoundryFactory : AbstractWarFoundryFactory<ZipFile>, INativeWarFoundryFactory
   13.44 +	{
   13.45 +		protected static readonly string SYSTEM_ZIP_IDENTIFIER = "WarFoundry_System";
   13.46 +		protected static readonly string RACE_ZIP_IDENTIFIER = "WarFoundry_Race";
   13.47 +		protected static readonly string ARMY_ZIP_IDENTIFIER = "WarFoundry_Army";
   13.48 +				
   13.49 +		protected AbstractNativeWarFoundryFactory()
   13.50 +		{
   13.51 +			//Do nothing - just make the constructor non-public
   13.52 +		}
   13.53 +		
   13.54 +		public abstract void CompleteLoading(IWarFoundryStagedLoadObject obj);
   13.55 +		
   13.56 +		protected override ZipFile GetFileAsSupportedType (FileInfo file)
   13.57 +		{
   13.58 +			ZipFile zip = null;
   13.59 +			
   13.60 +			try
   13.61 +			{
   13.62 +				zip = new ZipFile(file.FullName);
   13.63 +			}
   13.64 +			catch(ZipException ex)
   13.65 +			{
   13.66 +				//Silently dispose - we don't support the file and our other methods should handle that
   13.67 +			}
   13.68 +			
   13.69 +			return zip;
   13.70 +		}
   13.71 +		
   13.72 +		protected override bool CheckCanHandleFileFormat (ZipFile file)
   13.73 +		{
   13.74 +			bool canHandle = false;
   13.75 +			
   13.76 +			if (file!=null)
   13.77 +			{			
   13.78 +				canHandle = CheckCanHandleAsSystem(file) || CheckCanHandleAsRace(file) || CheckCanHandleAsArmy(file); 
   13.79 +			}
   13.80 +			
   13.81 +			return canHandle;
   13.82 +		}
   13.83 +		
   13.84 +		protected bool CheckCanHandleAsSystem(ZipFile file)
   13.85 +		{
   13.86 +			return file.ZipFileComment.StartsWith(SYSTEM_ZIP_IDENTIFIER) && CheckCanFindSystemFileContent(file);
   13.87 +		}
   13.88 +		
   13.89 +		protected abstract bool CheckCanFindSystemFileContent(ZipFile file);
   13.90 +		
   13.91 +		protected bool CheckCanHandleAsRace(ZipFile file)
   13.92 +		{
   13.93 +			return file.ZipFileComment.StartsWith(RACE_ZIP_IDENTIFIER) && CheckCanFindRaceFileContent(file);
   13.94 +		}
   13.95 +		
   13.96 +		protected abstract bool CheckCanFindRaceFileContent(ZipFile file);
   13.97 +		
   13.98 +		protected bool CheckCanHandleAsArmy(ZipFile file)
   13.99 +		{
  13.100 +			return file.ZipFileComment.StartsWith(ARMY_ZIP_IDENTIFIER) && CheckCanFindArmyFileContent(file);
  13.101 +		}
  13.102 +		
  13.103 +		protected abstract bool CheckCanFindArmyFileContent(ZipFile file);
  13.104 +		
  13.105 +		protected override ICollection<IWarFoundryObject> DoCreateObjectsFromFile (ZipFile file)
  13.106 +		{
  13.107 +			ICollection<IWarFoundryObject> objects = null;
  13.108 +			string comment = file.ZipFileComment;
  13.109 +			IWarFoundryObject obj = null;
  13.110 +				
  13.111 +			if (comment.StartsWith(SYSTEM_ZIP_IDENTIFIER))
  13.112 +			{
  13.113 +				obj = CreateGameSystemFromFile(file);
  13.114 +			}
  13.115 +			else if (comment.StartsWith(RACE_ZIP_IDENTIFIER))
  13.116 +			{
  13.117 +				obj = CreateRaceFromFile(file);
  13.118 +			}
  13.119 +			else if (comment.StartsWith(ARMY_ZIP_IDENTIFIER))
  13.120 +			{
  13.121 +				obj = CreateArmyFromFile(file);
  13.122 +			}
  13.123 +			
  13.124 +			if (obj!=null)
  13.125 +			{
  13.126 +				objects = new List<IWarFoundryObject>();
  13.127 +				objects.Add(obj);
  13.128 +			}
  13.129 +			
  13.130 +			return objects;
  13.131 +		}
  13.132 +
  13.133 +		
  13.134 +/*	
  13.135 +		public override bool CanHandleArmyFileFormat(FileInfo file)
  13.136 +		{
  13.137 +			bool canHandle = false;
  13.138 +			
  13.139 +			try
  13.140 +			{
  13.141 +				ZipFile zip = new ZipFile(file.FullName);
  13.142 +				canHandle = zip.ZipFileComment.StartsWith(ARMY_ZIP_IDENTIFIER) && CanHandleArmyFileFormat(zip);
  13.143 +			}
  13.144 +			catch (ZipException)
  13.145 +			{
  13.146 +				//Not a valid zip file so we can't handle it
  13.147 +			}
  13.148 +			
  13.149 +			return canHandle;
  13.150 +		}
  13.151 +		
  13.152 +		public override bool CanHandleRaceFileFormat(FileInfo file)
  13.153 +		{
  13.154 +			bool canHandle = false;
  13.155 +			
  13.156 +			try
  13.157 +			{
  13.158 +				ZipFile zip = new ZipFile(file.FullName);
  13.159 +				canHandle = zip.ZipFileComment.StartsWith(RACE_ZIP_IDENTIFIER) && CanHandleRaceFileFormat(zip);
  13.160 +			}
  13.161 +			catch (ZipException)
  13.162 +			{
  13.163 +				//Not a valid zip file so we can't handle it
  13.164 +			}
  13.165 +			
  13.166 +			return canHandle;
  13.167 +		}
  13.168 +		
  13.169 +		public override bool CanHandleSystemFileFormat(FileInfo file)
  13.170 +		{
  13.171 +			bool canHandle = false;
  13.172 +			
  13.173 +			try
  13.174 +			{
  13.175 +				ZipFile zip = new ZipFile(file.FullName);
  13.176 +				canHandle = zip.ZipFileComment.StartsWith(SYSTEM_ZIP_IDENTIFIER) && CanHandleSystemFileFormat(zip);
  13.177 +			}
  13.178 +			catch (ZipException)
  13.179 +			{
  13.180 +				//Not a valid zip file so we can't handle it
  13.181 +			}
  13.182 +			
  13.183 +			return canHandle;
  13.184 +		}
  13.185 +		
  13.186 +		public abstract bool CanHandleArmyFileFormat(ZipFile file);
  13.187 +		public abstract bool CanHandleRaceFileFormat(ZipFile file);
  13.188 +		public abstract bool CanHandleSystemFileFormat(ZipFile file);
  13.189 +		
  13.190 +		public override Army CreateArmyFromFile (FileInfo file)
  13.191 +		{
  13.192 +			try
  13.193 +			{
  13.194 +				ZipFile zip = new ZipFile(file.FullName);
  13.195 +				return CreateArmyFromFile(zip);
  13.196 +			}
  13.197 +			catch(ZipException ex)
  13.198 +			{
  13.199 +				throw new InvalidFileException(Translation.GetTranslation("InvalidArmyFileException", "Cannot get Army for file {0} as it was not a recognised Army file", file.Name), ex);
  13.200 +			}
  13.201 +		}
  13.202 +				
  13.203 +		public override Race CreateRaceFromFile (FileInfo file)
  13.204 +		{
  13.205 +			try
  13.206 +			{
  13.207 +				ZipFile zip = new ZipFile(file.FullName);
  13.208 +				return CreateRaceFromFile(zip);
  13.209 +			}
  13.210 +			catch(ZipException ex)
  13.211 +			{
  13.212 +				throw new InvalidFileException(Translation.GetTranslation("InvalidRaceFileException", "Cannot get Race for file {0} as it was not a recognised Race file", file.Name), ex);
  13.213 +			}
  13.214 +		}
  13.215 +				
  13.216 +		public override GameSystem CreateGameSystemFromFile (FileInfo file)
  13.217 +		{
  13.218 +			try
  13.219 +			{
  13.220 +				ZipFile zip = new ZipFile(file.FullName);
  13.221 +				return CreateGameSystemFromFile(zip);
  13.222 +			}
  13.223 +			catch(ZipException ex)
  13.224 +			{
  13.225 +				throw new InvalidFileException(Translation.GetTranslation("InvalidGameSystemFileException", "Cannot get Game System for file {0} as it was not a recognised Race file", file.Name), ex);
  13.226 +			}
  13.227 +		}*/
  13.228 +		
  13.229 +		protected Army CreateArmyFromFile(ZipFile file)
  13.230 +		{
  13.231 +			Army army = CreateArmyFromStream(file, GetArmyDataStream(file));
  13.232 +			//throw new InvalidFileException(Translation.GetTranslation("InvalidArmyFileException", "Cannot get Army for file {0} as it was not an Army file", file.Name));
  13.233 +			return army;
  13.234 +		}
  13.235 +		
  13.236 +		protected abstract Stream GetArmyDataStream(ZipFile file);
  13.237 +		protected abstract Army CreateArmyFromStream(ZipFile file, Stream dataStream);
  13.238 +		
  13.239 +		protected Race CreateRaceFromFile(ZipFile file)
  13.240 +		{
  13.241 +			try
  13.242 +			{
  13.243 +				Race race = CreateRaceFromStream(file, GetRaceDataStream(file));			
  13.244 +				//throw new InvalidFileException(Translation.GetTranslation("InvalidRaceFileException", "Cannot get Race for file {0} as it was not a Race file", file.Name));
  13.245 +				return race;
  13.246 +			}
  13.247 +			catch (InvalidFileException ex)
  13.248 +			{
  13.249 +				throw new InvalidFileException("Data file "+file.Name+" was not a valid race file", ex);
  13.250 +			}
  13.251 +		}
  13.252 +		
  13.253 +		protected abstract Stream GetRaceDataStream(ZipFile file);
  13.254 +		protected abstract Race CreateRaceFromStream(ZipFile file, Stream dataStream);
  13.255 +		
  13.256 +		protected GameSystem CreateGameSystemFromFile(ZipFile file)
  13.257 +		{
  13.258 +			GameSystem system = CreateGameSystemFromStream(file, GetGameSystemDataStream(file));		
  13.259 +			//throw new InvalidFileException(Translation.GetTranslation("InvalidGameSystemFileException", "Cannot get Game System for file {0} as it was not a Game System file", file.Name));
  13.260 +			return system;
  13.261 +		}
  13.262 +		
  13.263 +		protected abstract Stream GetGameSystemDataStream(ZipFile file);
  13.264 +		protected abstract GameSystem CreateGameSystemFromStream(ZipFile file, Stream dataStream);
  13.265 +		
  13.266 +		public override bool Equals (object o)
  13.267 +		{
  13.268 +			if (o == this)
  13.269 +			{
  13.270 +				return true;
  13.271 +			}
  13.272 +			else if (o == null || !(this.GetType().Equals(o.GetType())))
  13.273 +			{
  13.274 +				return false;
  13.275 +			}
  13.276 +			
  13.277 +			return true;
  13.278 +		}
  13.279 +		
  13.280 +		public override int GetHashCode ()
  13.281 +		{
  13.282 +			return GetType().FullName.GetHashCode();
  13.283 +		}
  13.284 +	}
  13.285 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/api/Factories/AbstractNonNativeFileExtensionWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    14.3 @@ -0,0 +1,64 @@
    14.4 +// AbstractNonNativeFileExtensionWarFoundryFactory.cs
    14.5 +//
    14.6 +//  Copyright (C) 2008 IBBoard
    14.7 +//
    14.8 +// This library is free software; you can redistribute it and/or
    14.9 +// modify it under the terms of the GNU Lesser General Public
   14.10 +// License as published by the Free Software Foundation; either
   14.11 +// version 2.1 of the License, or (at your option) any later version.
   14.12 +//
   14.13 +// This library is distributed in the hope that it will be useful,
   14.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   14.16 +// Lesser General Public License for more details.
   14.17 +//
   14.18 +// You should have received a copy of the GNU Lesser General Public
   14.19 +// License along with this library; if not, write to the Free Software
   14.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   14.21 +//
   14.22 +//
   14.23 +
   14.24 +using System;
   14.25 +using System.Collections.Generic;
   14.26 +using System.IO;
   14.27 +using IBBoard.WarFoundry.API.Objects;
   14.28 +
   14.29 +namespace IBBoard.WarFoundry.API.Factories
   14.30 +{	
   14.31 +	public abstract class AbstractNonNativeFileExtensionWarFoundryFactory : AbstractNonNativeWarFoundryFactory<FileInfo>
   14.32 +	{
   14.33 +		protected abstract string ArmyFileExtension { get; }
   14.34 +		protected abstract string RaceFileExtension { get; }
   14.35 +		protected abstract string GameSystemFileExtension { get; }
   14.36 +		
   14.37 +		protected override bool CheckCanHandleFileFormat (FileInfo file)
   14.38 +		{
   14.39 +			return IsArmyFile(file) || IsRaceFile(file) || IsSystemFile(file);
   14.40 +		}
   14.41 +		
   14.42 +		protected bool IsArmyFile(FileInfo file)
   14.43 +		{
   14.44 +			return ArmyFileExtension!=null && file.Name.ToLower().EndsWith(ArmyFileExtension);
   14.45 +		}
   14.46 +		
   14.47 +		protected bool IsRaceFile(FileInfo file)
   14.48 +		{
   14.49 +			return RaceFileExtension!=null && file.Name.ToLower().EndsWith(RaceFileExtension);
   14.50 +		}
   14.51 +		
   14.52 +		protected bool IsSystemFile(FileInfo file)
   14.53 +		{
   14.54 +			return GameSystemFileExtension!=null && file.Name.ToLower().EndsWith(GameSystemFileExtension);
   14.55 +		}
   14.56 +		
   14.57 +		protected override FileInfo GetFileAsSupportedType (FileInfo file)
   14.58 +		{
   14.59 +			return file;
   14.60 +		} 
   14.61 +		
   14.62 +		
   14.63 +		protected abstract Army CreateArmyFromFile(FileInfo file);
   14.64 +		protected abstract Race CreateRaceFromFile(FileInfo file);
   14.65 +		protected abstract GameSystem CreateGameSystemFromFile(FileInfo file);
   14.66 +	}
   14.67 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/api/Factories/AbstractNonNativeWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    15.3 @@ -0,0 +1,31 @@
    15.4 +// AbstractNonNativeWarFoundryFactory.cs
    15.5 +//
    15.6 +//  Copyright (C) 2008 IBBoard
    15.7 +//
    15.8 +// This library is free software; you can redistribute it and/or
    15.9 +// modify it under the terms of the GNU Lesser General Public
   15.10 +// License as published by the Free Software Foundation; either
   15.11 +// version 2.1 of the License, or (at your option) any later version.
   15.12 +//
   15.13 +// This library is distributed in the hope that it will be useful,
   15.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   15.16 +// Lesser General Public License for more details.
   15.17 +//
   15.18 +// You should have received a copy of the GNU Lesser General Public
   15.19 +// License along with this library; if not, write to the Free Software
   15.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   15.21 +//
   15.22 +//
   15.23 +
   15.24 +using System;
   15.25 +using System.IO;
   15.26 +using IBBoard.WarFoundry.API.Objects;
   15.27 +
   15.28 +namespace IBBoard.WarFoundry.API.Factories
   15.29 +{
   15.30 +	public abstract class AbstractNonNativeWarFoundryFactory<FILE_TYPE> : AbstractWarFoundryFactory<FILE_TYPE>, INonNativeWarFoundryFactory
   15.31 +	{
   15.32 +		public abstract string NonNativeDataType { get;	}
   15.33 +	}
   15.34 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/api/Factories/AbstractWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    16.3 @@ -0,0 +1,73 @@
    16.4 +// AbstractWarFoundryFactory.cs
    16.5 +//
    16.6 +//  Copyright (C) 2008 IBBoard
    16.7 +//
    16.8 +// This library is free software; you can redistribute it and/or
    16.9 +// modify it under the terms of the GNU Lesser General Public
   16.10 +// License as published by the Free Software Foundation; either
   16.11 +// version 2.1 of the License, or (at your option) any later version.
   16.12 +//
   16.13 +// This library is distributed in the hope that it will be useful,
   16.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   16.16 +// Lesser General Public License for more details.
   16.17 +//
   16.18 +// You should have received a copy of the GNU Lesser General Public
   16.19 +// License along with this library; if not, write to the Free Software
   16.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   16.21 +//
   16.22 +//
   16.23 +
   16.24 +using System;
   16.25 +using System.IO;
   16.26 +using System.Collections.Generic;
   16.27 +using IBBoard.WarFoundry.API.Objects;
   16.28 +
   16.29 +namespace IBBoard.WarFoundry.API.Factories
   16.30 +{
   16.31 +	public abstract class AbstractWarFoundryFactory<FILE_TYPE> : IWarFoundryFactory
   16.32 +	{
   16.33 +		public bool CanHandleFileFormat (FileInfo file)
   16.34 +		{
   16.35 +			return CheckCanHandleFileFormat(GetFileAsSupportedType(file));
   16.36 +		}
   16.37 +		
   16.38 +		/// <summary>
   16.39 +		/// Converts the <see cref="FileInfo"/> object in to the appropriate type for this class so that it can perform its checks. If no conversion is required (the test can be performed on a <see cref="FileInfo"/> object) the object should be returned with no modification. 
   16.40 +		/// </summary>
   16.41 +		/// <param name="file">
   16.42 +		/// A <see cref="FileInfo"/> to get the supported source object from.
   16.43 +		/// </param>
   16.44 +		/// <returns>
   16.45 +		/// An object of type <see cref="FILE_TYPE"/> that has been converted from the input <see cref="FileInfo"/> object, or <code>null</code> if the conversion cannot be made.
   16.46 +		/// </returns>
   16.47 +		protected abstract FILE_TYPE GetFileAsSupportedType(FileInfo file);
   16.48 +		
   16.49 +		/// <summary>
   16.50 +		/// Checks whether the factory thinks it can load data from the file in its paramaterised type.
   16.51 +		/// </summary>
   16.52 +		/// <param name="file">
   16.53 +		/// An object of the converted <see cref="FILE_TYPE"/> to check support for
   16.54 +		/// </param>
   16.55 +		/// <returns>
   16.56 +		/// <code>true</code> if the factory thinks it can support the file, else <code>false</code>
   16.57 +		/// </returns>
   16.58 +		protected abstract bool CheckCanHandleFileFormat(FILE_TYPE file);
   16.59 +		
   16.60 +		public ICollection<IWarFoundryObject> CreateObjectsFromFile(FileInfo file)
   16.61 +		{
   16.62 +			return DoCreateObjectsFromFile(GetFileAsSupportedType(file));
   16.63 +		}
   16.64 +		
   16.65 +		/// <summary>
   16.66 +		/// Reads the data from the supplied converted <see cref="FILE_TYPE"/> object and returns it as a collection of loadable objects.
   16.67 +		/// </summary>
   16.68 +		/// <param name="file">
   16.69 +		/// An object of the converted <see cref="FILE_TYPE"/> for the file to load data from
   16.70 +		/// </param>
   16.71 +		/// <returns>
   16.72 +		/// A <see cref="ICollection`1"/> of <see cref="IWarFoundryObject"/>s that were loaded from the file object
   16.73 +		/// </returns>
   16.74 +		protected abstract ICollection<IWarFoundryObject> DoCreateObjectsFromFile(FILE_TYPE file);
   16.75 +	}
   16.76 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/api/Factories/INativeWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    17.3 @@ -0,0 +1,29 @@
    17.4 +// INativeFactory.cs
    17.5 +//
    17.6 +//  Copyright (C) 2008 IBBoard
    17.7 +//
    17.8 +// This library is free software; you can redistribute it and/or
    17.9 +// modify it under the terms of the GNU Lesser General Public
   17.10 +// License as published by the Free Software Foundation; either
   17.11 +// version 2.1 of the License, or (at your option) any later version.
   17.12 +//
   17.13 +// This library is distributed in the hope that it will be useful,
   17.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   17.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   17.16 +// Lesser General Public License for more details.
   17.17 +//
   17.18 +// You should have received a copy of the GNU Lesser General Public
   17.19 +// License along with this library; if not, write to the Free Software
   17.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   17.21 +//
   17.22 +//
   17.23 +
   17.24 +using System;
   17.25 +
   17.26 +namespace IBBoard.WarFoundry.API.Factories
   17.27 +{
   17.28 +	public interface INativeWarFoundryFactory : IWarFoundryFactory
   17.29 +	{
   17.30 +		//Marker interface
   17.31 +	}
   17.32 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/api/Factories/INonNativeWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    18.3 @@ -0,0 +1,29 @@
    18.4 +// INonNativeFactory.cs
    18.5 +//
    18.6 +//  Copyright (C) 2008 IBBoard
    18.7 +//
    18.8 +// This library is free software; you can redistribute it and/or
    18.9 +// modify it under the terms of the GNU Lesser General Public
   18.10 +// License as published by the Free Software Foundation; either
   18.11 +// version 2.1 of the License, or (at your option) any later version.
   18.12 +//
   18.13 +// This library is distributed in the hope that it will be useful,
   18.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   18.16 +// Lesser General Public License for more details.
   18.17 +//
   18.18 +// You should have received a copy of the GNU Lesser General Public
   18.19 +// License along with this library; if not, write to the Free Software
   18.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   18.21 +//
   18.22 +//
   18.23 +
   18.24 +using System;
   18.25 +
   18.26 +namespace IBBoard.WarFoundry.API.Factories
   18.27 +{
   18.28 +	public interface INonNativeWarFoundryFactory : IWarFoundryFactory
   18.29 +	{
   18.30 +		string NonNativeDataType { get; } 
   18.31 +	}
   18.32 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/api/Factories/IWarFoundryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    19.3 @@ -0,0 +1,52 @@
    19.4 +// IWarFoundryFactory.cs
    19.5 +//
    19.6 +//  Copyright (C) 2008 IBBoard
    19.7 +//
    19.8 +// This library is free software; you can redistribute it and/or
    19.9 +// modify it under the terms of the GNU Lesser General Public
   19.10 +// License as published by the Free Software Foundation; either
   19.11 +// version 2.1 of the License, or (at your option) any later version.
   19.12 +//
   19.13 +// This library is distributed in the hope that it will be useful,
   19.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   19.16 +// Lesser General Public License for more details.
   19.17 +//
   19.18 +// You should have received a copy of the GNU Lesser General Public
   19.19 +// License along with this library; if not, write to the Free Software
   19.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   19.21 +//
   19.22 +//
   19.23 +
   19.24 +using System;
   19.25 +using System.IO;
   19.26 +using System.Collections.Generic;
   19.27 +using IBBoard.WarFoundry.API.Objects;
   19.28 +
   19.29 +namespace IBBoard.WarFoundry.API.Factories
   19.30 +{
   19.31 +	public interface IWarFoundryFactory
   19.32 +	{
   19.33 +		/// <summary>
   19.34 +		/// Checks if the factory thinks it can handle the supplied file. Checks can be performed on file extension or some basic check of file content, or some other method.
   19.35 +		/// </summary>
   19.36 +		/// <param name="file">
   19.37 +		/// A <see cref="FileInfo"/> for the file to check support for.
   19.38 +		/// </param>
   19.39 +		/// <returns>
   19.40 +		/// <code>true</code> if the file appears to be supported for loading by this factory, else returns <code>false</code>
   19.41 +		/// </returns>
   19.42 +		bool CanHandleFileFormat(FileInfo file);	
   19.43 +		
   19.44 +		/// <summary>
   19.45 +		/// Reads the data from the supplied file and returns it as a collection of loadable objects.
   19.46 +		/// </summary>
   19.47 +		/// <param name="file">
   19.48 +		/// A <see cref="FileInfo"/> for the file to load data from
   19.49 +		/// </param>
   19.50 +		/// <returns>
   19.51 +		/// A <see cref="ICollection`1"/> of <see cref="IWarFoundryObject"/>s that were loaded from the file
   19.52 +		/// </returns>
   19.53 +		ICollection<IWarFoundryObject> CreateObjectsFromFile(FileInfo file);
   19.54 +	}
   19.55 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/api/Factories/WarFoundryFactoryFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    20.3 @@ -0,0 +1,117 @@
    20.4 +// AbstractNativeWarFoundryFactory.cs
    20.5 +//
    20.6 +//  Copyright (C) 2007 IBBoard
    20.7 +//
    20.8 +// This library is free software; you can redistribute it and/or
    20.9 +// modify it under the terms of the GNU Lesser General Public
   20.10 +// License version 2.1 of the License as published by the Free
   20.11 +// Software Foundation.
   20.12 +//
   20.13 +// This library is distributed in the hope that it will be useful,
   20.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   20.16 +// Lesser General Public License for more details.
   20.17 +//
   20.18 +// You should have received a copy of the GNU Lesser General Public
   20.19 +// License along with this library; if not, write to the Free Software
   20.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   20.21 +//
   20.22 +//
   20.23 +
   20.24 +using System;
   20.25 +using System.Collections.Generic;
   20.26 +using System.Reflection;
   20.27 +using IBBoard;
   20.28 +using IBBoard.Logging;
   20.29 +
   20.30 +namespace IBBoard.WarFoundry.API.Factories
   20.31 +{
   20.32 +	public class WarFoundryFactoryFactory
   20.33 +	{
   20.34 +		private Dictionary<Type, IWarFoundryFactory> factories = new Dictionary<Type, IWarFoundryFactory>();
   20.35 +		private Type defaultType;
   20.36 +		private static WarFoundryFactoryFactory factoryFactory;
   20.37 +		
   20.38 +		private WarFoundryFactoryFactory()
   20.39 +		{
   20.40 +		}
   20.41 +		
   20.42 +		public static WarFoundryFactoryFactory GetFactoryFactory()
   20.43 +		{
   20.44 +			if (factoryFactory == null)
   20.45 +			{
   20.46 +				factoryFactory = new WarFoundryFactoryFactory();
   20.47 +			}
   20.48 +			
   20.49 +			return factoryFactory;
   20.50 +		}
   20.51 +		
   20.52 +		public IWarFoundryFactory GetFactory()
   20.53 +		{
   20.54 +			return GetFactory(DefaultType);
   20.55 +		}
   20.56 +		
   20.57 +		public IWarFoundryFactory GetFactory(Type cls)
   20.58 +		{
   20.59 +			cls = CheckType(cls);
   20.60 +			
   20.61 +			IWarFoundryFactory factory = null;	
   20.62 +			factories.TryGetValue(cls, out factory);
   20.63 +			
   20.64 +			if (factory == null)
   20.65 +			{
   20.66 +				factory = null;
   20.67 +				MethodInfo method = cls.GetMethod("CreateFactory");
   20.68 +				
   20.69 +				if (method!=null)
   20.70 +				{
   20.71 +					LogNotifier.Debug(GetType(), "Found CreateFactory method on " + cls.Name);
   20.72 +					object temp = method.Invoke(null, new object[]{});
   20.73 +					
   20.74 +					if (temp is IWarFoundryFactory)
   20.75 +					{
   20.76 +						factory = (IWarFoundryFactory)temp; 
   20.77 +						factories.Add(cls, factory);
   20.78 +					}
   20.79 +				}
   20.80 +			
   20.81 +				if (factory == null)
   20.82 +				{
   20.83 +					throw new ArgumentException("Could not create factory for class "+cls.FullName);
   20.84 +				}
   20.85 +			}
   20.86 +		
   20.87 +			return factory;
   20.88 +		}
   20.89 +		
   20.90 +		public Type DefaultType
   20.91 +		{
   20.92 +			get { return defaultType; }
   20.93 +			set {
   20.94 +				value = CheckType(value);
   20.95 +				defaultType = value;
   20.96 +			}
   20.97 +		}
   20.98 +		
   20.99 +		private Type CheckType(Type cls)
  20.100 +		{
  20.101 +			if (cls == null)
  20.102 +			{
  20.103 +				if (DefaultType!=null)
  20.104 +				{
  20.105 +					return DefaultType;
  20.106 +				}
  20.107 +				else
  20.108 +				{
  20.109 +					throw new InvalidOperationException("Class cannot be null when no default class is set");
  20.110 +				}
  20.111 +			}
  20.112 +			else if (!typeof(IWarFoundryFactory).IsAssignableFrom(cls))
  20.113 +			{
  20.114 +				throw new ArgumentException("Class "+cls.FullName+" was not a subtype of "+typeof(IWarFoundryFactory).FullName);
  20.115 +			}
  20.116 +			
  20.117 +			return cls;
  20.118 +		}
  20.119 +	}
  20.120 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/api/Factories/Xml/WarFoundryXmlElementName.cs	Fri Dec 19 15:57:51 2008 +0000
    21.3 @@ -0,0 +1,82 @@
    21.4 +// WarFoundryXmlElementNames.cs
    21.5 +//
    21.6 +//  Copyright (C) 2007 IBBoard
    21.7 +//
    21.8 +// This library is free software; you can redistribute it and/or
    21.9 +// modify it under the terms of the GNU Lesser General Public
   21.10 +// License as published by the Free Software Foundation; either
   21.11 +// version 2.1 of the License, or (at your option) any later version.
   21.12 +//
   21.13 +// This library is distributed in the hope that it will be useful,
   21.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   21.16 +// Lesser General Public License for more details.
   21.17 +//
   21.18 +// You should have received a copy of the GNU Lesser General Public
   21.19 +// License along with this library; if not, write to the Free Software
   21.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   21.21 +//
   21.22 +//
   21.23 +
   21.24 +using System;
   21.25 +using System.Collections.Generic;
   21.26 +using IBBoard.Xml;
   21.27 +
   21.28 +namespace IBBoard.WarFoundry.API.Factories.Xml
   21.29 +{
   21.30 +	/// <summary>
   21.31 +	/// An enumeration class for valid WarFoundry XML elements, designed to imitate Java's extensible complex object enumerations. 
   21.32 +	/// </summary>
   21.33 +	public class WarFoundryXmlElementName : IXmlElementName, IExtendedEnum<string>
   21.34 +	{
   21.35 +		public static WarFoundryXmlElementName SYSTEM_ELEMENT = new WarFoundryXmlElementName("SYSTEM_ELEMENT", "system");
   21.36 +		public static WarFoundryXmlElementName ARMY_ELEMENT = new WarFoundryXmlElementName("ARMY_ELEMENT", "army");
   21.37 +		public static WarFoundryXmlElementName RACE_ELEMENT = new WarFoundryXmlElementName("RACE_ELEMENT", "race");
   21.38 +		public static WarFoundryXmlElementName CATEGORIES_ELEMENT = new WarFoundryXmlElementName("CATEGORIES_ELEMENT", "categories");
   21.39 +		public static WarFoundryXmlElementName CATEGORY_ELEMENT = new WarFoundryXmlElementName("CATEGORY_ELEMENT", "cat");
   21.40 +		public static WarFoundryXmlElementName UNITTYPES_ELEMENT = new WarFoundryXmlElementName("UNITTYPES_ELEMENT", "units");
   21.41 +		public static WarFoundryXmlElementName UNITTYPE_ELEMENT = new WarFoundryXmlElementName("UNITTYPE_ELEMENT", "unit");
   21.42 +		public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEMS_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipment");
   21.43 +		public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEM_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipmentItem");
   21.44 +		
   21.45 +		private static ICollection<WarFoundryXmlElementName> enumValues;
   21.46 +		private string name;
   21.47 +		private string val;
   21.48 +		
   21.49 +		private WarFoundryXmlElementName(string elemName, string elemVal)
   21.50 +		{
   21.51 +			name = elemName;
   21.52 +			val = elemVal;
   21.53 +		}
   21.54 +		
   21.55 +		public string Name
   21.56 +		{
   21.57 +			get {
   21.58 +				return name;
   21.59 +			}
   21.60 +		}
   21.61 +		
   21.62 +		public string Value
   21.63 +		{
   21.64 +			get {
   21.65 +				return val;
   21.66 +			}
   21.67 +		}
   21.68 +		
   21.69 +		/// <summary>
   21.70 +		/// Gets an ICollection of the values so that they can be looped over like a standard enumeration.
   21.71 +		/// </summary>
   21.72 +		/// <returns>
   21.73 +		/// A <see cref="ICollection`1"/> of all of the static 'enumeration' values of the class.
   21.74 +		/// </returns>
   21.75 +		public static ICollection<WarFoundryXmlElementName> GetEnumValues()
   21.76 +		{
   21.77 +			if (enumValues == null)
   21.78 +			{
   21.79 +				enumValues = new WarFoundryXmlElementName[]{SYSTEM_ELEMENT, ARMY_ELEMENT, RACE_ELEMENT, CATEGORIES_ELEMENT, CATEGORY_ELEMENT, UNITTYPES_ELEMENT, UNITTYPE_ELEMENT};
   21.80 +			}
   21.81 +			
   21.82 +			return enumValues;
   21.83 +		}
   21.84 +	}
   21.85 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/api/Factories/Xml/WarFoundryXmlFactory.cs	Fri Dec 19 15:57:51 2008 +0000
    22.3 @@ -0,0 +1,696 @@
    22.4 +// WarFoundryXmlFactory.cs
    22.5 +//
    22.6 +//  Copyright (C) 2007 IBBoard
    22.7 +//
    22.8 +// This library is free software; you can redistribute it and/or
    22.9 +// modify it under the terms of the GNU Lesser General Public
   22.10 +// License version 2.1 of the License as published by the Free
   22.11 +// Software Foundation.
   22.12 +//
   22.13 +// This library is distributed in the hope that it will be useful,
   22.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   22.16 +// Lesser General Public License for more details.
   22.17 +//
   22.18 +// You should have received a copy of the GNU Lesser General Public
   22.19 +// License along with this library; if not, write to the Free Software
   22.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   22.21 +//
   22.22 +//
   22.23 +
   22.24 +using System;
   22.25 +using System.IO;
   22.26 +using System.Xml;
   22.27 +using System.Xml.Schema;
   22.28 +using System.Collections.Generic;
   22.29 +using System.Text;
   22.30 +using IBBoard;
   22.31 +using IBBoard.IO;
   22.32 +using IBBoard.Lang;
   22.33 +using IBBoard.Logging;
   22.34 +using IBBoard.Xml;
   22.35 +using IBBoard.WarFoundry.API.Requirements;
   22.36 +using IBBoard.WarFoundry.API.Objects;
   22.37 +using ICSharpCode.SharpZipLib.Zip;
   22.38 +
   22.39 +namespace IBBoard.WarFoundry.API.Factories.Xml
   22.40 +{
   22.41 +	/// <summary>
   22.42 +	/// Summary description for WarFoundryXmlFactory.
   22.43 +	/// </summary>
   22.44 +	public class WarFoundryXmlFactory : AbstractNativeWarFoundryFactory
   22.45 +	{
   22.46 +		private Dictionary<IWarFoundryObject, XmlDocument> extraData = new Dictionary<IWarFoundryObject, XmlDocument>();
   22.47 +		private XmlResolver xmlResolver;
   22.48 +
   22.49 +		public static AbstractNativeWarFoundryFactory CreateFactory()
   22.50 +		{
   22.51 +			return new WarFoundryXmlFactory();
   22.52 +		}
   22.53 +		
   22.54 +		protected WarFoundryXmlFactory() : base()
   22.55 +		{
   22.56 +			xmlResolver = new IBBXmlResolver(Constants.ExecutablePath);
   22.57 +		}
   22.58 +		
   22.59 +		protected override bool CheckCanFindArmyFileContent(ZipFile file)
   22.60 +		{
   22.61 +			return file.FindEntry("data.armyx", true) > -1;
   22.62 +		}
   22.63 +		
   22.64 +		protected override bool CheckCanFindSystemFileContent(ZipFile file)
   22.65 +		{
   22.66 +			return file.FindEntry("data.systemx", true) > -1;
   22.67 +		}
   22.68 +		
   22.69 +		protected override bool CheckCanFindRaceFileContent(ZipFile file)
   22.70 +		{
   22.71 +			return file.FindEntry("data.racex", true) > -1;
   22.72 +		}
   22.73 +		
   22.74 +		protected XmlElement GetRootElementFromStream(Stream stream, WarFoundryXmlElementName elementName)
   22.75 +		{
   22.76 +			XmlDocument doc = CreateXmlDocumentFromStream(stream);			
   22.77 +			XmlElement elem = (XmlElement)doc.LastChild;
   22.78 +			
   22.79 +			if (!elem.Name.Equals(elementName.Value))
   22.80 +			{
   22.81 +				throw new InvalidFileException(String.Format("Root element of XML was not valid. Expected {0} but got {1}", elementName.Value, elem.Name));
   22.82 +			}
   22.83 +			
   22.84 +			return elem;
   22.85 +		}
   22.86 +		
   22.87 +		protected override Stream GetArmyDataStream(ZipFile file)
   22.88 +		{
   22.89 +			return file.GetInputStream(file.FindEntry("data.armyx", true));
   22.90 +		}
   22.91 +		
   22.92 +		protected override Army CreateArmyFromStream (ZipFile file, Stream dataStream)
   22.93 +		{
   22.94 +			XmlElement elem = GetRootElementFromStream(dataStream, WarFoundryXmlElementName.ARMY_ELEMENT);
   22.95 +			return CreateArmyFromElement(file, elem);
   22.96 +		}
   22.97 +		
   22.98 +		private Army CreateArmyFromElement(ZipFile file, XmlElement elem)
   22.99 +		{
  22.100 +			string name = elem.GetAttribute("name");
  22.101 +			string systemID = elem.GetAttribute("gameSystem");
  22.102 +			GameSystem system = WarFoundryLoader.GetDefault().GetGameSystem(systemID);
  22.103 +			string raceID = elem.GetAttribute("race");
  22.104 +			Race race = WarFoundryLoader.GetDefault().GetRace(system, raceID);
  22.105 +			string pointsString = elem.GetAttribute("maxPoints");
  22.106 +			int points = 0;
  22.107 +			
  22.108 +			try
  22.109 +			{
  22.110 +				points = int.Parse(pointsString);
  22.111 +			}
  22.112 +			catch(FormatException)
  22.113 +			{
  22.114 +				throw new FormatException("Attribute 'maxPoints' of army '"+name+"' was not a valid number");
  22.115 +			}
  22.116 +			
  22.117 +			Army army = new Army(race, name, points, file);//, this);
  22.118 +			extraData[army] = elem.OwnerDocument;
  22.119 +			return army;
  22.120 +		}
  22.121 +
  22.122 +		protected override Stream GetGameSystemDataStream (ZipFile file)
  22.123 +		{
  22.124 +			return file.GetInputStream(file.FindEntry("data.systemx", true));
  22.125 +		}
  22.126 +		
  22.127 +		protected override GameSystem CreateGameSystemFromStream (ZipFile file, Stream dataStream)
  22.128 +		{
  22.129 +			XmlElement elem = GetRootElementFromStream(dataStream, WarFoundryXmlElementName.SYSTEM_ELEMENT);
  22.130 +			LogNotifier.Debug(GetType(), "Create GameSystem");
  22.131 +			return CreateSystemFromElement(file, elem);
  22.132 +		}
  22.133 +		
  22.134 +		private GameSystem CreateSystemFromElement(ZipFile file, XmlElement elem)
  22.135 +		{
  22.136 +			string id = elem.GetAttribute("id");
  22.137 +			string name = elem.GetAttribute("name");
  22.138 +			GameSystem system = new StagedLoadingGameSystem(id, name, this);
  22.139 +			//system.SourceZipFile = file.;
  22.140 +			extraData[system] = elem.OwnerDocument;
  22.141 +			return system;
  22.142 +		}
  22.143 +		
  22.144 +		protected override Stream GetRaceDataStream (ZipFile file)
  22.145 +		{
  22.146 +			return file.GetInputStream(file.FindEntry("data.racex", true));
  22.147 +		}
  22.148 +		
  22.149 +		protected override Race CreateRaceFromStream (ZipFile file, Stream dataStream)
  22.150 +		{
  22.151 +			XmlElement elem = GetRootElementFromStream(dataStream, WarFoundryXmlElementName.RACE_ELEMENT);
  22.152 +			LogNotifier.Debug(GetType(), "Create Race");
  22.153 +			return CreateRaceFromElement(file, elem);
  22.154 +		}
  22.155 +		
  22.156 +		private Race CreateRaceFromElement(ZipFile file, XmlElement elem)
  22.157 +		{
  22.158 +			string id = elem.GetAttribute("id");
  22.159 +			string subid = elem.GetAttribute("subid");
  22.160 +			string systemID = elem.GetAttribute("system");
  22.161 +			string name = elem.GetAttribute("name");
  22.162 +			Race race = new StagedLoadingRace(id, subid, name, systemID, this);
  22.163 +			//race.SourceZipFile = file; //TODO reference source file
  22.164 +			extraData[race] = elem.OwnerDocument;
  22.165 +			return race;
  22.166 +		}
  22.167 +
  22.168 +		/*public WarFoundryObject CreateObjectFromStream(ZipFile file, Stream stream)
  22.169 +		{
  22.170 +			try
  22.171 +			{
  22.172 +				WarFoundryObject obj = LoadFileObjectFromElement(file, elem);
  22.173 +				
  22.174 +				if (obj != null)
  22.175 +				{			
  22.176 +					extraData[obj] = doc;
  22.177 +					return obj;
  22.178 +				}
  22.179 +				else
  22.180 +				{
  22.181 +					throw new InvalidFileException(String.Format(Translation.GetTranslation("ErrorInvalidXmlFile", "XML file '{0}' was not a loadable XML file. Please ensure it is a valid and supported WarFoundry XML file."), file.Name));
  22.182 +				}
  22.183 +			}
  22.184 +			catch (XmlSchemaException ex)
  22.185 +			{
  22.186 +				throw new InvalidFileException(String.Format(Translation.GetTranslation("ErrorInvalidXmlFile", "Failed to parse invalid XML data file in {0}. Error at line {1} position {2}: {3}"), file.Name, ex.LineNumber, ex.LinePosition, ex.Message.Substring(0, ex.Message.IndexOf(".")+1)), ex);
  22.187 +			}
  22.188 +			catch (InvalidFileException ex)
  22.189 +			{
  22.190 +				throw new InvalidFileException(String.Format(Translation.GetTranslation("ErrorInvalidNamedXmlFile", "XML data file in '{0}' was not a valid XML file. It should contain three child nodes - XML definition, DocType and root node."), file.Name), ex);
  22.191 +			}
  22.192 +		}
  22.193 +		
  22.194 +		private WarFoundryObject LoadFileObjectFromElement(ZipFile file, XmlElement elem)
  22.195 +		{
  22.196 +			WarFoundryObject obj = null;
  22.197 +				
  22.198 +			if (elem.Name.Equals(WarFoundryXmlElementName.SYSTEM_ELEMENT.Value))
  22.199 +			{
  22.200 +				logger.Debug("Create GameSystem");
  22.201 +				obj = CreateSystemFromElement(file, elem);
  22.202 +			}
  22.203 +			else if (elem.Name.Equals(WarFoundryXmlElementName.RACE_ELEMENT.Value))
  22.204 +			{
  22.205 +				logger.Debug("Create Race");
  22.206 +				obj = CreateRaceFromElement(file, elem);
  22.207 +			}
  22.208 +			
  22.209 +			return obj;
  22.210 +		}*/
  22.211 +
  22.212 +		public override void CompleteLoading(IWarFoundryStagedLoadObject obj)
  22.213 +		{		
  22.214 +			LogNotifier.DebugFormat(GetType(), "Complete loading of {0} with ID {1}", obj.GetType().Name, obj.ID);
  22.215 +				
  22.216 +			if (!obj.IsFullyLoaded)
  22.217 +			{			
  22.218 +				XmlDocument extra = extraData[obj];
  22.219 +				
  22.220 +				if (obj is GameSystem)
  22.221 +				{
  22.222 +					GameSystem system = (GameSystem)obj;
  22.223 +					XmlNode elem = extra.LastChild;
  22.224 +					
  22.225 +					XmlNode catsElem = elem.FirstChild;					
  22.226 +					Category[] cats;
  22.227 +					List<Category> catList = new List<Category>();
  22.228 +					WarFoundryObject tempObj;
  22.229 +					
  22.230 +					foreach (XmlElement cat in catsElem.ChildNodes)
  22.231 +					{
  22.232 +						tempObj = CreateObjectFromElement(cat);
  22.233 +						
  22.234 +						if (tempObj is Category)
  22.235 +						{
  22.236 +							catList.Add((Category)tempObj);
  22.237 +						}
  22.238 +						else
  22.239 +						{
  22.240 +							LogNotifier.WarnFormat(GetType(), "Object for string {0} was not of type Category", cat.OuterXml);
  22.241 +						}
  22.242 +					}
  22.243 +					
  22.244 +					cats = catList.ToArray();
  22.245 +					LogNotifier.DebugFormat(GetType(), "Found {0} categories", cats.Length);
  22.246 +					
  22.247 +					XmlElement statsElem = (XmlElement)catsElem.NextSibling;					
  22.248 +					Dictionary<string, SystemStats> sysStats = CreateSystemStatsSetFromElement(statsElem);
  22.249 +					string defaultStatsID = statsElem.GetAttribute("defaultStats");
  22.250 +										
  22.251 +					LogNotifier.DebugFormat(GetType(), "Complete loading of {0}", system.Name);
  22.252 +					system.Categories = cats;
  22.253 +					system.SystemStats = new SystemStatsSet(sysStats); 
  22.254 +					system.StandardSystemStatsID = defaultStatsID;
  22.255 +				}
  22.256 +				else if (obj is Race)
  22.257 +				{
  22.258 +					Race race = (Race)obj;
  22.259 +					XmlNode elem = extra.LastChild;
  22.260 +					XmlNode colNode = elem.FirstChild;
  22.261 +					
  22.262 +					Dictionary<string, UnitType> unitTypes = new Dictionary<string, UnitType>();
  22.263 +					
  22.264 +					foreach (XmlElement node in colNode.ChildNodes)
  22.265 +					{
  22.266 +						UnitType type = CreateUnitTypeFromElement(node, race, race.GameSystem);
  22.267 +						unitTypes.Add(type.ID, type);
  22.268 +					}
  22.269 +					
  22.270 +					colNode = colNode.NextSibling;
  22.271 +					List<Category> catOverrides = new List<Category>();
  22.272 +					
  22.273 +					if (colNode!=null && colNode.Name == WarFoundryXmlElementName.CATEGORIES_ELEMENT.Value)
  22.274 +					{
  22.275 +						foreach (XmlElement node in colNode.ChildNodes)
  22.276 +						{
  22.277 +							catOverrides.Add(CreateCategoryFromElement(node));
  22.278 +						}
  22.279 +						
  22.280 +						colNode = colNode.NextSibling;
  22.281 +					}
  22.282 +						
  22.283 +					Dictionary<string, EquipmentItem> raceEquipment = new Dictionary<string, EquipmentItem>();
  22.284 +					
  22.285 +					if (colNode!=null && colNode.Name == WarFoundryXmlElementName.RACE_EQUIPMENT_ITEMS_ELEMENT.Value)
  22.286 +					{
  22.287 +						foreach (XmlElement node in colNode.ChildNodes)
  22.288 +						{
  22.289 +							EquipmentItem item = CreateEquipmentItemFromElement(node, race);
  22.290 +							raceEquipment.Add(item.ID, item);
  22.291 +						}
  22.292 +					}
  22.293 +					
  22.294 +					Dictionary<string, Ability> raceAbilities = new Dictionary<string, Ability>();
  22.295 +					//TODO: Load abilities
  22.296 +					
  22.297 +					LogNotifier.DebugFormat(GetType(), "Complete loading of {0}", race.Name);
  22.298 +					race.Categories = catOverrides.ToArray();
  22.299 +					race.SetUnitTypes(unitTypes);
  22.300 +					race.SetEquipmentItems(raceEquipment);
  22.301 +					race.SetAbilities(raceAbilities);
  22.302 +				}
  22.303 +			}
  22.304 +			else
  22.305 +			{
  22.306 +				LogNotifier.Debug(GetType(), "Object is already fully loaded");
  22.307 +			}
  22.308 +		}
  22.309 +		
  22.310 +		protected XmlDocument CreateXmlDocumentFromStream(Stream stream)
  22.311 +		{
  22.312 +			XmlDocument doc = new XmlDocument();
  22.313 +			XmlReaderSettings settings = new XmlReaderSettings();
  22.314 +			settings.XmlResolver = xmlResolver;
  22.315 +			settings.ValidationType = ValidationType.DTD;
  22.316 +			settings.ProhibitDtd = false;
  22.317 +			settings.ValidationEventHandler+= new ValidationEventHandler(ValidationEventMethod);
  22.318 +			XmlReader reader = XmlReader.Create(stream, settings);
  22.319 +			
  22.320 +			try
  22.321 +			{
  22.322 +				doc.Load(reader);			
  22.323 +			}
  22.324 +			//Don't catch XMLSchemaExceptions - let them get thrown out
  22.325 +			finally
  22.326 +			{
  22.327 +				reader.Close();
  22.328 +			}
  22.329 +			
  22.330 +			if (doc.ChildNodes.Count!=3)
  22.331 +			{
  22.332 +				throw new InvalidFileException(Translation.GetTranslation("ErrorInvalidXmlFile", "XML file was not a valid XML file. It should contain three child nodes - XML definition, DocType and root node."));
  22.333 +			}
  22.334 +
  22.335 +			return doc;
  22.336 +		}
  22.337 +
  22.338 +		protected XmlDocument CreateXmlDocumentFromString(string xmlString)
  22.339 +		{			
  22.340 +			XmlReaderSettings settings = new XmlReaderSettings();
  22.341 +			settings.XmlResolver = xmlResolver;
  22.342 +			settings.ValidationType = ValidationType.DTD;
  22.343 +			settings.ProhibitDtd = false;
  22.344 +			settings.ValidationEventHandler+= new ValidationEventHandler(ValidationEventMethod);
  22.345 +			XmlReader reader = XmlReader.Create(new MemoryStream(Encoding.UTF8.GetBytes(xmlString)), settings);
  22.346 +			XmlDocument doc = new XmlDocument();
  22.347 +
  22.348 +			try
  22.349 +			{
  22.350 +				doc.Load(reader);
  22.351 +			}
  22.352 +			catch(XmlSchemaException ex)
  22.353 +			{
  22.354 +				throw new InvalidFileException(Translation.GetTranslation("ErrorInvalidXmlString", "Failed to parse invalid XML string"), ex);
  22.355 +			}
  22.356 +			finally
  22.357 +			{
  22.358 +				//We might not need to make sure the memory stream is closed, but do it just in case
  22.359 +				reader.Close();
  22.360 +			}
  22.361 +			
  22.362 +			if (doc.ChildNodes.Count!=3)
  22.363 +			{
  22.364 +				throw new InvalidFileException(String.Format(Translation.GetTranslation("ErrorInvalidXmlFile", "XML string was not a valid XML file. It should contain three child nodes - XML definition, DocType and root node.")));
  22.365 +			}
  22.366 +
  22.367 +			return doc;
  22.368 +		}
  22.369 +					
  22.370 +		private WarFoundryObject CreateObjectFromElement(XmlElement elem)
  22.371 +		{
  22.372 +			WarFoundryObject obj = null;
  22.373 +			LogNotifier.DebugFormat(GetType(), "Create object for <{0}>", elem.Name);
  22.374 +			
  22.375 +			if (elem.Name.Equals(WarFoundryXmlElementName.CATEGORY_ELEMENT.Value))
  22.376 +			{
  22.377 +				LogNotifier.Debug(GetType(), "Create Category");
  22.378 +				obj = CreateCategoryFromElement(elem);
  22.379 +			}
  22.380 +			else
  22.381 +			{
  22.382 +				LogNotifier.Debug(GetType(), "No match");
  22.383 +			}
  22.384 +			
  22.385 +			return obj;
  22.386 +		}
  22.387 +		
  22.388 +		private Category CreateCategoryFromElement(XmlElement elem)
  22.389 +		{
  22.390 +			string id = elem.GetAttribute("id");
  22.391 +			string name = elem.GetAttribute("name");
  22.392 +			int minPc, maxPc, minPts, maxPts, minChoices, maxChoices, baseValue, incValue, incAmount;
  22.393 +			
  22.394 +			try
  22.395 +			{
  22.396 +				minPc = int.Parse(elem.GetAttribute("minPercentage"));
  22.397 +			}
  22.398 +			catch(FormatException)
  22.399 +			{
  22.400 +				throw new FormatException("Attribute 'minPercentage' of category "+id+" was not a valid number");
  22.401 +			}
  22.402 +
  22.403 +			try
  22.404 +			{
  22.405 +				maxPc = int.Parse(elem.GetAttribute("maxPercentage"));
  22.406 +			}
  22.407 +			catch(FormatException)
  22.408 +			{
  22.409 +				throw new FormatException("Attribute 'maxPercentage' of category "+id+" was not a valid number");
  22.410 +			}
  22.411 +			
  22.412 +			try
  22.413 +			{
  22.414 +				minPts = int.Parse(elem.GetAttribute("minPoints"));
  22.415 +			}
  22.416 +			catch(FormatException)
  22.417 +			{
  22.418 +				throw new FormatException("Attribute 'minPoints' of category "+id+" was not a valid number");
  22.419 +			}
  22.420 +
  22.421 +			try
  22.422 +			{
  22.423 +				maxPts = int.Parse(elem.GetAttribute("maxPoints"));
  22.424 +			}
  22.425 +			catch(FormatException)
  22.426 +			{
  22.427 +				throw new FormatException("Attribute 'maxPoints' of category "+id+" was not a valid number");
  22.428 +			}
  22.429 +			
  22.430 +			try
  22.431 +			{
  22.432 +				minChoices = int.Parse(elem.GetAttribute("minChoices"));
  22.433 +			}
  22.434 +			catch(FormatException)
  22.435 +			{
  22.436 +				throw new FormatException("Attribute 'minChoices' of category "+id+" was not a valid number");
  22.437 +			}
  22.438 +
  22.439 +			try
  22.440 +			{
  22.441 +				maxChoices = int.Parse(elem.GetAttribute("maxChoices"));
  22.442 +			}
  22.443 +			catch(FormatException)
  22.444 +			{
  22.445 +				throw new FormatException("Attribute 'maxChoices' of category "+id+" was not a valid number");
  22.446 +			}
  22.447 +
  22.448 +			try
  22.449 +			{
  22.450 +				baseValue = int.Parse(elem.GetAttribute("baseValue"));
  22.451 +			
  22.452 +			}
  22.453 +			catch(FormatException)
  22.454 +			{
  22.455 +				throw new FormatException("Attribute 'baseValue' of category "+id+" was not a valid number");
  22.456 +			}
  22.457 +			
  22.458 +			try
  22.459 +			{
  22.460 +				incValue = int.Parse(elem.GetAttribute("incValue"));
  22.461 +			}
  22.462 +			catch(FormatException)
  22.463 +			{
  22.464 +				throw new FormatException("Attribute 'incValue' of category "+id+" was not a valid number");
  22.465 +			}
  22.466 +
  22.467 +			try
  22.468 +			{
  22.469 +				incAmount = int.Parse(elem.GetAttribute("incAmount"));
  22.470 +			}
  22.471 +			catch(FormatException)
  22.472 +			{
  22.473 +				throw new FormatException("Attribute 'incAmount' of category "+id+" was not a valid number");
  22.474 +			}
  22.475 +			
  22.476 +			return new Category(id, name, minPts, maxPts, minPc, maxPc, minChoices, maxChoices, baseValue, incValue, incAmount);
  22.477 +		}
  22.478 +						
  22.479 +		private UnitType CreateUnitTypeFromElement(XmlElement elem, Race parentRace, GameSystem system)
  22.480 +		{
  22.481 +			string id = elem.GetAttribute("id");
  22.482 +			string name = elem.GetAttribute("typeName");
  22.483 +			string mainCatID = elem.GetAttribute("cat");
  22.484 +			int minNum, maxNum, minSize, maxSize, baseSize;//TODO: Add base size
  22.485 +			float points, unitPoints;
  22.486 +			Stats stats;
  22.487 +			List<UnitRequirement> unitRequirements = new List<UnitRequirement>();
  22.488 +			bool found = false;
  22.489 +			List<string> catIDs = new List<string>();
  22.490 +			string catID;
  22.491 +			
  22.492 +			try
  22.493 +			{
  22.494 +				minNum = int.Parse(elem.GetAttribute("minNum"));
  22.495 +			}
  22.496 +			catch(FormatException)
  22.497 +			{
  22.498 +				throw new FormatException("Attribute 'minNum' of unit "+id+" was not a valid number");
  22.499 +			}
  22.500 +			
  22.501 +			try
  22.502 +			{
  22.503 +				maxNum = int.Parse(elem.GetAttribute("maxNum"));
  22.504 +			}
  22.505 +			catch(FormatException)
  22.506 +			{
  22.507 +				throw new FormatException("Attribute 'maxNum' of unit "+id+" was not a valid number");
  22.508 +			}
  22.509 +			
  22.510 +			try
  22.511 +			{
  22.512 +				minSize = int.Parse(elem.GetAttribute("minSize"));
  22.513 +			}
  22.514 +			catch(FormatException)
  22.515 +			{
  22.516 +				throw new FormatException("Attribute 'minSize' of unit "+id+" was not a valid number");
  22.517 +			}
  22.518 +			
  22.519 +			try
  22.520 +			{
  22.521 +				maxSize = int.Parse(elem.GetAttribute("maxSize"));
  22.522 +			}
  22.523 +			catch(FormatException)
  22.524 +			{
  22.525 +				throw new FormatException("Attribute 'maxSize' of unit "+id+" was not a valid number");
  22.526 +			}
  22.527 +			
  22.528 +			if (minSize > maxSize && maxSize!=-1)
  22.529 +			{
  22.530 +				minSize = maxSize;
  22.531 +			}
  22.532 +			
  22.533 +			try
  22.534 +			{
  22.535 +				points = int.Parse(elem.GetAttribute("points"));
  22.536 +			}
  22.537 +			catch(FormatException)
  22.538 +			{
  22.539 +				throw new FormatException("Attribute 'points' of unit "+id+" was not a valid number");
  22.540 +			}
  22.541 +			
  22.542 +			try
  22.543 +			{
  22.544 +				unitPoints = int.Parse(elem.GetAttribute("unitPoints"));
  22.545 +			}
  22.546 +			catch(FormatException)
  22.547 +			{
  22.548 +				throw new FormatException("Attribute 'trooperPoints' of unit "+id+" was not a valid number");
  22.549 +			}
  22.550 +			
  22.551 +			XmlNode node = elem.FirstChild;
  22.552 +			
  22.553 +			foreach(XmlElement cat in node.ChildNodes)
  22.554 +			{
  22.555 +				catID = cat.GetAttribute("catID");
  22.556 +				catIDs.Add(catID);
  22.557 +				
  22.558 +				if (catID == mainCatID)
  22.559 +				{
  22.560 +					found = true;
  22.561 +				}
  22.562 +			}
  22.563 +			
  22.564 +			if (!found)
  22.565 +			{
  22.566 +				throw new InvalidFileException("The main cat "+mainCatID+" was not found in the list of categories for unit "+id);
  22.567 +			}
  22.568 +			
  22.569 +			node = node.NextSibling;			
  22.570 +			stats = ParseUnitStats((XmlElement)node, system);
  22.571 +			//TODO: Add unit requirements
  22.572 +			UnitType type = new UnitType(id, name, mainCatID, catIDs.ToArray(), minNum, maxNum, minSize, maxSize, unitPoints, points, stats, unitRequirements.ToArray(), parentRace);
  22.573 +			
  22.574 +			return type;
  22.575 +		}
  22.576 +		
  22.577 +		private Stats ParseUnitStats(XmlElement elem, GameSystem system)
  22.578 +		{
  22.579 +			List<Stat> statsList = new List<Stat>();
  22.580 +			String statsID = elem.GetAttribute("statSet");
  22.581 +			SystemStats statsSet;
  22.582 +			
  22.583 +			if (statsID == "")
  22.584 +			{
  22.585 +				statsSet = system.StandardSystemStats;
  22.586 +			}
  22.587 +			else
  22.588 +			{
  22.589 +				statsSet = system.SystemStats[statsID];
  22.590 +			}
  22.591 +			
  22.592 +			Stats stats = new Stats(statsSet);
  22.593 +			
  22.594 +			foreach (XmlElement stat in elem.ChildNodes)
  22.595 +			{
  22.596 +				String statID = stat.GetAttribute("name");
  22.597 +				StatSlot slot = statsSet[statID];
  22.598 +				
  22.599 +				if (slot!=null)
  22.600 +				{
  22.601 +					statsList.Add(new Stat(slot, stat.InnerText));
  22.602 +				}
  22.603 +				else
  22.604 +				{
  22.605 +					throw new InvalidFileException("The stat "+statID+" was not found in stats set "+statsID);
  22.606 +				}
  22.607 +			}
  22.608 +			
  22.609 +			stats.SetStats(statsList);
  22.610 +			
  22.611 +			return stats;
  22.612 +		}
  22.613 +		
  22.614 +		private Dictionary<string, SystemStats> CreateSystemStatsSetFromElement(XmlElement elem)
  22.615 +		{
  22.616 +			Dictionary<string, SystemStats> dict = new Dictionary<string,SystemStats>();
  22.617 +			
  22.618 +			foreach (XmlElement stats in elem.ChildNodes)
  22.619 +			{
  22.620 +				SystemStats sysStats = CreateSystemStatsFromElement(stats);
  22.621 +				dict.Add(sysStats.ID, sysStats);
  22.622 +			}
  22.623 +			
  22.624 +			return dict;
  22.625 +		}
  22.626 +		
  22.627 +		private SystemStats CreateSystemStatsFromElement(XmlElement elem)
  22.628 +		{
  22.629 +			List<StatSlot> slots = new List<StatSlot>();
  22.630 +			string id = elem.GetAttribute("id");	
  22.631 +			
  22.632 +			foreach (XmlElement slot in elem.ChildNodes)
  22.633 +			{
  22.634 +				StatSlot statSlot = new StatSlot(slot.GetAttribute("name"));
  22.635 +				slots.Add(statSlot);
  22.636 +			}
  22.637 +			
  22.638 +			return new SystemStats(id, slots.ToArray());
  22.639 +		}
  22.640 +		
  22.641 +		private EquipmentItem CreateEquipmentItemFromElement(XmlElement elem, Race race)
  22.642 +		{
  22.643 +			string id = elem.GetAttribute("id");
  22.644 +			string name = elem.GetAttribute("name");
  22.645 +			float cost = 0, min = 0, max = 0;
  22.646 +			ArmourType armourType;
  22.647 +			
  22.648 +			try
  22.649 +			{
  22.650 +				cost = float.Parse(elem.GetAttribute("cost"));
  22.651 +			}
  22.652 +			catch(FormatException)
  22.653 +			{
  22.654 +				throw new FormatException("Attribute 'cost' of equipment item "+id+" was not a valid number");
  22.655 +			}			
  22.656 +			
  22.657 +			try
  22.658 +			{
  22.659 +				min = float.Parse(elem.GetAttribute("min"));
  22.660 +			}
  22.661 +			catch(FormatException)
  22.662 +			{
  22.663 +				throw new FormatException("Attribute 'min' of equipment item "+id+" was not a valid number");
  22.664 +			}			
  22.665 +			
  22.666 +			try
  22.667 +			{
  22.668 +				max = float.Parse(elem.GetAttribute("max"));
  22.669 +			}
  22.670 +			catch(FormatException)
  22.671 +			{
  22.672 +				throw new FormatException("Attribute 'max' of equipment item "+id+" was not a valid number");
  22.673 +			}
  22.674 +			
  22.675 +			try
  22.676 +			{
  22.677 +				armourType = (ArmourType)Enum.Parse(typeof(ArmourType), elem.GetAttribute("armourType"));
  22.678 +			}
  22.679 +			catch(FormatException)
  22.680 +			{
  22.681 +				throw new InvalidFileException("Attribute 'armourType' of equipment "+id+" was not a valid value from the enumeration");
  22.682 +			}
  22.683 +			
  22.684 +			if (elem.ChildNodes.Count>0)
  22.685 +			{
  22.686 +				//It has stats!
  22.687 +				//TODO: Parse equipment stats
  22.688 +			}
  22.689 +			
  22.690 +			return new EquipmentItem(id, name, cost, min, max, armourType, race);
  22.691 +		}
  22.692 +		
  22.693 +		private void ValidationEventMethod(object sender, ValidationEventArgs e)
  22.694 +		{
  22.695 +			//TODO: Fire a validation failure event
  22.696 +    		LogNotifier.WarnFormat(GetType(), "Validation Error: {0}", e.Message);
  22.697 +		}
  22.698 +	}
  22.699 +}
  22.700 \ No newline at end of file
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/api/Factories/Xml/WarFoundryXmlSaver.cs	Fri Dec 19 15:57:51 2008 +0000
    23.3 @@ -0,0 +1,92 @@
    23.4 +using System;
    23.5 +using System.Collections.Generic;
    23.6 +using System.IO;
    23.7 +using IBBoard.Lang;
    23.8 +using IBBoard.WarFoundry.API.Objects;
    23.9 +
   23.10 +namespace IBBoard.WarFoundry.API.Factories.Xml
   23.11 +{
   23.12 +	public class WarFoundryXmlSaver
   23.13 +	{
   23.14 +		//FIXME: Rework to saving files in Zips
   23.15 +		private static WarFoundryXmlSaver saver;
   23.16 +		private static List<Type> saveAsTypes;
   23.17 +		private Dictionary<WarFoundryObject, string> savePaths = new Dictionary<WarFoundryObject,string>();
   23.18 +		
   23.19 +		public static WarFoundryXmlSaver GetSaver()
   23.20 +		{
   23.21 +			if (saver == null)
   23.22 +			{
   23.23 +				saveAsTypes = new List<Type>();
   23.24 +				saveAsTypes.Add(typeof(Army));
   23.25 +				saver = new WarFoundryXmlSaver();
   23.26 +			}
   23.27 +			
   23.28 +			return saver;
   23.29 +		}
   23.30 +		
   23.31 +		public bool SaveAs(WarFoundryObject toSave, string saveAsPath)
   23.32 +		{
   23.33 +			if (CanSaveType(toSave))
   23.34 +			{
   23.35 +				FileStream fs = null;
   23.36 +				bool success = false;
   23.37 +				
   23.38 +				try
   23.39 +				{
   23.40 +					fs = new FileStream(saveAsPath, FileMode.Create, FileAccess.Write);
   23.41 +					byte[] bytes = StringManipulation.StringToBytes(CreateXmlString(toSave));
   23.42 +					fs.Write(bytes, 0, bytes.Length);
   23.43 +					fs.Flush();
   23.44 +					savePaths.Add(toSave, saveAsPath);
   23.45 +					success = true;
   23.46 +				}
   23.47 +				finally
   23.48 +				{
   23.49 +					if (fs!=null && fs.CanWrite)
   23.50 +					{
   23.51 +						fs.Close();
   23.52 +					}
   23.53 +				}
   23.54 +
   23.55 +				return success;
   23.56 +			}
   23.57 +			else
   23.58 +			{
   23.59 +				throw new ArgumentException("Cannot directly save objects of type "+toSave.GetType());
   23.60 +			}
   23.61 +		}
   23.62 +		
   23.63 +		public bool Save(WarFoundryObject toSave)
   23.64 +		{
   23.65 +			if (CanSave(toSave))
   23.66 +			{
   23.67 +				return SaveAs(toSave, savePaths[toSave]);
   23.68 +			}
   23.69 +			else
   23.70 +			{
   23.71 +				throw new InvalidOperationException("Cannot save an object that has not previously been saved using SaveAs");
   23.72 +			}
   23.73 +		}
   23.74 +		
   23.75 +		private string CreateXmlString(WarFoundryObject toSave)
   23.76 +		{
   23.77 +			return ""; //TODO: Create XML string as appropriate
   23.78 +		}
   23.79 +		
   23.80 +		public bool CanSaveAs(WarFoundryObject obj)
   23.81 +		{
   23.82 +			return CanSaveType(obj);
   23.83 +		}
   23.84 +		
   23.85 +		public bool CanSave(WarFoundryObject obj)
   23.86 +		{
   23.87 +			return savePaths.ContainsKey(obj);
   23.88 +		}
   23.89 +		
   23.90 +		public bool CanSaveType(WarFoundryObject obj)
   23.91 +		{
   23.92 +			return saveAsTypes.Contains(obj.GetType());
   23.93 +		}
   23.94 +	}
   23.95 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/api/Objects/Ability.cs	Fri Dec 19 15:57:51 2008 +0000
    24.3 @@ -0,0 +1,12 @@
    24.4 +
    24.5 +using System;
    24.6 +
    24.7 +namespace IBBoard.WarFoundry.API.Objects
    24.8 +{
    24.9 +	public class Ability : WarFoundryObject
   24.10 +	{
   24.11 +		public Ability()
   24.12 +		{
   24.13 +		}
   24.14 +	}
   24.15 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/api/Objects/ArmourType.cs	Fri Dec 19 15:57:51 2008 +0000
    25.3 @@ -0,0 +1,29 @@
    25.4 +// ArmourType.cs
    25.5 +//
    25.6 +//  Copyright (C) 2007 IBBoard
    25.7 +//
    25.8 +// This library is free software; you can redistribute it and/or
    25.9 +// modify it under the terms of the GNU Lesser General Public
   25.10 +// License version 2.1 of the License as published by the Free
   25.11 +// Software Foundation.
   25.12 +//
   25.13 +// This library is distributed in the hope that it will be useful,
   25.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   25.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   25.16 +// Lesser General Public License for more details.
   25.17 +//
   25.18 +// You should have received a copy of the GNU Lesser General Public
   25.19 +// License along with this library; if not, write to the Free Software
   25.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   25.21 +//
   25.22 +//
   25.23 +
   25.24 +using System;
   25.25 +
   25.26 +namespace IBBoard.WarFoundry.API.Objects
   25.27 +{
   25.28 +	public enum ArmourType
   25.29 +	{
   25.30 +		None = 0, Shield = 1, LightArmour = 2, LightArmourShield = 3, HeavyArmour = 4, HeavyArmourShield = 5, Barding = 8, BardingShield = 9, BardingLightArmour = 10, BardingLightArmourShield = 11, BardingHeavyArmour = 12, BardingHeavyArmourShield = 13
   25.31 +	}
   25.32 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/api/Objects/Army.cs	Fri Dec 19 15:57:51 2008 +0000
    26.3 @@ -0,0 +1,261 @@
    26.4 +using System;
    26.5 +using System.IO;
    26.6 +using System.Collections;
    26.7 +using System.Collections.Generic;
    26.8 +using System.Text;
    26.9 +using System.Xml;
   26.10 +using IBBoard.WarFoundry.API;
   26.11 +using IBBoard.WarFoundry.API.Factories;
   26.12 +using IBBoard.WarFoundry.API.Requirements;
   26.13 +using ICSharpCode.SharpZipLib.Zip;
   26.14 +
   26.15 +namespace IBBoard.WarFoundry.API.Objects
   26.16 +{
   26.17 +	/// <summary>
   26.18 +	/// Summary description for Army.
   26.19 +	/// </summary>
   26.20 +	public class Army : WarFoundryObject
   26.21 +	{
   26.22 +		//private GameSystem system;
   26.23 +		private Race armyRace;
   26.24 +		private int maxPoints;
   26.25 +		private double pointsTotal;
   26.26 +		private ArmyCategory[] categories;
   26.27 +
   26.28 +		public event ObjectAddDelegate UnitAdded;
   26.29 +		public event ObjectRemoveDelegate UnitRemoved;
   26.30 +		public event FailedUnitRequirementDelegate FailedRequirement;
   26.31 +		public event DoubleValChangedDelegate PointsValueChanged;
   26.32 +		private DoubleValChangedDelegate PointsValueChangedMethod;
   26.33 +		
   26.34 +		public Army(Race race, string armyName, int maxArmyPoints/*, AbstractNativeWarFoundryFactory factory*/) : this(race, armyName, maxArmyPoints, null/*, factory*/)
   26.35 +		{
   26.36 +		}
   26.37 +
   26.38 +		public Army(Race race, string armyName, int maxArmyPoints, ZipFile file/*, AbstractNativeWarFoundryFactory factory*/) : base(armyName/*, factory*/)
   26.39 +		{
   26.40 +			armyRace = race;
   26.41 +			Name = armyName;
   26.42 +			maxPoints = maxArmyPoints;
   26.43 +			PointsValueChangedMethod = new DoubleValChangedDelegate(PointsValueChangedHandler);
   26.44 +		}
   26.45 +		
   26.46 +		public ArmyCategory GetCategory(Category cat)
   26.47 +		{
   26.48 +			foreach (ArmyCategory armyCat in Categories)
   26.49 +			{
   26.50 +				if (armyCat.Category.Equals(cat))
   26.51 +				{
   26.52 +					return armyCat;
   26.53 +				}
   26.54 +			}
   26.55 +
   26.56 +			return null;
   26.57 +		}
   26.58 +
   26.59 +		public ArmyCategory[] Categories
   26.60 +		{
   26.61 +			get 
   26.62 +			{
   26.63 +				if (categories==null)
   26.64 +				{
   26.65 +					Category[] raceCats = Race.Categories;
   26.66 +					ArmyCategory cat;
   26.67 +					int raceCatCount = raceCats.Length;
   26.68 +					categories = new ArmyCategory[raceCatCount];
   26.69 +
   26.70 +					for (int i = 0; i < raceCatCount; i++)
   26.71 +					{
   26.72 +						cat = new ArmyCategory(this, raceCats[i]);
   26.73 +						categories[i] = cat;
   26.74 +						cat.PointsValueChanged+= PointsValueChangedMethod;
   26.75 +						cat.UnitAdded+=new ObjectAddDelegate(Army_UnitAdded);
   26.76 +						cat.UnitRemoved+=new ObjectRemoveDelegate(Army_UnitRemoved);
   26.77 +						cat.RequirementsFailed+=new FailedUnitRequirementDelegate(Army_FailedRequirement);
   26.78 +					}
   26.79 +				}
   26.80 +
   26.81 +				return categories;
   26.82 +			}
   26.83 +		}
   26.84 +
   26.85 +		public Race Race
   26.86 +		{
   26.87 +			get { return armyRace; }
   26.88 +		}
   26.89 +
   26.90 +		public GameSystem GameSystem
   26.91 +		{
   26.92 +			get { return (armyRace!=null ? armyRace.GameSystem : null); }
   26.93 +		}
   26.94 +
   26.95 +		protected void OnUnitAdded(Unit unit)
   26.96 +		{
   26.97 +			OnUnitAdded(unit, null);
   26.98 +		}
   26.99 +
  26.100 +		protected void OnUnitAdded(Unit unit, List<FailedUnitRequirement> failedReqs)
  26.101 +		{
  26.102 +			if (UnitAdded!=null)
  26.103 +			{
  26.104 +				UnitAdded(unit);
  26.105 +			}
  26.106 +
  26.107 +			if (FailedRequirement!=null && failedReqs!=null && failedReqs.Count > 0)
  26.108 +			{
  26.109 +				FailedRequirement(failedReqs);
  26.110 +			}
  26.111 +		}
  26.112 +
  26.113 +		protected void OnUnitRemoved(Unit unit)
  26.114 +		{
  26.115 +			OnUnitRemoved(unit, null);
  26.116 +		}
  26.117 +
  26.118 +		protected void OnUnitRemoved(Unit unit, List<FailedUnitRequirement> failedReqs)
  26.119 +		{
  26.120 +			if (UnitRemoved!=null)
  26.121 +			{
  26.122 +				UnitRemoved(unit);
  26.123 +			}
  26.124 +
  26.125 +			if (FailedRequirement!=null && failedReqs!=null && failedReqs.Count > 0)
  26.126 +			{
  26.127 +				FailedRequirement(failedReqs);
  26.128 +			}
  26.129 +		}
  26.130 +
  26.131 +		private void OnPointsValueChanged(double oldValue, double newValue)
  26.132 +		{
  26.133 +			if (PointsValueChanged!=null)
  26.134 +			{
  26.135 +				PointsValueChanged(this, oldValue, newValue);
  26.136 +			}
  26.137 +		}
  26.138 +		
  26.139 +		private double TotalPoints
  26.140 +		{
  26.141 +			get { return pointsTotal; }
  26.142 +			set
  26.143 +			{
  26.144 +				double oldPoints = pointsTotal;
  26.145 +				pointsTotal = value;
  26.146 +
  26.147 +				if (oldPoints!=pointsTotal)
  26.148 +				{
  26.149 +					OnPointsValueChanged(oldPoints, pointsTotal);
  26.150 +				}
  26.151 +			}
  26.152 +		}
  26.153 +
  26.154 +		public double PointsTotal
  26.155 +		{
  26.156 +			get { return TotalPoints; }
  26.157 +		}
  26.158 +
  26.159 +		public Unit[] GetUnits(Category cat)
  26.160 +		{
  26.161 +			return GetUnits(this.GetCategory(cat));
  26.162 +		}
  26.163 +
  26.164 +		public Unit[] GetUnits(ArmyCategory cat)
  26.165 +		{
  26.166 +			return cat.GetUnits();
  26.167 +		}
  26.168 +
  26.169 +		public Unit[] GetUnits()
  26.170 +		{
  26.171 +			ArrayList fullList = new ArrayList();
  26.172 +
  26.173 +			foreach(ArmyCategory cat in Categories)
  26.174 +			{
  26.175 +				foreach(Unit unit in cat.GetUnits())
  26.176 +				{
  26.177 +					if (!fullList.Contains(unit))
  26.178 +					{
  26.179 +						fullList.Add(unit);
  26.180 +					}
  26.181 +				}
  26.182 +			}
  26.183 +
  26.184 +			return (Unit[])fullList.ToArray(typeof(Unit));
  26.185 +		}
  26.186 +
  26.187 +		public int MaxPoints
  26.188 +		{
  26.189 +			get { return maxPoints; }
  26.190 +			set 
  26.191 +			{
  26.192 +				if (value > 0)
  26.193 +				{
  26.194 +					maxPoints = value;
  26.195 +				}
  26.196 +			}
  26.197 +		}
  26.198 +
  26.199 +		private void PointsValueChangedHandler(WarFoundryObject obj, double oldVal, double newVal)
  26.200 +		{
  26.201 +			if (obj is ArmyCategory)
  26.202 +			{
  26.203 +				double points = 0;
  26.204 +
  26.205 +				foreach (ArmyCategory cat in Categories)
  26.206 +				{
  26.207 +					points+= cat.PointsTotal;
  26.208 +				}
  26.209 +
  26.210 +				TotalPoints = points;
  26.211 +			}
  26.212 +		}
  26.213 +
  26.214 +		public List<FailedUnitRequirement> CanAddUnit(Unit unit)
  26.215 +		{
  26.216 +			return CanAddUnitType(unit.UnitType);
  26.217 +		}
  26.218 +
  26.219 +		public List<FailedUnitRequirement> CanAddUnitType(UnitType unitType)
  26.220 +		{
  26.221 +			return unitType.CanAddToArmy(this);
  26.222 +		}
  26.223 +
  26.224 +		public List<FailedUnitRequirement> CanRemoveUnit(Unit unit)
  26.225 +		{
  26.226 +			return CanRemoveUnitType(unit.UnitType);
  26.227 +		}
  26.228 +
  26.229 +		public List<FailedUnitRequirement> CanRemoveUnitType(UnitType unitType)
  26.230 +		{
  26.231 +			return unitType.CanRemoveFromArmy(this);
  26.232 +		}
  26.233 +
  26.234 +		public int GetUnitTypeCount(UnitType unitType)
  26.235 +		{
  26.236 +			int count = 0;
  26.237 +
  26.238 +			foreach (ArmyCategory cat in Categories)
  26.239 +			{
  26.240 +				count+= cat.GetUnitTypeCount(unitType);
  26.241 +			}
  26.242 +
  26.243 +			return count;
  26.244 +		}
  26.245 +
  26.246 +		private void Army_UnitAdded(object val)
  26.247 +		{
  26.248 +			OnUnitAdded((Unit)val);
  26.249 +		}
  26.250 +
  26.251 +		private void Army_UnitRemoved(object val)
  26.252 +		{
  26.253 +			OnUnitRemoved((Unit)val);
  26.254 +		}
  26.255 +
  26.256 +		private void Army_FailedRequirement(List<FailedUnitRequirement> failedRequirements)
  26.257 +		{
  26.258 +			if (FailedRequirement!=null)
  26.259 +			{
  26.260 +				FailedRequirement(failedRequirements);
  26.261 +			}
  26.262 +		}
  26.263 +	}
  26.264 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/api/Objects/ArmyCategory.cs	Fri Dec 19 15:57:51 2008 +0000
    27.3 @@ -0,0 +1,173 @@
    27.4 +using System;
    27.5 +using System.Collections.Generic;
    27.6 +using IBBoard.WarFoundry.API.Requirements;
    27.7 +
    27.8 +namespace IBBoard.WarFoundry.API.Objects
    27.9 +{
   27.10 +	/// <summary>
   27.11 +	/// Summary description for ArmyCategory.
   27.12 +	/// </summary>
   27.13 +	public class ArmyCategory : WarFoundryObject
   27.14 +	{
   27.15 +		private Category category;
   27.16 +		private Army parentArmy;
   27.17 +		private double pointsTotal;
   27.18 +		private List<Unit> units;
   27.19 +		private Dictionary<string, int> unitTypes;
   27.20 +		private DoubleValChangedDelegate PointsValueChangedMethod;
   27.21 +		public event DoubleValChangedDelegate PointsValueChanged;
   27.22 +		public event ObjectAddDelegate UnitAdded;
   27.23 +		public event ObjectRemoveDelegate UnitRemoved;
   27.24 +		public event FailedUnitRequirementDelegate RequirementsFailed;
   27.25 +
   27.26 +		public ArmyCategory(Army army, Category cat) : base()
   27.27 +		{
   27.28 +			parentArmy = army;
   27.29 +			category = cat;
   27.30 +			cat.NameChanged+=new StringValChangedDelegate(cat_NameChanged);
   27.31 +			PointsValueChangedMethod = new DoubleValChangedDelegate(PointsValueChangedHandler);
   27.32 +			units = new List<Unit>();
   27.33 +			unitTypes = new Dictionary<string,int>();
   27.34 +		}
   27.35 +
   27.36 +		public Category Category
   27.37 +		{
   27.38 +			get { return category; }
   27.39 +		}
   27.40 +
   27.41 +		public Army ParentArmy
   27.42 +		{
   27.43 +			get { return parentArmy; }
   27.44 +		}
   27.45 +
   27.46 +		public override string ID
   27.47 +		{
   27.48 +			get
   27.49 +			{
   27.50 +				return Category.ID;
   27.51 +			}
   27.52 +			set
   27.53 +			{
   27.54 +				Category.ID = value;
   27.55 +			}
   27.56 +		}
   27.57 +
   27.58 +		public override string Name
   27.59 +		{
   27.60 +			get { return category.Name; }
   27.61 +			set 
   27.62 +			{
   27.63 +				category.Name = value;
   27.64 +			}
   27.65 +		}
   27.66 +
   27.67 +		public void AddUnit(Unit unit)
   27.68 +		{
   27.69 +			List<FailedUnitRequirement> failedReqs = ParentArmy.CanAddUnit(unit);
   27.70 +
   27.71 +			units.Add(unit);
   27.72 +			unit.Army = ParentArmy;
   27.73 +			unit.Category = this;
   27.74 +			unit.PointsValueChanged+= PointsValueChangedMethod;
   27.75 +			int unitTypeCount;
   27.76 +			unitTypes.TryGetValue(unit.UnitType.ID, out unitTypeCount);
   27.77 +			unitTypes[unit.UnitType.ID] = (int)unitTypeCount + 1;
   27.78 +			TotalPoints+= unit.PointsValue;
   27.79 +			OnUnitAdded(unit, failedReqs);
   27.80 +		}
   27.81 +
   27.82 +		public void RemoveUnit(Unit unit)
   27.83 +		{
   27.84 +			List<FailedUnitRequirement> failedReqs = ParentArmy.CanRemoveUnit(unit);
   27.85 +			units.Remove(unit);
   27.86 +			unit.Army = null;
   27.87 +			unitTypes[unit.UnitType.ID] = ((int)unitTypes[unit.UnitType.ID])-1;
   27.88 +			TotalPoints-= unit.PointsValue;
   27.89 +			unit.PointsValueChanged-= PointsValueChangedMethod;
   27.90 +			OnUnitRemoved(unit, failedReqs);
   27.91 +		}
   27.92 +
   27.93 +		public int GetUnitTypeCount(UnitType unitType)
   27.94 +		{
   27.95 +			return unitTypes.ContainsKey(unitType.ID) ? (int)unitTypes[unitType.ID] : 0;
   27.96 +		}
   27.97 +
   27.98 +		public Unit[] GetUnits()
   27.99 +		{
  27.100 +			return units.ToArray();
  27.101 +		}
  27.102 +
  27.103 +		private double TotalPoints
  27.104 +		{
  27.105 +			get { return pointsTotal; }
  27.106 +			set 
  27.107 +			{
  27.108 +				double oldVal = pointsTotal;
  27.109 +				pointsTotal = value;
  27.110 +
  27.111 +				if (oldVal!=pointsTotal)
  27.112 +				{
  27.113 +					OnPointsValueChanged(oldVal, pointsTotal);
  27.114 +				}
  27.115 +			}
  27.116 +		}
  27.117 +
  27.118 +		public double PointsTotal
  27.119 +		{
  27.120 +			get { return TotalPoints; }
  27.121 +		}
  27.122 +
  27.123 +		private void PointsValueChangedHandler(WarFoundryObject obj, double oldVal, double newVal)
  27.124 +		{
  27.125 +			if (obj is Unit)
  27.126 +			{
  27.127 +				double diff = newVal - oldVal;
  27.128 +				TotalPoints+= diff;
  27.129 +			}
  27.130 +		}
  27.131 +
  27.132 +		private void OnUnitAdded(Unit unit, List<FailedUnitRequirement> failedReqs)
  27.133 +		{
  27.134 +			if (UnitAdded!=null)
  27.135 +			{
  27.136 +				UnitAdded(unit);
  27.137 +			}
  27.138 +
  27.139 +			if (RequirementsFailed!=null && failedReqs!=null && failedReqs.Count > 0)
  27.140 +			{
  27.141 +				RequirementsFailed(failedReqs);
  27.142 +			}
  27.143 +		}
  27.144 +
  27.145 +		private void OnUnitRemoved(Unit unit, List<FailedUnitRequirement> failedReqs)
  27.146 +		{
  27.147 +			if (UnitRemoved!=null)
  27.148 +			{
  27.149 +				UnitRemoved(unit);
  27.150 +			}
  27.151 +
  27.152 +			if (RequirementsFailed!=null && failedReqs!=null && failedReqs.Count>0)
  27.153 +			{
  27.154 +				RequirementsFailed(failedReqs);
  27.155 +			}
  27.156 +		}
  27.157 +
  27.158 +		protected virtual void OnPointsValueChanged(double oldValue, double newValue)
  27.159 +		{
  27.160 +			if (PointsValueChanged!=null)
  27.161 +			{
  27.162 +				PointsValueChanged(this, oldValue, newValue);
  27.163 +			}
  27.164 +		}
  27.165 +
  27.166 +		protected void cat_NameChanged(WarFoundryObject obj, string oldValue, string newValue)
  27.167 +		{
  27.168 +			OnNameChanged(oldValue, newValue);
  27.169 +		}
  27.170 +				
  27.171 +		public int GetPointsPercentage()
  27.172 +		{
  27.173 +			return (int)Math.Round((PointsTotal / ParentArmy.MaxPoints) * 100, 0);
  27.174 +		}
  27.175 +	}
  27.176 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/api/Objects/Category.cs	Fri Dec 19 15:57:51 2008 +0000
    28.3 @@ -0,0 +1,158 @@
    28.4 +using System;
    28.5 +using System.Xml;
    28.6 +
    28.7 +namespace IBBoard.WarFoundry.API.Objects
    28.8 +{
    28.9 +	/// <summary>
   28.10 +	/// Summary description for Category.
   28.11 +	/// </summary>
   28.12 +	public class Category : WarFoundryObject
   28.13 +	{
   28.14 +		private int minPts, maxPts, minPc, maxPc, minChoice, maxChoice, baseVal, incVal, incAmount;
   28.15 +		/*private GameSystem system;*/
   28.16 +		
   28.17 +		public Category(string id, string name, int minPoints, int maxPoints, int minPercent, int maxPercent, int minChoices, int maxChoices, int baseValue, int incrementValue, int incrementAmount) : base(id, name)
   28.18 +		{
   28.19 +			minPts = minPoints;
   28.20 +			maxPts = maxPoints;
   28.21 +			minPc = minPercent;
   28.22 +			maxPc = maxPercent;
   28.23 +			baseVal = baseValue;
   28.24 +			incVal = incrementValue;
   28.25 +			incAmount = incrementAmount;
   28.26 +		}
   28.27 +		
   28.28 +		/*public Category(XmlElement node, GameSystem gameSystem, AbstractNativeWarFoundryFactory factory) : base(factory)
   28.29 +		{
   28.30 +			//system = gameSystem;
   28.31 +			ID = node.GetAttribute("id");
   28.32 +			Name = node.GetAttribute("name");
   28.33 +
   28.34 +			try
   28.35 +			{
   28.36 +				min = int.Parse(node.GetAttribute("minimum"));
   28.37 +			}
   28.38 +			catch(FormatException)
   28.39 +			{
   28.40 +				throw new FormatException("Attribute 'minimum' of category "+id+" was not a valid number");
   28.41 +			}
   28.42 +
   28.43 +			try
   28.44 +			{
   28.45 +				max = int.Parse(node.GetAttribute("maximum"));
   28.46 +			}
   28.47 +			catch(FormatException)
   28.48 +			{
   28.49 +				throw new FormatException("Attribute 'maximum' of category "+id+" was not a valid number");
   28.50 +			}
   28.51 +
   28.52 +			string val = "";
   28.53 +			val = node.GetAttribute("baseValue");
   28.54 +
   28.55 +			if (val!="")
   28.56 +			{
   28.57 +				try
   28.58 +				{
   28.59 +					baseValue = int.Parse(val);
   28.60 +				
   28.61 +				}
   28.62 +				catch(FormatException)
   28.63 +				{
   28.64 +					throw new FormatException("Attribute 'baseValue' of category "+id+" was not a valid number");
   28.65 +				}
   28.66 +			}
   28.67 +
   28.68 +			val = node.GetAttribute("incValue");
   28.69 +
   28.70 +			if (val!="")
   28.71 +			{
   28.72 +				try
   28.73 +				{
   28.74 +					incValue = int.Parse(val);
   28.75 +				}
   28.76 +				catch(FormatException)
   28.77 +				{
   28.78 +					throw new FormatException("Attribute 'incValue' of category "+id+" was not a valid number");
   28.79 +				}
   28.80 +			}
   28.81 +
   28.82 +			val = node.GetAttribute("incAmount");
   28.83 +
   28.84 +			if (val!="")
   28.85 +			{
   28.86 +				try
   28.87 +				{
   28.88 +					incAmount = int.Parse(val);
   28.89 +				}
   28.90 +				catch(FormatException)
   28.91 +				{
   28.92 +					throw new FormatException("Attribute 'incAmount' of category "+id+" was not a valid number");
   28.93 +				}
   28.94 +			}
   28.95 +		}*/
   28.96 +
   28.97 +		protected override string DefaultName()
   28.98 +		{
   28.99 +			return "";
  28.100 +		}
  28.101 +
  28.102 +		/*public GameSystem GameSystem
  28.103 +		{
  28.104 +			get { return system; }
  28.105 +		}*/
  28.106 +
  28.107 +		public int MinimumPoints
  28.108 +		{
  28.109 +			get { return minPts; }
  28.110 +			set { minPts = value; }
  28.111 +		}
  28.112 +
  28.113 +		public int MaximumPoints
  28.114 +		{
  28.115 +			get { return maxPts; }
  28.116 +			set { maxPts = value; }
  28.117 +		}
  28.118 +		
  28.119 +		public int MinimumPercentage
  28.120 +		{
  28.121 +			get { return minPc; }
  28.122 +			set { minPc = value; }
  28.123 +		}
  28.124 +
  28.125 +		public int MaximumPercentage
  28.126 +		{
  28.127 +			get { return maxPc; }
  28.128 +			set { maxPc = value; }
  28.129 +		}
  28.130 +
  28.131 +		public int MinimumChoices
  28.132 +		{
  28.133 +			get { return minChoice; }
  28.134 +			set { minChoice = value; }
  28.135 +		}
  28.136 +
  28.137 +		public int MaximumChoices
  28.138 +		{
  28.139 +			get { return maxChoice; }
  28.140 +			set { maxChoice = value; }
  28.141 +		}
  28.142 +
  28.143 +		public int BaseValue
  28.144 +		{
  28.145 +			get { return baseVal; }
  28.146 +			set { baseVal = value; }
  28.147 +		}
  28.148 +
  28.149 +		public int IncrementValue
  28.150 +		{
  28.151 +			get { return incVal; }
  28.152 +			set { incVal = value; }
  28.153 +		}
  28.154 +
  28.155 +		public int IncrementAmount
  28.156 +		{
  28.157 +			get { return incAmount; }
  28.158 +			set { incAmount = value; }
  28.159 +		}
  28.160 +	}
  28.161 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/api/Objects/EquipmentItem.cs	Fri Dec 19 15:57:51 2008 +0000
    29.3 @@ -0,0 +1,84 @@
    29.4 +using System;
    29.5 +using System.Xml;
    29.6 +
    29.7 +namespace IBBoard.WarFoundry.API.Objects
    29.8 +{
    29.9 +	/// <summary>
   29.10 +	/// Summary description for EquipmentItem.
   29.11 +	/// </summary>
   29.12 +	public class EquipmentItem : WarFoundryObject
   29.13 +	{
   29.14 +		private float cost, min, max;
   29.15 +		private ArmourType armourType;
   29.16 +		private Race equipForRace;
   29.17 +
   29.18 +		public EquipmentItem(string id, string name, float itemCost, float minimum, float maximum, ArmourType itemArmourType, Race race) : base(id, name)
   29.19 +		{
   29.20 +			cost = itemCost;
   29.21 +			min = minimum;
   29.22 +			max = maximum;
   29.23 +			armourType = itemArmourType;
   29.24 +			equipForRace = race;
   29.25 +		}
   29.26 +
   29.27 +		public bool IsRatioLimit
   29.28 +		{
   29.29 +			get { return ((MaxNumber < 1 && MaxNumber > 0) || (MaxNumber == 1 && MinNumber > 0)); }
   29.30 +		}
   29.31 +
   29.32 +		public float MinNumber
   29.33 +		{
   29.34 +			get { return min; }
   29.35 +			set 
   29.36 +			{
   29.37 +				min = (value >= 0 || value == -1) ? value : 0; 
   29.38 +
   29.39 +				if (MaxNumber != -1 && min > MaxNumber)
   29.40 +				{
   29.41 +					MaxNumber = min;
   29.42 +				}
   29.43 +			}
   29.44 +		}
   29.45 +
   29.46 +		public float MaxNumber
   29.47 +		{
   29.48 +			get { return max; }
   29.49 +			set 
   29.50 +			{
   29.51 +				max = (value > 0 || value == -1) ? value : -1; 
   29.52 +
   29.53 +				if (max != -1 && MinNumber > max)
   29.54 +				{
   29.55 +					MinNumber = max;
   29.56 +				}
   29.57 +			}
   29.58 +		}
   29.59 +
   29.60 +		public ArmourType ItemArmourType
   29.61 +		{
   29.62 +			get { return armourType; }
   29.63 +			set { armourType = value; }
   29.64 +		}
   29.65 +
   29.66 +		public float Cost
   29.67 +		{
   29.68 +			get { return cost; }
   29.69 +			set { cost = value; }
   29.70 +		}
   29.71 +		
   29.72 +		public Race EquipmentForRace
   29.73 +		{
   29.74 +			get { return equipForRace; }
   29.75 +		}
   29.76 +
   29.77 +		public bool CanBeUsedWithItem(EquipmentItem item)
   29.78 +		{
   29.79 +			return CanBeUsedWithArmourType(item.ItemArmourType);
   29.80 +		}
   29.81 +
   29.82 +		public bool CanBeUsedWithArmourType(ArmourType otherItemType)
   29.83 +		{
   29.84 +			return (this.ItemArmourType & otherItemType) == 0;
   29.85 +		}
   29.86 +	}
   29.87 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/api/Objects/GameSystem.cs	Fri Dec 19 15:57:51 2008 +0000
    30.3 @@ -0,0 +1,274 @@
    30.4 +using System;
    30.5 +using System.Collections.Generic;
    30.6 +using System.Xml;
    30.7 +using System.IO;
    30.8 +using IBBoard.Logging;
    30.9 +using IBBoard.WarFoundry.API.Factories;
   30.10 +using ICSharpCode.SharpZipLib.Zip;
   30.11 +
   30.12 +namespace IBBoard.WarFoundry.API.Objects
   30.13 +{
   30.14 +	/// <summary>
   30.15 +	/// Summary description for GameSystem.
   30.16 +	/// </summary>
   30.17 +	public class GameSystem : WarFoundryObject // WarFoundryStagedLoadSourceObject
   30.18 +	{
   30.19 +		private bool warnOnError;
   30.20 +		private Category[] categories;
   30.21 +		private SystemStatsSet stats;
   30.22 +		private string defaultStats;
   30.23 +		private FileInfo sourceFile;
   30.24 +
   30.25 +		public GameSystem(string systemID, string systemName) : base(systemID, systemName)
   30.26 +		{
   30.27 +		}
   30.28 +				
   30.29 +		/*public void CompleteLoading(Category[] cats, Dictionary<string, SystemStats> sysStats, string defaultStatsID)
   30.30 +		{
   30.31 +			categories = cats;
   30.32 +			stats = new SystemStatsSet(sysStats); 
   30.33 +			defaultStats = defaultStatsID;
   30.34 +			base.CompleteLoading();
   30.35 +		}*/
   30.36 +		
   30.37 +		public FileInfo SourceFile
   30.38 +		{
   30.39 +			get { return sourceFile; }
   30.40 +			set { sourceFile = value; }
   30.41 +		}
   30.42 +		
   30.43 +		public int GetCategoryCount()
   30.44 +		{
   30.45 +			return categories.Length;
   30.46 +		}
   30.47 +
   30.48 +		public Category GetCategory(int index)
   30.49 +		{
   30.50 +			return categories[index];
   30.51 +		}
   30.52 +
   30.53 +		public Category GetCategory(string id)
   30.54 +		{
   30.55 +			for (int i = 0; i<categories.Length; i++)
   30.56 +			{
   30.57 +				if (categories[i].ID == id)
   30.58 +				{
   30.59 +					return categories[i];
   30.60 +				}
   30.61 +			}
   30.62 +
   30.63 +			return null;
   30.64 +		}
   30.65 +
   30.66 +		public Category[] Categories
   30.67 +		{
   30.68 +			get 
   30.69 +			{ 
   30.70 +				return SystemCategories; 
   30.71 +			}
   30.72 +			set 
   30.73 +			{
   30.74 +				SystemCategories = value;
   30.75 +			}
   30.76 +		}
   30.77 +		
   30.78 +		protected virtual Category[] SystemCategories
   30.79 +		{
   30.80 +			get 
   30.81 +			{
   30.82 +				return RawSystemCategories;
   30.83 +			}
   30.84 +			set
   30.85 +			{
   30.86 +				RawSystemCategories = value;
   30.87 +			}
   30.88 +		}
   30.89 +		
   30.90 +		protected Category[] RawSystemCategories
   30.91 +		{
   30.92 +			get 
   30.93 +			{ 
   30.94 +				return categories; 
   30.95 +			}
   30.96 +			set 
   30.97 +			{
   30.98 +				if (value!=null)
   30.99 +				{
  30.100 +					categories = value;
  30.101 +				}
  30.102 +			}
  30.103 +		}
  30.104 +
  30.105 +		public bool WarnOnError
  30.106 +		{
  30.107 +			get
  30.108 +			{
  30.109 +				return warnOnError;
  30.110 +			}
  30.111 +			set { warnOnError = value; }
  30.112 +		}
  30.113 +		
  30.114 +		public SystemStats StandardSystemStats
  30.115 +		{
  30.116 +			get
  30.117 +			{
  30.118 +				return SystemStats[defaultStats];
  30.119 +			}
  30.120 +		}
  30.121 +		
  30.122 +		public string StandardSystemStatsID
  30.123 +		{
  30.124 +			get
  30.125 +			{				
  30.126 +				return defaultStats;
  30.127 +			}
  30.128 +			
  30.129 +			set
  30.130 +			{
  30.131 +				if (value != null && value.Trim().Length > 0)
  30.132 +				{
  30.133 +					defaultStats = value;
  30.134 +				}
  30.135 +			}
  30.136 +		}
  30.137 +
  30.138 +		public SystemStatsSet SystemStats
  30.139 +		{
  30.140 +			get 
  30.141 +			{ 
  30.142 +				return stats;
  30.143 +			}
  30.144 +			set
  30.145 +			{
  30.146 +				stats = value;
  30.147 +			}
  30.148 +		}
  30.149 +		
  30.150 +		public Race SystemDefaultRace
  30.151 +		{
  30.152 +			get { return WarFoundryLoader.GetDefault().GetRace(this, Race.SYSTEM_DEFAULT_RACE_ID); }
  30.153 +		}
  30.154 +
  30.155 +		public bool Matches(GameSystem otherSystem)
  30.156 +		{
  30.157 +			if (otherSystem==null)
  30.158 +			{
  30.159 +				return false;
  30.160 +			}
  30.161 +
  30.162 +			return this.ID == otherSystem.ID;
  30.163 +		}
  30.164 +
  30.165 +		public override bool Equals(object obj)
  30.166 +		{
  30.167 +			if (obj == null)
  30.168 +			{
  30.169 +				return false;		
  30.170 +			}
  30.171 +			
  30.172 +			if (obj.GetType().Equals(this.GetType()))
  30.173 +			{
  30.174 +				GameSystem otherSystem = (GameSystem)obj;
  30.175 +
  30.176 +				return this.ID == otherSystem.ID && this.Name == otherSystem.Name && ((this.RawSystemCategories == null && otherSystem.RawSystemCategories == null) || this.RawSystemCategories.Equals(otherSystem.RawSystemCategories));
  30.177 +			}
  30.178 +			else
  30.179 +			{
  30.180 +				return false;
  30.181 +			}
  30.182 +		}
  30.183 +
  30.184 +		public override int GetHashCode()
  30.185 +		{
  30.186 +			return ID.GetHashCode() + Name.GetHashCode() + (RawSystemCategories!=null ? RawSystemCategories.GetHashCode() : 0) + warnOnError.GetHashCode();
  30.187 +		}
  30.188 +
  30.189 +		public bool UnitTypeMaxed(UnitType unitType, Army army)
  30.190 +		{
  30.191 +			return unitType.MaxNumber!=-1 && army.GetUnitTypeCount(unitType) >= unitType.MaxNumber;
  30.192 +		}
  30.193 +
  30.194 +		public bool UnitTypeMinned(UnitType unitType, Army army)
  30.195 +		{
  30.196 +			return army.GetUnitTypeCount(unitType) <= unitType.MinNumber;
  30.197 +		}
  30.198 +		
  30.199 +		public List<EquipmentItem> GetSystemEquipmentList()
  30.200 +		{
  30.201 +			List<EquipmentItem> items = new List<EquipmentItem>();
  30.202 +			Race defaultRace = SystemDefaultRace;
  30.203 +			
  30.204 +			if (defaultRace!=null)
  30.205 +			{				
  30.206 +				items = defaultRace.GetEquipmentList();
  30.207 +			}
  30.208 +			
  30.209 +			return items;
  30.210 +		}
  30.211 +				
  30.212 +		public EquipmentItem GetSystemEquipmentItem(string id)
  30.213 +		{
  30.214 +			EquipmentItem item = null;
  30.215 +			Race defaultRace = SystemDefaultRace;
  30.216 +			
  30.217 +			if (defaultRace!=null)
  30.218 +			{				
  30.219 +				item = defaultRace.GetEquipmentItem(id);
  30.220 +			}
  30.221 +			
  30.222 +			return item;
  30.223 +		}
  30.224 +		
  30.225 +		public UnitType[] GetSystemUnitTypes(Category cat)
  30.226 +		{
  30.227 +			UnitType[] items = new UnitType[0];
  30.228 +			Race defaultRace = SystemDefaultRace;
  30.229 +			
  30.230 +			if (defaultRace!=null)
  30.231 +			{				
  30.232 +				items = defaultRace.GetUnitTypes(cat);
  30.233 +			}
  30.234 +			
  30.235 +			return items;
  30.236 +		}
  30.237 +				
  30.238 +		public UnitType GetSystemUnitType(string id)
  30.239 +		{
  30.240 +			UnitType unit = null;
  30.241 +			Race defaultRace = SystemDefaultRace;
  30.242 +			
  30.243 +			if (defaultRace!=null)
  30.244 +			{				
  30.245 +				unit = defaultRace.GetUnitType(id);
  30.246 +			}
  30.247 +			
  30.248 +			return unit;
  30.249 +		}
  30.250 +		
  30.251 +		public List<Ability> GetSystemAbilityList()
  30.252 +		{
  30.253 +			List<Ability> items = new List<Ability>();
  30.254 +			Race defaultRace = SystemDefaultRace;
  30.255 +			
  30.256 +			if (defaultRace!=null)
  30.257 +			{				
  30.258 +				items = defaultRace.GetAbilityList();
  30.259 +			}
  30.260 +			
  30.261 +			return items;
  30.262 +		}
  30.263 +				
  30.264 +		public Ability GetSystemAbility(string id)
  30.265 +		{
  30.266 +			Ability ability = null;
  30.267 +			Race defaultRace = SystemDefaultRace;
  30.268 +			
  30.269 +			if (defaultRace!=null)
  30.270 +			{				
  30.271 +				ability = defaultRace.GetAbility(id);
  30.272 +			}
  30.273 +			
  30.274 +			return ability;
  30.275 +		}
  30.276 +	}
  30.277 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/api/Objects/IWarFoundryNativeSourceObject.cs	Fri Dec 19 15:57:51 2008 +0000
    31.3 @@ -0,0 +1,33 @@
    31.4 +// IWarFoundrySourceObject.cs
    31.5 +//
    31.6 +//  Copyright (C) 2008 IBBoard
    31.7 +//
    31.8 +// This library is free software; you can redistribute it and/or
    31.9 +// modify it under the terms of the GNU Lesser General Public
   31.10 +// License as published by the Free Software Foundation; either
   31.11 +// version 2.1 of the License, or (at your option) any later version.
   31.12 +//
   31.13 +// This library is distributed in the hope that it will be useful,
   31.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   31.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   31.16 +// Lesser General Public License for more details.
   31.17 +//
   31.18 +// You should have received a copy of the GNU Lesser General Public
   31.19 +// License along with this library; if not, write to the Free Software
   31.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   31.21 +//
   31.22 +//
   31.23 +
   31.24 +using System;
   31.25 +using ICSharpCode.SharpZipLib.Zip;
   31.26 +
   31.27 +namespace IBBoard.WarFoundry
   31.28 +{
   31.29 +	/// <summary>
   31.30 +	/// Interface for native WarFoundry objects that are the main object in a file and need to reference the file at a later date.
   31.31 +	/// </summary>
   31.32 +	public interface IWarFoundryNativeSourceObject : IWarFoundryObject
   31.33 +	{
   31.34 +		ZipFile SourceFile { get; set; }
   31.35 +	}
   31.36 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/api/Objects/IWarFoundryObject.cs	Fri Dec 19 15:57:51 2008 +0000
    32.3 @@ -0,0 +1,31 @@
    32.4 +// IWarFoundryObject.cs
    32.5 +//
    32.6 +//  Copyright (C) 2008 IBBoard
    32.7 +//
    32.8 +// This library is free software; you can redistribute it and/or
    32.9 +// modify it under the terms of the GNU Lesser General Public
   32.10 +// License as published by the Free Software Foundation; either
   32.11 +// version 2.1 of the License, or (at your option) any later version.
   32.12 +//
   32.13 +// This library is distributed in the hope that it will be useful,
   32.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   32.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   32.16 +// Lesser General Public License for more details.
   32.17 +//
   32.18 +// You should have received a copy of the GNU Lesser General Public
   32.19 +// License along with this library; if not, write to the Free Software
   32.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   32.21 +//
   32.22 +//
   32.23 +
   32.24 +using System;
   32.25 +
   32.26 +namespace IBBoard.WarFoundry
   32.27 +{
   32.28 +	public interface IWarFoundryObject
   32.29 +	{
   32.30 +		string ID { get; set; }
   32.31 +
   32.32 +		string Name { get; set;	}
   32.33 +	}
   32.34 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/api/Objects/IWarFoundryStagedLoadObject.cs	Fri Dec 19 15:57:51 2008 +0000
    33.3 @@ -0,0 +1,25 @@
    33.4 +using System;
    33.5 +using ICSharpCode.SharpZipLib.Zip;
    33.6 +using IBBoard.WarFoundry.API.Factories;
    33.7 +
    33.8 +namespace IBBoard.WarFoundry.API.Objects
    33.9 +{
   33.10 +	public interface IWarFoundryStagedLoadObject : IWarFoundryObject
   33.11 +	{	
   33.12 +		/// <summary>
   33.13 +		/// Checks whether the object has been fully loaded or whether only the first stage of loading has been performed.
   33.14 +		/// If the object is not fully loaded then the method must finish loading the object.
   33.15 +		/// </summary>
   33.16 +		void EnsureFullyLoaded();
   33.17 +		
   33.18 +		/// <value>
   33.19 +		/// Gets the <code>AbstractNativeWarFoundryFactory</code> that created the object.
   33.20 +		/// </value>
   33.21 +		AbstractNativeWarFoundryFactory Factory	{ get; }
   33.22 +		
   33.23 +		/// <value>
   33.24 +		/// Returns <code>true</code> if the object has been fully loaded with all data, else returns <code>false</code>
   33.25 +		/// </value>
   33.26 +		bool IsFullyLoaded { get; }
   33.27 +	}
   33.28 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/api/Objects/Race.cs	Fri Dec 19 15:57:51 2008 +0000
    34.3 @@ -0,0 +1,339 @@
    34.4 +// Race.cs
    34.5 +//
    34.6 +//  Copyright (C) 2008 IBBoard
    34.7 +//
    34.8 +// This library is free software; you can redistribute it and/or
    34.9 +// modify it under the terms of the GNU Lesser General Public
   34.10 +// License as published by the Free Software Foundation; either
   34.11 +// version 2.1 of the License, or (at your option) any later version.
   34.12 +//
   34.13 +// This library is distributed in the hope that it will be useful,
   34.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   34.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   34.16 +// Lesser General Public License for more details.
   34.17 +//
   34.18 +// You should have received a copy of the GNU Lesser General Public
   34.19 +// License along with this library; if not, write to the Free Software
   34.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   34.21 +//
   34.22 +//
   34.23 +
   34.24 +using System;
   34.25 +using System.Collections.Generic;
   34.26 +using System.IO;
   34.27 +using System.Xml;
   34.28 +using IBBoard.IO;
   34.29 +using IBBoard.WarFoundry.API.Factories;
   34.30 +
   34.31 +namespace IBBoard.WarFoundry.API.Objects
   34.32 +{
   34.33 +	public class Race : WarFoundryObject
   34.34 +	{		
   34.35 +		public static string SYSTEM_DEFAULT_RACE_ID = "GameDefault"; 
   34.36 +		
   34.37 +		private string subID;
   34.38 +		private string systemID;
   34.39 +		private GameSystem system;
   34.40 +		private Dictionary<Category, Dictionary<string, UnitType>> unitTypesByCat;
   34.41 +		private Dictionary<string, UnitType> unitTypes;
   34.42 +		private Dictionary<string, EquipmentItem> equipment;
   34.43 +		private Dictionary<string, Ability> abilities;
   34.44 +		private Category[] cats;
   34.45 +		private FileInfo sourceFile;
   34.46 +		
   34.47 +		public Race(string raceID, string raceName, string gameSystemID) : this(raceID, "", raceName, gameSystemID)
   34.48 +		{
   34.49 +		}
   34.50 +		
   34.51 +		public Race(string raceID, string raceSubID, string raceName, string gameSystemID) : base(raceID + (raceSubID!="" ? "_"+raceSubID : ""), raceName)
   34.52 +		{
   34.53 +			subID = (raceSubID == null ? "" : raceSubID);
   34.54 +			systemID = gameSystemID;
   34.55 +		}
   34.56 +
   34.57 +		public string SubID
   34.58 +		{
   34.59 +			get { return subID; }
   34.60 +			set { subID = (value == null ? "" : value.Trim()); }
   34.61 +		}
   34.62 +		
   34.63 +		public FileInfo SourceFile
   34.64 +		{
   34.65 +			get { return sourceFile; }
   34.66 +			set { sourceFile = value; }
   34.67 +		}
   34.68 +
   34.69 +		public GameSystem GameSystem
   34.70 +		{
   34.71 +			get
   34.72 +			{
   34.73 +				if (system == null)
   34.74 +				{
   34.75 +					system = WarFoundryLoader.GetDefault().GetGameSystem(systemID);
   34.76 +				}
   34.77 +				
   34.78 +				return system;
   34.79 +			}
   34.80 +			set
   34.81 +			{
   34.82 +				if (value == null)
   34.83 +				{
   34.84 +					throw new ArgumentException("Game system for a race cannot be null");
   34.85 +				}
   34.86 +				
   34.87 +				system = value;
   34.88 +			}
   34.89 +		}
   34.90 +
   34.91 +		/// <summary>
   34.92 +		/// Gets a category from its ID. Attempts to get the category from the race's overrides, or else it falls back to getting the Game System's category with that ID.
   34.93 +		/// </summary>
   34.94 +		/// <param name="id">
   34.95 +		/// The ID of the category to get
   34.96 +		/// </param>
   34.97 +		/// <returns>
   34.98 +		/// The <code>Category</code> with the specified ID, or null if one doesn't exist. 
   34.99 +		/// </returns>
  34.100 +		public Category GetCategory(string id)
  34.101 +		{
  34.102 +			Category[] categories = RaceCategories;
  34.103 +			Category cat = null;
  34.104 +		
  34.105 +			for (int i = 0; i<categories.Length; i++)
  34.106 +			{
  34.107 +				if (categories[i].ID == id)
  34.108 +				{
  34.109 +					cat = categories[i];
  34.110 +					break;
  34.111 +				}
  34.112 +			}
  34.113 +			
  34.114 +			return cat;
  34.115 +		}
  34.116 +
  34.117 +		/// <summary>
  34.118 +		/// Gets a category based on its index within the list. Ordering is defined by the game system definition or by the race's overrides.
  34.119 +		/// </summary>
  34.120 +		/// <param name="index">
  34.121 +		/// A <see cref="System.Int32"/>
  34.122 +		/// </param>
  34.123 +		/// <returns>
  34.124 +		/// A <see cref="Category"/>
  34.125 +		/// </returns>
  34.126 +		public virtual Category GetCategory(int index)
  34.127 +		{
  34.128 +			if (cats == null)
  34.129 +			{
  34.130 +				return GameSystem.GetCategory(index);
  34.131 +			}
  34.132 +			else
  34.133 +			{
  34.134 +				return Categories[index];
  34.135 +			}
  34.136 +		}
  34.137 +		
  34.138 +		public Category[] Categories
  34.139 +		{
  34.140 +			get 
  34.141 +			{ 
  34.142 +				return RaceCategories;
  34.143 +			}
  34.144 +			
  34.145 +			set 
  34.146 +			{
  34.147 +				RaceOverrideCategories = value;
  34.148 +			}
  34.149 +		}
  34.150 +		
  34.151 +		/*private virtual Category[] GetCategories()
  34.152 +		{
  34.153 +			if (cats==null)
  34.154 +			{
  34.155 +				return GameSystem.Categories;
  34.156 +			}
  34.157 +			else
  34.158 +			{
  34.159 +				return cats; 
  34.160 +			}
  34.161 +		}*/
  34.162 +		
  34.163 +		public void SetEquipmentItems(Dictionary<string, EquipmentItem> items)
  34.164 +		{
  34.165 +			equipment = items;
  34.166 +		}
  34.167 +
  34.168 +		public virtual EquipmentItem GetEquipmentItem(string id)
  34.169 +		{
  34.170 +			return (EquipmentItem)equipment[id];
  34.171 +		}
  34.172 +		
  34.173 +		public List<EquipmentItem> GetEquipmentList()
  34.174 +		{
  34.175 +			List<EquipmentItem> items = new List<EquipmentItem>();
  34.176 +			
  34.177 +			foreach (EquipmentItem item in equipment.Values)
  34.178 +			{
  34.179 +				items.Add(item);
  34.180 +			}
  34.181 +			
  34.182 +			return items;
  34.183 +		}
  34.184 +
  34.185 +		public virtual bool HasCategoryOverrides()
  34.186 +		{
  34.187 +			return cats!=null;
  34.188 +		}
  34.189 +		
  34.190 +		public void SetUnitTypes(Dictionary<string, UnitType> types)
  34.191 +		{
  34.192 +			unitTypes = types;
  34.193 +		}
  34.194 +
  34.195 +		public UnitType[] GetUnitTypes(Category cat)
  34.196 +		{
  34.197 +			if (unitTypesByCat==null)
  34.198 +			{				
  34.199 +				unitTypesByCat = new Dictionary<Category,Dictionary<string,UnitType>>();
  34.200 +				
  34.201 +				foreach (Category category in RaceCategories)
  34.202 +				{ 
  34.203 +					unitTypesByCat.Add(category, new Dictionary<string, UnitType>());
  34.204 +				}
  34.205 +				
  34.206 +				Dictionary<string,UnitType> catUnitTypes;
  34.207 +				
  34.208 +				foreach (UnitType unit in unitTypes.Values)
  34.209 +				{
  34.210 +					unitTypesByCat.TryGetValue(unit.MainCategory, out catUnitTypes);
  34.211 +
  34.212 +					if (catUnitTypes == null)
  34.213 +					{
  34.214 +						throw new InvalidFileException(String.Format("Unit type {0} with name {1} is a unit of an undefined category", unit.ID, unit.Name));
  34.215 +					}
  34.216 +
  34.217 +					catUnitTypes.Add(unit.ID, unit);
  34.218 +				}
  34.219 +			}
  34.220 +
  34.221 +			ICollection<UnitType> col = unitTypesByCat[cat].Values;
  34.222 +			UnitType[] toRet = new UnitType[col.Count];
  34.223 +			int i = 0;
  34.224 +
  34.225 +			foreach (UnitType type in col)
  34.226 +			{
  34.227 +				toRet[i++] = type;
  34.228 +			}
  34.229 +
  34.230 +			return toRet;
  34.231 +		}
  34.232 +
  34.233 +		public UnitType GetUnitType(string id)
  34.234 +		{
  34.235 +			return (UnitType)unitTypes[id];
  34.236 +		}
  34.237 +		
  34.238 +		public List<Ability> GetAbilityList()
  34.239 +		{
  34.240 +			List<Ability> items = new List<Ability>();
  34.241 +			
  34.242 +			foreach (Ability ability in abilities.Values)
  34.243 +			{
  34.244 +				items.Add(ability);
  34.245 +			}
  34.246 +			
  34.247 +			return items;
  34.248 +		}
  34.249 +		
  34.250 +		public void SetAbilities(Dictionary<string, Ability> newAbilities)
  34.251 +		{
  34.252 +			abilities = newAbilities;
  34.253 +		}
  34.254 +				
  34.255 +		public Ability GetAbility(string id)
  34.256 +		{
  34.257 +			Ability ability = null;
  34.258 +			abilities.TryGetValue(id, out ability);
  34.259 +			return ability;
  34.260 +		}
  34.261 +		
  34.262 +		protected Category[] RaceCategories
  34.263 +		{
  34.264 +			get
  34.265 +			{
  34.266 +				Category[] cats = RaceOverrideCategories;
  34.267 +				
  34.268 +				if (cats == null)
  34.269 +				{
  34.270 +					//No overrides, so load system categories
  34.271 +					cats = GameSystem.Categories;
  34.272 +				}
  34.273 +				
  34.274 +				return cats;
  34.275 +			}
  34.276 +		}
  34.277 +		
  34.278 +		protected virtual Category[] RaceOverrideCategories
  34.279 +		{
  34.280 +			get
  34.281 +			{
  34.282 +				return RaceRawOverrideCategories;
  34.283 +			}
  34.284 +			set
  34.285 +			{
  34.286 +				RaceRawOverrideCategories = value;
  34.287 +			}
  34.288 +		}
  34.289 +		
  34.290 +		protected Category[] RaceRawOverrideCategories
  34.291 +		{
  34.292 +			get { return cats; }
  34.293 +			set
  34.294 +			{
  34.295 +				if (value!=null && value.Length>0)
  34.296 +				{
  34.297 +					cats = value;
  34.298 +				}
  34.299 +				else
  34.300 +				{
  34.301 +					cats = null;
  34.302 +				}
  34.303 +			}
  34.304 +		}
  34.305 +		
  34.306 +		protected virtual Dictionary<string, UnitType> RaceUnitTypes
  34.307 +		{
  34.308 +			get { return RaceRawUnitTypes; }
  34.309 +			set	{ RaceRawUnitTypes = value; }
  34.310 +		}
  34.311 +		
  34.312 +		protected virtual Dictionary<string, EquipmentItem> RaceEquipment
  34.313 +		{
  34.314 +			get { return RaceRawEquipment; }
  34.315 +			set { RaceRawEquipment = value; }
  34.316 +		}
  34.317 +		
  34.318 +		protected virtual Dictionary<string, Ability> RaceAbilities
  34.319 +		{
  34.320 +			get { return RaceRawAbilities; }
  34.321 +			set { RaceRawAbilities = value; }
  34.322 +		}
  34.323 +		
  34.324 +		protected Dictionary<string, UnitType> RaceRawUnitTypes
  34.325 +		{
  34.326 +			get { return unitTypes; }
  34.327 +			set	{ unitTypes = value; }
  34.328 +		}
  34.329 +		
  34.330 +		protected Dictionary<string, EquipmentItem> RaceRawEquipment
  34.331 +		{
  34.332 +			get { return equipment; }
  34.333 +			set { equipment = value; }
  34.334 +		}
  34.335 +		
  34.336 +		protected Dictionary<string, Ability> RaceRawAbilities
  34.337 +		{
  34.338 +			get { return abilities; }
  34.339 +			set { abilities = value; }
  34.340 +		}
  34.341 +	}
  34.342 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/api/Objects/StagedLoadingGameSystem.cs	Fri Dec 19 15:57:51 2008 +0000
    35.3 @@ -0,0 +1,64 @@
    35.4 +// StagedLoadingGameSystem.cs
    35.5 +//
    35.6 +//  Copyright (C) 2008 IBBoard
    35.7 +//
    35.8 +// This library is free software; you can redistribute it and/or
    35.9 +// modify it under the terms of the GNU Lesser General Public
   35.10 +// License as published by the Free Software Foundation; either
   35.11 +// version 2.1 of the License, or (at your option) any later version.
   35.12 +//
   35.13 +// This library is distributed in the hope that it will be useful,
   35.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   35.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   35.16 +// Lesser General Public License for more details.
   35.17 +//
   35.18 +// You should have received a copy of the GNU Lesser General Public
   35.19 +// License along with this library; if not, write to the Free Software
   35.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   35.21 +//
   35.22 +//
   35.23 +
   35.24 +using System;
   35.25 +using IBBoard.WarFoundry.API.Factories;
   35.26 +
   35.27 +namespace IBBoard.WarFoundry.API.Objects
   35.28 +{	
   35.29 +	public class StagedLoadingGameSystem : GameSystem, IWarFoundryStagedLoadObject
   35.30 +	{		
   35.31 +		private AbstractNativeWarFoundryFactory creatingFactory;
   35.32 +		
   35.33 +		public StagedLoadingGameSystem(string systemID, string systemName, AbstractNativeWarFoundryFactory factory) : base(systemID, systemName)
   35.34 +		{
   35.35 +			creatingFactory = factory;
   35.36 +		}
   35.37 +		
   35.38 +		public AbstractNativeWarFoundryFactory Factory
   35.39 +		{
   35.40 +			get { return creatingFactory; }
   35.41 +		}
   35.42 +		
   35.43 +		public void EnsureFullyLoaded ()
   35.44 +		{
   35.45 +			if (!IsFullyLoaded)
   35.46 +			{
   35.47 +				Factory.CompleteLoading(this);
   35.48 +			}
   35.49 +		}
   35.50 +		
   35.51 +		public bool IsFullyLoaded
   35.52 +		{
   35.53 +			get { return RawSystemCategories != null && base.StandardSystemStatsID != null && base.SystemStats != null; }
   35.54 +		}
   35.55 +		
   35.56 +		protected override Category[] SystemCategories
   35.57 +		{
   35.58 +			get
   35.59 +			{
   35.60 +				EnsureFullyLoaded();
   35.61 +				return base.SystemCategories;
   35.62 +			}
   35.63 +			set { base.SystemCategories = value; }
   35.64 +		}
   35.65 +
   35.66 +	}
   35.67 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/api/Objects/StagedLoadingRace.cs	Fri Dec 19 15:57:51 2008 +0000
    36.3 @@ -0,0 +1,150 @@
    36.4 +// StagedLoadingRace.cs
    36.5 +//
    36.6 +//  Copyright (C) 2008 IBBoard
    36.7 +//
    36.8 +// This library is free software; you can redistribute it and/or
    36.9 +// modify it under the terms of the GNU Lesser General Public
   36.10 +// License as published by the Free Software Foundation; either
   36.11 +// version 2.1 of the License, or (at your option) any later version.
   36.12 +//
   36.13 +// This library is distributed in the hope that it will be useful,
   36.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   36.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   36.16 +// Lesser General Public License for more details.
   36.17 +//
   36.18 +// You should have received a copy of the GNU Lesser General Public
   36.19 +// License along with this library; if not, write to the Free Software
   36.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   36.21 +//
   36.22 +//
   36.23 +
   36.24 +using System;
   36.25 +using System.Collections.Generic;
   36.26 +using IBBoard.WarFoundry.API.Factories;
   36.27 +
   36.28 +namespace IBBoard.WarFoundry.API.Objects
   36.29 +{
   36.30 +	/// <summary>
   36.31 +	/// Summary description for StagedLoadingRace.
   36.32 +	/// </summary>
   36.33 +	public class StagedLoadingRace : Race, IWarFoundryStagedLoadObject
   36.34 +	{	
   36.35 +		private AbstractNativeWarFoundryFactory creatingFactory;
   36.36 +		
   36.37 +		public StagedLoadingRace(string raceID, string raceName, string gameSystemID, AbstractNativeWarFoundryFactory factory) : this(raceID, "", raceName, gameSystemID, factory)
   36.38 +		{
   36.39 +		}
   36.40 +		
   36.41 +		public StagedLoadingRace(string raceID, string raceSubID, string raceName, string gameSystemID, AbstractNativeWarFoundryFactory factory) : base(raceID, raceName, gameSystemID)
   36.42 +		{
   36.43 +			creatingFactory = factory;
   36.44 +		}
   36.45 +		
   36.46 +		public AbstractNativeWarFoundryFactory Factory
   36.47 +		{
   36.48 +			get { return creatingFactory; }
   36.49 +		}
   36.50 +		
   36.51 +		public void EnsureFullyLoaded ()
   36.52 +		{
   36.53 +			if (!IsFullyLoaded)
   36.54 +			{
   36.55 +				Factory.CompleteLoading(this);
   36.56 +			}
   36.57 +		}
   36.58 +		
   36.59 +		public bool IsFullyLoaded
   36.60 +		{
   36.61 +			get { return RaceRawOverrideCategories != null && RaceRawUnitTypes != null && RaceRawEquipment != null && RaceRawAbilities != null; }
   36.62 +		}
   36.63 +		
   36.64 +		protected override Category[] RaceOverrideCategories
   36.65 +		{
   36.66 +			get
   36.67 +			{
   36.68 +				EnsureFullyLoaded();
   36.69 +				return base.RaceOverrideCategories;
   36.70 +			}
   36.71 +		}
   36.72 +		
   36.73 +		protected override Dictionary<string, Ability> RaceAbilities
   36.74 +		{
   36.75 +			get
   36.76 +			{
   36.77 +				EnsureFullyLoaded();
   36.78 +				return base.RaceAbilities;
   36.79 +			}
   36.80 +			set
   36.81 +			{
   36.82 +				base.RaceAbilities = value;
   36.83 +			}
   36.84 +		}
   36.85 +		
   36.86 +		protected override Dictionary<string, EquipmentItem> RaceEquipment 
   36.87 +		{
   36.88 +			get
   36.89 +			{
   36.90 +				EnsureFullyLoaded();
   36.91 +				return base.RaceEquipment;
   36.92 +			}
   36.93 +			set
   36.94 +			{
   36.95 +				base.RaceEquipment = value;
   36.96 +			}
   36.97 +		}
   36.98 +
   36.99 +		protected override Dictionary<string, UnitType> RaceUnitTypes
  36.100 +		{
  36.101 +			get
  36.102 +			{
  36.103 +				EnsureFullyLoaded();
  36.104 +				return base.RaceUnitTypes;
  36.105 +			}
  36.106 +			set
  36.107 +			{
  36.108 +				base.RaceUnitTypes = value;
  36.109 +			}
  36.110 +		}
  36.111 +
  36.112 +
  36.113 +
  36.114 +		
  36.115 + 
  36.116 +		
  36.117 +		/*public void CompleteLoading(List<Category> categoriesList, Dictionary<string,UnitType> unitTypesList, Dictionary<string,EquipmentItem> equipmentList, Dictionary<string, Ability> abilityList)
  36.118 +		{
  36.119 +			logger.Debug("Preparing dictionaries");
  36.120 +			
  36.121 +			if (categoriesList != null && categoriesList.Count > 0)
  36.122 +			{
  36.123 +				cats = categoriesList.ToArray();
  36.124 +			}
  36.125 +			
  36.126 +			logger.Debug("Loading equipment");
  36.127 +			equipment = new Dictionary<string,EquipmentItem>();
  36.128 +
  36.129 +			foreach (string equipID in equipmentList.Keys)
  36.130 +			{
  36.131 +				equipment.Add(equipID, equipmentList[equipID]);
  36.132 +			}
  36.133 +			
  36.134 +			logger.Debug("Loading abilities");
  36.135 +			abilities = new Dictionary<string,Ability>();
  36.136 +			
  36.137 +			foreach (string abilityID in abilityList.Keys)
  36.138 +			{
  36.139 +				abilities.Add(abilityID, abilityList[abilityID]);
  36.140 +			}
  36.141 +			
  36.142 +			logger.Debug("Loading units");
  36.143 +			unitTypes = new Dictionary<string,UnitType>();
  36.144 +			
  36.145 +			foreach (string unitID in unitTypesList.Keys)
  36.146 +			{
  36.147 +				unitTypes.Add(unitID, unitTypesList[unitID]);
  36.148 +			}
  36.149 +			
  36.150 +			base.CompleteLoading();
  36.151 +		}*/
  36.152 +	}
  36.153 +}
  36.154 \ No newline at end of file
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/api/Objects/Stat.cs	Fri Dec 19 15:57:51 2008 +0000
    37.3 @@ -0,0 +1,31 @@
    37.4 +using System;
    37.5 +
    37.6 +namespace IBBoard.WarFoundry.API.Objects
    37.7 +{
    37.8 +	/// <summary>
    37.9 +	/// Summary description for Stat.
   37.10 +	/// </summary>
   37.11 +	public class Stat
   37.12 +	{
   37.13 +		private StatSlot parentStatSlot;
   37.14 +		private string statString;
   37.15 +
   37.16 +		public Stat(StatSlot parentSlot, string statValue)
   37.17 +		{
   37.18 +				parentStatSlot = parentSlot;
   37.19 +				statString = statValue;
   37.20 +		}
   37.21 +
   37.22 +		public StatSlot ParentSlot
   37.23 +		{
   37.24 +			get { return parentStatSlot; }
   37.25 +			set { parentStatSlot = value; }
   37.26 +		}
   37.27 +
   37.28 +		public string SlotValueString
   37.29 +		{
   37.30 +			get { return statString; }
   37.31 +			set { statString = (value == null ? "" : value); }
   37.32 +		}
   37.33 +	}
   37.34 +}
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/api/Objects/StatSlot.cs	Fri Dec 19 15:57:51 2008 +0000
    38.3 @@ -0,0 +1,33 @@
    38.4 +using System;
    38.5 +using System.Text.RegularExpressions;
    38.6 +using System.Xml;
    38.7 +using IBBoard;
    38.8 +
    38.9 +namespace IBBoard.WarFoundry.API.Objects
   38.10 +{
   38.11 +	/// <summary>
   38.12 +	/// Summary description for StatSlot.
   38.13 +	/// </summary>
   38.14 +	public class StatSlot
   38.15 +	{
   38.16 +		private string name;
   38.17 +		private SystemStats sysStats;
   38.18 +
   38.19 +		public StatSlot(String statName)
   38.20 +		{
   38.21 +			name = statName;
   38.22 +		}
   38.23 +
   38.24 +		public string Name
   38.25 +		{
   38.26 +			get { return name; }
   38.27 +			set { value = name; }
   38.28 +		}
   38.29 +		
   38.30 +		public SystemStats SystemStats
   38.31 +		{
   38.32 +			get { return sysStats; }
   38.33 +			set { sysStats = value; }
   38.34 +		}
   38.35 +	}
   38.36 +}
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/api/Objects/Stats.cs	Fri Dec 19 15:57:51 2008 +0000
    39.3 @@ -0,0 +1,94 @@
    39.4 +// Stats.cs
    39.5 +//
    39.6 +//  Copyright (C) 2008 IBBoard
    39.7 +//
    39.8 +// This library is free software; you can redistribute it and/or
    39.9 +// modify it under the terms of the GNU Lesser General Public
   39.10 +// License version 2.1 of the License as published by the Free
   39.11 +// Software Foundation.
   39.12 +//
   39.13 +// This library is distributed in the hope that it will be useful,
   39.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   39.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   39.16 +// Lesser General Public License for more details.
   39.17 +//
   39.18 +// You should have received a copy of the GNU Lesser General Public
   39.19 +// License along with this library; if not, write to the Free Software
   39.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   39.21 +//
   39.22 +//
   39.23 +
   39.24 +using System;
   39.25 +using System.Collections.Generic;
   39.26 +using IBBoard.Lang;
   39.27 +
   39.28 +namespace IBBoard.WarFoundry.API.Objects
   39.29 +{
   39.30 +	public class Stats
   39.31 +	{
   39.32 +		private Stat[] stats;
   39.33 +		private List<string> statOrder;
   39.34 +		private SystemStats sysStats;
   39.35 +		
   39.36 +		public Stats(SystemStats systemStats)
   39.37 +		{
   39.38 +			sysStats = systemStats;
   39.39 +		}
   39.40 +		
   39.41 +		public Stat[] StatsArray
   39.42 +		{
   39.43 +			get { return (Stat[])stats.Clone(); }
   39.44 +		}
   39.45 +		
   39.46 +		protected internal void SetStats(List<Stat> statList)
   39.47 +		{
   39.48 +			stats = statList.ToArray();
   39.49 +			statOrder = new List<string>();
   39.50 +			
   39.51 +			foreach (Stat stat in statList)
   39.52 +			{
   39.53 +				statOrder.Add(stat.ParentSlot.Name);
   39.54 +			}
   39.55 +		}
   39.56 +		
   39.57 +		public Stat this[string id]
   39.58 +		{
   39.59 +			get
   39.60 +			{
   39.61 +				Stat stat = null;
   39.62 +				int pos = statOrder.IndexOf(id);
   39.63 +				
   39.64 +				try
   39.65 +				{
   39.66 +					stat = this[pos];
   39.67 +				}
   39.68 +				catch (ArgumentException ex)
   39.69 +				{
   39.70 +					throw new ArgumentException(Translation.GetTranslation("InvalidStatPos", "Invalid statistic ID {0} for stats based on system stats set {1}", new object[]{id, sysStats.ID}), ex);
   39.71 +				}
   39.72 +				
   39.73 +				return stat;
   39.74 +			}
   39.75 +		}
   39.76 +		
   39.77 +		public Stat this[int pos]
   39.78 +		{
   39.79 +			get
   39.80 +			{
   39.81 +				if (pos < stats.Length && pos >= 0)
   39.82 +				{
   39.83 +					return stats[pos];
   39.84 +				}
   39.85 +				else
   39.86 +				{
   39.87 +					throw new ArgumentException(Translation.GetTranslation("InvalidStatPos", "Invalid statistic position {0} for stats based on system stats set {1}", new object[]{pos, sysStats.ID})); 
   39.88 +				}
   39.89 +			}
   39.90 +		}
   39.91 +		
   39.92 +		public int StatCount
   39.93 +		{
   39.94 +			get { return stats.Length; }
   39.95 +		}
   39.96 +	}
   39.97 +}
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/api/Objects/SystemStats.cs	Fri Dec 19 15:57:51 2008 +0000
    40.3 @@ -0,0 +1,56 @@
    40.4 +using System;
    40.5 +using System.Collections.Generic;
    40.6 +
    40.7 +namespace IBBoard.WarFoundry.API.Objects
    40.8 +{
    40.9 +	/// <summary>
   40.10 +	/// Summary description for SystemStats.
   40.11 +	/// </summary>
   40.12 +	public class SystemStats
   40.13 +	{
   40.14 +		private Dictionary<string, StatSlot> stats;
   40.15 +		private string id;
   40.16 +
   40.17 +		public SystemStats(string statsID, StatSlot[] statSlots)
   40.18 +		{
   40.19 +			id = statsID;
   40.20 +			stats = new Dictionary<string, StatSlot>();
   40.21 +			
   40.22 +			foreach (StatSlot slot in statSlots)
   40.23 +			{
   40.24 +				slot.SystemStats = this;
   40.25 +				stats[slot.Name] = slot;
   40.26 +			}
   40.27 +		}
   40.28 +
   40.29 +		public StatSlot[] StatSlots
   40.30 +		{
   40.31 +			get
   40.32 +			{
   40.33 +				StatSlot[] slots = new StatSlot[stats.Count];
   40.34 +				stats.Values.CopyTo(slots, 0);
   40.35 +				return slots;
   40.36 +			}
   40.37 +		}
   40.38 +		
   40.39 +		public StatSlot this[string key]
   40.40 +		{
   40.41 +			get 
   40.42 +			{
   40.43 +				StatSlot slot = null;
   40.44 +				stats.TryGetValue(key, out slot);
   40.45 +				return slot;
   40.46 +			}
   40.47 +		}
   40.48 +		
   40.49 +        public int SlotCount
   40.50 +        {
   40.51 +            get { return stats.Count; }
   40.52 +        }
   40.53 +		
   40.54 +		public string ID
   40.55 +		{
   40.56 +			get { return id; }
   40.57 +		}
   40.58 +	}
   40.59 +}
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/api/Objects/SystemStatsSet.cs	Fri Dec 19 15:57:51 2008 +0000
    41.3 @@ -0,0 +1,38 @@
    41.4 +using System;
    41.5 +using System.Collections.Generic;
    41.6 +
    41.7 +namespace IBBoard.WarFoundry.API.Objects
    41.8 +{
    41.9 +	public class SystemStatsSet
   41.10 +	{
   41.11 +		private Dictionary<string, SystemStats> statsMap;
   41.12 +		public SystemStatsSet(Dictionary<string, SystemStats> stats)
   41.13 +		{
   41.14 +			statsMap = stats;
   41.15 +		}
   41.16 +		
   41.17 +		public SystemStats this[string key]
   41.18 +		{
   41.19 +			get { return statsMap[key]; }
   41.20 +		
   41.21 +			set
   41.22 +			{
   41.23 +				if (statsMap.ContainsKey(key))
   41.24 +				{
   41.25 +					statsMap[key] = value;
   41.26 +				}
   41.27 +				else
   41.28 +				{
   41.29 +					throw new ArgumentException("Key must already exist for values to be set");
   41.30 +				}
   41.31 +			}
   41.32 +		}
   41.33 +		
   41.34 +		public string[] GetSystemStatsIDs()
   41.35 +		{
   41.36 +			string[] ids = new string[statsMap.Count];
   41.37 +			statsMap.Keys.CopyTo(ids, 0);
   41.38 +			return ids;
   41.39 +		}
   41.40 +	}
   41.41 +}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/api/Objects/Unit.cs	Fri Dec 19 15:57:51 2008 +0000
    42.3 @@ -0,0 +1,405 @@
    42.4 +using System;
    42.5 +using System.Collections;
    42.6 +using System.Text;
    42.7 +using System.Xml;
    42.8 +using IBBoard.Lang;
    42.9 +
   42.10 +namespace IBBoard.WarFoundry.API.Objects
   42.11 +{
   42.12 +	/// <summary>
   42.13 +	/// Summary description for UnitInstance.
   42.14 +	/// </summary>
   42.15 +	public class Unit : WarFoundryObject
   42.16 +	{
   42.17 +		private UnitType type;
   42.18 +		private int size;
   42.19 +		private Army army;
   42.20 +		private Race race;
   42.21 +		private double points;
   42.22 +		private ArmyCategory cat;
   42.23 +		private Hashtable equipment = new Hashtable();
   42.24 +		public event DoubleValChangedDelegate PointsValueChanged;
   42.25 +		public event IntValChangedDelegate UnitSizeChanged;
   42.26 +		public event FloatValChangedDelegate UnitEquipmentAmountChanged;
   42.27 +
   42.28 +		public Unit(UnitType unitType, Army parentArmy) : this(unitType, unitType.MinSize, parentArmy){}
   42.29 +
   42.30 +		public Unit(UnitType unitType, int startSize, Army parentArmy)
   42.31 +		{
   42.32 +			Army = parentArmy;
   42.33 +			type = unitType;
   42.34 +			Size = startSize;
   42.35 +			setInitialEquipment();
   42.36 +			CalcCost();
   42.37 +		}
   42.38 +
   42.39 +		protected override string DefaultName()
   42.40 +		{
   42.41 +			if (type != null)
   42.42 +			{
   42.43 +				if (size == 1)
   42.44 +				{
   42.45 +					return type.Name;
   42.46 +				}
   42.47 +				else
   42.48 +				{
   42.49 +					return String.Format(Translation.GetTranslation("defaultUnitName"), size, type.Name);
   42.50 +				}
   42.51 +			}
   42.52 +			else
   42.53 +			{
   42.54 +				return "Unknown Unit";
   42.55 +			}
   42.56 +		}
   42.57 +
   42.58 +		private void setInitialEquipment()
   42.59 +		{
   42.60 +			foreach (UnitEquipmentItem unitEquip in UnitType.GetEquipmentItems())
   42.61 +			{
   42.62 +				if (unitEquip.IsRequired)
   42.63 +				{
   42.64 +					if (CanEquipWithItem(unitEquip.ID))
   42.65 +					{
   42.66 +						EquipmentItem equipItem = unitEquip.EquipmentItem;
   42.67 +						equipment[unitEquip.ID] = equipItem.MinNumber;
   42.68 +					}
   42.69 +				}
   42.70 +			}
   42.71 +		}
   42.72 +
   42.73 +		private void CalcCost()
   42.74 +		{
   42.75 +			String oldName = HasDefaultName() ? Name : null;
   42.76 +			double oldpoints = points;
   42.77 +			points = type.CostPerTrooper * AdditionalTroopers + type.BaseUnitCost;
   42.78 +			UnitEquipmentItem unitEquipItem;
   42.79 +			EquipmentItem equipItem;
   42.80 +			float count;
   42.81 +
   42.82 +			foreach (string key in equipment.Keys)
   42.83 +			{
   42.84 +				unitEquipItem = UnitType.GetEquipmentItem(key);
   42.85 +				equipItem = unitEquipItem.EquipmentItem;
   42.86 +				count = (float)equipment[key];
   42.87 +				
   42.88 +				if (equipItem.IsRatioLimit)
   42.89 +				{
   42.90 +					if (unitEquipItem.RoundNumberUp)
   42.91 +					{
   42.92 +						points+= Math.Ceiling(size * count) * equipItem.Cost;
   42.93 +					}
   42.94 +					else
   42.95 +					{
   42.96 +						points+= Math.Floor(size * count) * equipItem.Cost;
   42.97 +					}
   42.98 +				}
   42.99 +				else
  42.100 +				{
  42.101 +					if (count == -1)
  42.102 +					{
  42.103 +						points+= size * equipItem.Cost;
  42.104 +					}
  42.105 +					else
  42.106 +					{
  42.107 +						points+= count * equipItem.Cost;
  42.108 +					}
  42.109 +				}
  42.110 +			}
  42.111 +
  42.112 +			if (oldpoints!=points)
  42.113 +			{
  42.114 +				OnPointsValueChanged(oldpoints, points);
  42.115 +			}
  42.116 +
  42.117 +			if (oldName!=null)
  42.118 +			{
  42.119 +				OnNameChanged(oldName, Name);
  42.120 +			}
  42.121 +		}
  42.122 +		
  42.123 +		public int AdditionalTroopers
  42.124 +		{
  42.125 +			get { return Math.Max(Size - type.BaseSize, 0); }
  42.126 +		}
  42.127 +
  42.128 +		public int Size
  42.129 +		{
  42.130 +			get { return size; }
  42.131 +			set 
  42.132 +			{
  42.133 +				if (value!=size)
  42.134 +				{
  42.135 +					int oldValue = size;
  42.136 +					size = (value>0 ? value : 1);
  42.137 +					CalcCost();
  42.138 +					OnUnitSizeChanged(oldValue, size);
  42.139 +				}
  42.140 +			}
  42.141 +		}
  42.142 +
  42.143 +		public UnitType UnitType
  42.144 +		{
  42.145 +			get { return type; }
  42.146 +		}
  42.147 +
  42.148 +		public Army Army
  42.149 +		{
  42.150 +			get { return army; }
  42.151 +			set 
  42.152 +			{
  42.153 +				army = value;
  42.154 +
  42.155 +				if (army == null)
  42.156 +				{
  42.157 +					Category = null;
  42.158 +				}
  42.159 +			}
  42.160 +		}
  42.161 +
  42.162 +		public Race Race
  42.163 +		{
  42.164 +			get { return race; }
  42.165 +			set { race = value; }
  42.166 +		}
  42.167 +
  42.168 +		public ArmyCategory Category
  42.169 +		{
  42.170 +			get 
  42.171 +			{ 
  42.172 +				if (cat==null)
  42.173 +				{
  42.174 +					if (Army!=null)
  42.175 +					{
  42.176 +						return Army.GetCategory(UnitType.MainCategory);
  42.177 +					}
  42.178 +					else
  42.179 +					{
  42.180 +						return null;
  42.181 +					}
  42.182 +				}
  42.183 +				else
  42.184 +				{
  42.185 +					return cat; 
  42.186 +				}
  42.187 +			}
  42.188 +			set { cat = value; }
  42.189 +		}
  42.190 +
  42.191 +		public double PointsValue
  42.192 +		{
  42.193 +			get 
  42.194 +			{
  42.195 +				if (points == 0)
  42.196 +				{
  42.197 +					CalcCost();
  42.198 +				}
  42.199 +
  42.200 +				return points;
  42.201 +			}
  42.202 +		}
  42.203 +
  42.204 +		public UnitEquipmentItem[] GetAllowedOptionalEquipment()
  42.205 +		{
  42.206 +			ArrayList list = new ArrayList();
  42.207 +
  42.208 +			foreach (UnitEquipmentItem item in UnitType.GetEquipmentItems())
  42.209 +			{
  42.210 +				if (!item.IsRequired)
  42.211 +				{
  42.212 +					list.Add(item);
  42.213 +				}
  42.214 +			}
  42.215 +
  42.216 +			return (UnitEquipmentItem[])list.ToArray(typeof(UnitEquipmentItem));
  42.217 +		}
  42.218 +
  42.219 +		public UnitEquipmentItem[] GetEquipment()
  42.220 +		{
  42.221 +			UnitEquipmentItem[] items = new UnitEquipmentItem[equipment.Count];
  42.222 +			int i = 0;
  42.223 +
  42.224 +			foreach (String itemID in equipment.Keys)
  42.225 +			{
  42.226 +				items[i++] = UnitType.GetEquipmentItem(itemID);
  42.227 +			}
  42.228 +
  42.229 +			return items;
  42.230 +		}
  42.231 +
  42.232 +		public UnitEquipmentItem[] GetRequiredEquipment()
  42.233 +		{
  42.234 +			ArrayList list = new ArrayList();
  42.235 +			UnitEquipmentItem item;
  42.236 +
  42.237 +			foreach(String itemID in equipment.Keys)
  42.238 +			{
  42.239 +				item = UnitType.GetEquipmentItem(itemID);
  42.240 +
  42.241 +				if (item.IsRequired)
  42.242 +				{
  42.243 +					list.Add(item);
  42.244 +				}
  42.245 +			}
  42.246 +
  42.247 +			return (UnitEquipmentItem[])list.ToArray(typeof(UnitEquipmentItem));
  42.248 +		}
  42.249 +
  42.250 +		public float GetEquipmentAmount(UnitEquipmentItem item)
  42.251 +		{
  42.252 +			return GetEquipmentAmount(item.EquipmentItem.ID);
  42.253 +		}
  42.254 +
  42.255 +		public float GetEquipmentAmount(string equipID)
  42.256 +		{
  42.257 +			if (equipment.ContainsKey(equipID))
  42.258 +			{
  42.259 +				return (float)equipment[equipID];
  42.260 +			}
  42.261 +			else
  42.262 +			{
  42.263 +				return 0;
  42.264 +			}
  42.265 +		}
  42.266 +
  42.267 +		public void SetEquipmentAmount(string equipID, float amount)
  42.268 +		{
  42.269 +			UnitEquipmentItem equip = UnitType.GetEquipmentItem(equipID);
  42.270 +
  42.271 +			if (equip == null)
  42.272 +			{
  42.273 +				throw new InvalidOperationException("No such equipment ID "+equipID+" for unit "+ID);
  42.274 +			}
  42.275 +
  42.276 +			if (equip.EquipmentItem.IsRatioLimit)
  42.277 +			{
  42.278 +				if (amount > 1)
  42.279 +				{
  42.280 +					amount = 1;
  42.281 +				}
  42.282 +				else if (amount < 0)
  42.283 +				{
  42.284 +					amount = 0;
  42.285 +				}
  42.286 +				//else what was passed in was okay
  42.287 +			}
  42.288 +			else
  42.289 +			{
  42.290 +				if (amount >=1 || amount == -1)
  42.291 +				{
  42.292 +					amount = (float)Math.Round(amount);
  42.293 +				}
  42.294 +				else
  42.295 +				{
  42.296 +					amount = 0;
  42.297 +				}
  42.298 +			}
  42.299 +
  42.300 +			float oldAmount = 0;
  42.301 +
  42.302 +			if (equipment.ContainsKey(equipID))
  42.303 +			{
  42.304 +				oldAmount = (float)equipment[equipID];
  42.305 +			}
  42.306 +
  42.307 +			if (amount!=oldAmount)
  42.308 +			{
  42.309 +				if (amount > 0 || amount == -1)
  42.310 +				{
  42.311 +					equipment[equipID] = amount;
  42.312 +				}
  42.313 +				else
  42.314 +				{
  42.315 +					equipment.Remove(equipID);
  42.316 +				}
  42.317 +
  42.318 +				OnUnitEquipmentAmountChanged(equip, oldAmount, amount);
  42.319 +				CalcCost();
  42.320 +			}
  42.321 +		}
  42.322 +
  42.323 +		public bool CanEquipWithItem(string equipID)
  42.324 +		{
  42.325 +			string mutex = UnitType.GetEquipmentItem(equipID).MutexGroup;
  42.326 +
  42.327 +			if (mutex == "")
  42.328 +			{
  42.329 +				return true;
  42.330 +			}
  42.331 +
  42.332 +			foreach (string itemID in equipment.Keys)
  42.333 +			{
  42.334 +				if (UnitType.GetEquipmentItem(itemID).MutexGroup == mutex)
  42.335 +				{
  42.336 +					return false;
  42.337 +				}
  42.338 +			}
  42.339 +
  42.340 +			return true;
  42.341 +		}
  42.342 +
  42.343 +		private void OnPointsValueChanged(double oldValue, double newValue)
  42.344 +		{
  42.345 +			if (PointsValueChanged!=null)
  42.346 +			{
  42.347 +				PointsValueChanged(this, oldValue, newValue);
  42.348 +			}
  42.349 +		}
  42.350 +
  42.351 +		private void OnUnitSizeChanged(int oldValue, int newValue)
  42.352 +		{
  42.353 +			if (UnitSizeChanged!=null)
  42.354 +			{
  42.355 +				UnitSizeChanged(this, oldValue, newValue);
  42.356 +			}
  42.357 +		}
  42.358 +
  42.359 +		private void OnUnitEquipmentAmountChanged(UnitEquipmentItem equip, float oldValue, float newValue)
  42.360 +		{
  42.361 +			if (UnitEquipmentAmountChanged!=null)
  42.362 +			{
  42.363 +				UnitEquipmentAmountChanged(equip, oldValue, newValue);
  42.364 +			}
  42.365 +		}
  42.366 +
  42.367 +		public Stats UnitStats
  42.368 +		{
  42.369 +			get { return UnitType.UnitStats; }
  42.370 +		}
  42.371 +
  42.372 +		/*public override string ToXmlString()
  42.373 +		{
  42.374 +			StringBuilder sb = new StringBuilder();
  42.375 +			float amount;
  42.376 +
  42.377 +			foreach(string key in equipment.Keys)
  42.378 +			{
  42.379 +				amount = (float)equipment[key];
  42.380 +
  42.381 +				if (amount > 0 || amount == -1)
  42.382 +				{
  42.383 +					sb.Append("<equipItem id=\""+key+"\" amount=\""+amount+"\" />");
  42.384 +				}
  42.385 +			}
  42.386 +
  42.387 +			string equipmentString;
  42.388 +
  42.389 +			if (sb.Length > 0)
  42.390 +			{
  42.391 +				equipmentString = "<equipment>"+sb.ToString()+"</equipment>";
  42.392 +			}
  42.393 +			else
  42.394 +			{
  42.395 +				equipmentString = "";
  42.396 +			}
  42.397 +
  42.398 +			if (equipmentString == "")
  42.399 +			{
  42.400 +				return "<unit id=\""+ID+"\" unitType=\""+UnitType.ID+"\" unitName=\""+name+"\" size=\""+Size+"\" />";
  42.401 +			}
  42.402 +			else
  42.403 +			{
  42.404 +				return "<unit id=\""+ID+"\" unitType=\""+UnitType.ID+"\" unitName=\""+name+"\" size=\""+Size+"\">"+equipmentString+"</unit>";
  42.405 +			}
  42.406 +		}*/
  42.407 +	}
  42.408 +}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/api/Objects/UnitEquipmentItem.cs	Fri Dec 19 15:57:51 2008 +0000
    43.3 @@ -0,0 +1,81 @@
    43.4 +using System;
    43.5 +using System.Xml;
    43.6 +
    43.7 +namespace IBBoard.WarFoundry.API.Objects
    43.8 +{
    43.9 +	/// <summary>
   43.10 +	/// Summary description for UnitEquipmentItem.
   43.11 +	/// </summary>
   43.12 +	public class UnitEquipmentItem : WarFoundryObject
   43.13 +	{
   43.14 +		private bool required, roundUp;
   43.15 +		private string mutexGroup;
   43.16 +		private UnitType unitType;
   43.17 +
   43.18 +		/*public UnitEquipmentItem(XmlElement node, UnitType equipForType)
   43.19 +		{
   43.20 +			EquipmentForUnit = equipForType;
   43.21 +			ID = node.GetAttribute("id");
   43.22 +			IsRequired = bool.Parse(node.GetAttribute("required"));
   43.23 +			RoundNumberUp = "up".Equals(node.GetAttribute("roundDirection").ToLower());
   43.24 +			MutexGroup = node.GetAttribute("exclusivityGroup");
   43.25 +		}*/
   43.26 +		protected UnitEquipmentItem(UnitType equipForType)
   43.27 +		{
   43.28 +			EquipmentForUnit = equipForType;
   43.29 +		}
   43.30 +
   43.31 +		public bool IsRequired
   43.32 +		{
   43.33 +			get { return required; }
   43.34 +			set { required = value; }
   43.35 +		}
   43.36 +
   43.37 +		public bool RoundNumberUp
   43.38 +		{
   43.39 +			get { return roundUp; }
   43.40 +			set { roundUp = value; }
   43.41 +		}
   43.42 +
   43.43 +		public string MutexGroup
   43.44 +		{
   43.45 +			get { return mutexGroup; }
   43.46 +			set { mutexGroup = (value == null ? "" : value.Trim()); }
   43.47 +		}
   43.48 +
   43.49 +		public UnitType EquipmentForUnit
   43.50 +		{
   43.51 +			get { return unitType; }
   43.52 +			set 
   43.53 +			{ 
   43.54 +				if (value != null)
   43.55 +				{
   43.56 +					unitType = value;
   43.57 +				}
   43.58 +			}
   43.59 +		}
   43.60 +
   43.61 +		public EquipmentItem EquipmentItem
   43.62 +		{
   43.63 +			get { return EquipmentForUnit == null ? null : EquipmentForUnit.Race.GetEquipmentItem(ID); }
   43.64 +		}
   43.65 +
   43.66 +		public override string ToString()
   43.67 +		{
   43.68 +			return EquipmentItem.Name+ " ("+EquipmentItem.Cost+"pts each)";
   43.69 +		}
   43.70 +
   43.71 +		public bool HasAlternatives()
   43.72 +		{
   43.73 +			if (MutexGroup=="")
   43.74 +			{
   43.75 +				return false;
   43.76 +			}
   43.77 +			else
   43.78 +			{
   43.79 +				//If the number of items in the MutEx group is greater than one then it must be this item plus another
   43.80 +				return EquipmentForUnit.GetEquipmentItemsByExclusionGroup(MutexGroup).Length > 1;
   43.81 +			}
   43.82 +		}
   43.83 +	}
   43.84 +}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/api/Objects/UnitEquipmentItemObj.cs	Fri Dec 19 15:57:51 2008 +0000
    44.3 @@ -0,0 +1,68 @@
    44.4 +using System;
    44.5 +using System.Collections;
    44.6 +
    44.7 +namespace IBBoard.WarFoundry.API.Objects
    44.8 +{
    44.9 +	/// <summary>
   44.10 +	/// Summary description for UnitEquipmentItemObj.
   44.11 +	/// </summary>
   44.12 +	public class UnitEquipmentItemObj
   44.13 +	{
   44.14 +		private Unit unit;
   44.15 +		private UnitEquipmentItem item;
   44.16 +		private EquipmentItem equip;
   44.17 +
   44.18 +		private static Hashtable equipObjs = new Hashtable();
   44.19 +
   44.20 +		private UnitEquipmentItemObj(Unit unit, UnitEquipmentItem unitItem)
   44.21 +		{
   44.22 +			this.unit = unit;
   44.23 +			item = unitItem;
   44.24 +			equip = item.EquipmentItem;
   44.25 +		}
   44.26 +
   44.27 +		public static UnitEquipmentItemObj GetEquipObj(Unit unit, UnitEquipmentItem unitItem)
   44.28 +		{
   44.29 +			if (!equipObjs.ContainsKey(unitItem))
   44.30 +			{
   44.31 +				equipObjs[unitItem] = new UnitEquipmentItemObj(unit, unitItem);
   44.32 +			}
   44.33 +			
   44.34 +			return (UnitEquipmentItemObj)equipObjs[unitItem];
   44.35 +		}
   44.36 +
   44.37 +		public override string ToString()
   44.38 +		{
   44.39 +			return String.Format("{0} (For {1} at {2}pts each)", equip.Name, FormatEquipmentAmount(unit, equip), equip.Cost);
   44.40 +		}
   44.41 +
   44.42 +		public UnitEquipmentItem Item
   44.43 +		{
   44.44 +			get { return item; }
   44.45 +		}
   44.46 +
   44.47 +		public static string FormatEquipmentAmount(Unit unit, EquipmentItem equip)
   44.48 +		{
   44.49 +			return FormatEquipmentAmount(equip, unit.GetEquipmentAmount(equip.ID));
   44.50 +		}
   44.51 +
   44.52 +		public static string FormatEquipmentAmount(EquipmentItem equip, float amount)
   44.53 +		{
   44.54 +			if (equip.IsRatioLimit)
   44.55 +			{
   44.56 +				return Math.Round(amount * 100) + "%";
   44.57 +			}
   44.58 +			else
   44.59 +			{
   44.60 +				if (amount == -1)
   44.61 +				{
   44.62 +					return "all";
   44.63 +				}
   44.64 +				else
   44.65 +				{
   44.66 +					return amount.ToString();
   44.67 +				}
   44.68 +			}
   44.69 +		}
   44.70 +	}
   44.71 +}
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/api/Objects/UnitType.cs	Fri Dec 19 15:57:51 2008 +0000
    45.3 @@ -0,0 +1,222 @@
    45.4 +using System;
    45.5 +using System.Collections;
    45.6 +using System.Collections.Generic;
    45.7 +using System.Xml;
    45.8 +using IBBoard.Logging;
    45.9 +using IBBoard.WarFoundry.API.Requirements;
   45.10 +
   45.11 +namespace IBBoard.WarFoundry.API.Objects
   45.12 +{
   45.13 +	/// <summary>
   45.14 +	/// Summary description for Unit.
   45.15 +	/// </summary>
   45.16 +	public class UnitType : WarFoundryObject
   45.17 +	{
   45.18 +		protected Category mainCat;
   45.19 +		protected string mainCatID;
   45.20 +		protected Category[] categories;
   45.21 +		protected string[] categoryIDs;
   45.22 +		protected Race race;
   45.23 +		protected int min, max, baseSize = 0;
   45.24 +		protected int minSize, maxSize;
   45.25 +		protected double baseUnitCost;
   45.26 +		protected double costPerTrooper;
   45.27 +		protected Stats stats;
   45.28 +		protected UnitRequirement[] requirements;
   45.29 +		protected Hashtable equipment = new Hashtable();
   45.30 +		protected Hashtable equipmentExclusionGroups = new Hashtable();
   45.31 +		protected ArrayList equipmentKeyOrder = new ArrayList();
   45.32 +
   45.33 +		public UnitType(string id, string typeName, string mainCategoryID, string[] allCategoryIDs, int minNum, int maxNum, int minimumSize, int maximumSize, double unitCost, double trooperCost, Stats unitStats, UnitRequirement[] unitRequirements, Race parentRace) : base(id, typeName)
   45.34 +		{
   45.35 +			mainCatID = mainCategoryID;
   45.36 +			categoryIDs = allCategoryIDs;
   45.37 +			race = parentRace;
   45.38 +			
   45.39 +			if (minNum > maxNum && maxNum!=-1)
   45.40 +			{
   45.41 +				min = maxNum;
   45.42 +				LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum number greater than their maximum number.", typeName, id);
   45.43 +			}
   45.44 +			else
   45.45 +			{
   45.46 +				min = (minNum >= 0 ? minNum : 0);
   45.47 +			}
   45.48 +			
   45.49 +			max = maxNum;
   45.50 +			
   45.51 +			if (minimumSize > maximumSize && maximumSize!=-1)
   45.52 +			{
   45.53 +				minSize = maximumSize;
   45.54 +				LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum size greater than their maximum size.", typeName, id);
   45.55 +			}
   45.56 +			else
   45.57 +			{
   45.58 +				minSize = (minimumSize >= 0 ? minimumSize : 0);
   45.59 +			}
   45.60 +			
   45.61 +			maxSize = maximumSize;
   45.62 +			baseUnitCost = unitCost;
   45.63 +			costPerTrooper = trooperCost;
   45.64 +			requirements = unitRequirements;
   45.65 +			stats = unitStats;
   45.66 +		}
   45.67 +
   45.68 +		public Race Race
   45.69 +		{
   45.70 +			get { return race; }
   45.71 +		}
   45.72 +
   45.73 +		public virtual Category MainCategory
   45.74 +		{
   45.75 +			get
   45.76 +			{
   45.77 +				if (mainCat == null)
   45.78 +				{
   45.79 +					LogNotifier.Debug(GetType(), Name+" main category: "+mainCatID);
   45.80 +					mainCat = Race.GetCategory(mainCatID);
   45.81 +				}
   45.82 +					
   45.83 +				return mainCat;
   45.84 +			}
   45.85 +		}
   45.86 +		
   45.87 +		public virtual Category[] Categories
   45.88 +		{
   45.89 +			get 
   45.90 +			{
   45.91 +				if (categories == null)
   45.92 +				{
   45.93 +					categories = new Category[categoryIDs.Length];
   45.94 +					
   45.95 +					for (int i = 0; i<categoryIDs.Length; i++)
   45.96 +					{
   45.97 +						categories[i] = Race.GetCategory(categoryIDs[i]);
   45.98 +					}
   45.99 +				}
  45.100 +				
  45.101 +				return categories;
  45.102 +			}
  45.103 +		}
  45.104 +
  45.105 +		public int MinSize
  45.106 +		{
  45.107 +			get { return minSize; }
  45.108 +		}
  45.109 +
  45.110 +		public int MaxSize
  45.111 +		{
  45.112 +			get { return maxSize; }
  45.113 +		}
  45.114 +		
  45.115 +		public int BaseSize
  45.116 +		{
  45.117 +			get { return baseSize; }
  45.118 +		}
  45.119 +
  45.120 +		public int MinNumber
  45.121 +		{
  45.122 +			get { return min; }
  45.123 +		}
  45.124 +
  45.125 +		public int MaxNumber
  45.126 +		{
  45.127 +			get { return max; }
  45.128 +		}
  45.129 +		
  45.130 +		public double BaseUnitCost
  45.131 +		{
  45.132 +			get { return baseUnitCost; }
  45.133 +		}
  45.134 +
  45.135 +		public double CostPerTrooper
  45.136 +		{
  45.137 +			get { return costPerTrooper; }
  45.138 +		}
  45.139 +
  45.140 +		protected override string DefaultName()
  45.141 +		{
  45.142 +			throw new InvalidOperationException("Unit type with id "+id+" did not have a name specified");
  45.143 +		}
  45.144 +
  45.145 +		public Stats UnitStats
  45.146 +		{
  45.147 +			get 
  45.148 +			{
  45.149 +				return stats;
  45.150 +			}
  45.151 +		}
  45.152 +
  45.153 +		public UnitEquipmentItem GetEquipmentItem(string id)
  45.154 +		{
  45.155 +			return (UnitEquipmentItem)equipment[id];
  45.156 +		}
  45.157 +
  45.158 +		public UnitEquipmentItem[] GetEquipmentItems()
  45.159 +		{
  45.160 +			UnitEquipmentItem[] items = new UnitEquipmentItem[equipment.Count];
  45.161 +			int i = 0;
  45.162 +
  45.163 +			foreach (string itemID in equipmentKeyOrder)
  45.164 +			{
  45.165 +				items[i++] = (UnitEquipmentItem)equipment[itemID];
  45.166 +			}
  45.167 +
  45.168 +			return items;
  45.169 +		}
  45.170 +		
  45.171 +		public List<FailedUnitRequirement> CanAddToArmy(Army army)
  45.172 +		{
  45.173 +			List<FailedUnitRequirement> failures = new List<FailedUnitRequirement>();
  45.174 +			
  45.175 +			if (requirements!=null && requirements.Length > 0)
  45.176 +			{
  45.177 +				foreach (UnitRequirement requirement in requirements)
  45.178 +				{
  45.179 +					FailedUnitRequirement failure = (FailedUnitRequirement)requirement.CanAddToWarFoundryObject(army);
  45.180 +					
  45.181 +					if (failure!=null)
  45.182 +					{
  45.183 +						failures.Add(failure);
  45.184 +					}
  45.185 +				}
  45.186 +			}
  45.187 +			
  45.188 +			return failures;
  45.189 +		}
  45.190 +		
  45.191 +		public List<FailedUnitRequirement> CanRemoveFromArmy(Army army)
  45.192 +		{
  45.193 +			List<FailedUnitRequirement> failures = new List<FailedUnitRequirement>();
  45.194 +			
  45.195 +			if (requirements!=null && requirements.Length > 0)
  45.196 +			{
  45.197 +				foreach (UnitRequirement requirement in requirements)
  45.198 +				{
  45.199 +					FailedUnitRequirement failure = (FailedUnitRequirement)requirement.CanRemoveFromWarFoundryObject(army);
  45.200 +					
  45.201 +					if (failure!=null)
  45.202 +					{
  45.203 +						failures.Add(failure);
  45.204 +					}
  45.205 +				}
  45.206 +			}
  45.207 +			
  45.208 +			return failures;
  45.209 +		}
  45.210 +
  45.211 +		public UnitEquipmentItem[] GetEquipmentItemsByExclusionGroup(string group)
  45.212 +		{
  45.213 +			ArrayList list = (ArrayList)equipmentExclusionGroups[group];
  45.214 +
  45.215 +			if (list == null)
  45.216 +			{
  45.217 +				return new UnitEquipmentItem[0];
  45.218 +			}
  45.219 +			else
  45.220 +			{
  45.221 +				return (UnitEquipmentItem[])list.ToArray(typeof(UnitEquipmentItem));
  45.222 +			}
  45.223 +		}
  45.224 +	}
  45.225 +}
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/api/Objects/WarFoundryObject.cs	Fri Dec 19 15:57:51 2008 +0000
    46.3 @@ -0,0 +1,88 @@
    46.4 +using System;
    46.5 +
    46.6 +namespace IBBoard.WarFoundry.API.Objects
    46.7 +{
    46.8 +	/// <summary>
    46.9 +	/// Summary description for WarFoundryObject.
   46.10 +	/// </summary>
   46.11 +	public abstract class WarFoundryObject : IWarFoundryObject
   46.12 +	{
   46.13 +		protected string name, id;
   46.14 +		public event StringValChangedDelegate NameChanged;
   46.15 +		
   46.16 +		protected WarFoundryObject(){}
   46.17 +				
   46.18 +		protected WarFoundryObject(string objName) : this()
   46.19 +		{
   46.20 +			Name = objName;
   46.21 +		}
   46.22 +		
   46.23 +		protected WarFoundryObject(string objId, string objName) : this(objName)
   46.24 +		{
   46.25 +			ID = objId;
   46.26 +		}	
   46.27 +
   46.28 +		public virtual string ID
   46.29 +		{
   46.30 +			get
   46.31 +			{
   46.32 +				if (id == null)
   46.33 +				{
   46.34 +					id = GenerateID();
   46.35 +				}
   46.36 +				
   46.37 +				return id;
   46.38 +			}
   46.39 +			
   46.40 +			set { id = (value == null ? GenerateID() : value.Trim()); }
   46.41 +		}
   46.42 +
   46.43 +		public virtual string Name
   46.44 +		{
   46.45 +			get 
   46.46 +			{
   46.47 +				if (HasDefaultName())
   46.48 +				{
   46.49 +					return DefaultName();
   46.50 +				}
   46.51 +				else
   46.52 +				{
   46.53 +					return name;
   46.54 +				} 
   46.55 +			}
   46.56 +			set 
   46.57 +			{ 
   46.58 +				string oldValue = name;
   46.59 +				name = value;
   46.60 +
   46.61 +				if (name!=oldValue)
   46.62 +				{
   46.63 +					OnNameChanged(oldValue, name);
   46.64 +				}
   46.65 +			}
   46.66 +		}
   46.67 +
   46.68 +		protected bool HasDefaultName()
   46.69 +		{
   46.70 +			return (name == null || name == "");
   46.71 +		}
   46.72 +
   46.73 +		protected void OnNameChanged(string oldValue, string newValue)
   46.74 +		{
   46.75 +			if (NameChanged!=null)
   46.76 +			{
   46.77 +				NameChanged(this, oldValue, newValue);
   46.78 +			}
   46.79 +		}
   46.80 +
   46.81 +		protected virtual string DefaultName()
   46.82 +		{
   46.83 +			return "-";
   46.84 +		}
   46.85 +
   46.86 +		protected string GenerateID()
   46.87 +		{
   46.88 +			return "ID" + UnixTimestamp.GetTimestamp(DateTime.Now) + "." + DateTime.Now.Millisecond;
   46.89 +		}
   46.90 +	}
   46.91 +}
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/api/Requirements/AbstractArmyRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    47.3 @@ -0,0 +1,68 @@
    47.4 +// Requirement.cs
    47.5 +//
    47.6 +//  Copyright (C) 2008 IBBoard
    47.7 +//
    47.8 +// This library is free software; you can redistribute it and/or
    47.9 +// modify it under the terms of the GNU Lesser General Public
   47.10 +// License version 2.1 of the License as published by the Free
   47.11 +// Software Foundation.
   47.12 +//
   47.13 +// This library is distributed in the hope that it will be useful,
   47.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   47.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   47.16 +// Lesser General Public License for more details.
   47.17 +//
   47.18 +// You should have received a copy of the GNU Lesser General Public
   47.19 +// License along with this library; if not, write to the Free Software
   47.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   47.21 +//
   47.22 +//
   47.23 +
   47.24 +using System;
   47.25 +using System.Collections.Generic;
   47.26 +using IBBoard.WarFoundry.API.Objects;
   47.27 +
   47.28 +
   47.29 +namespace IBBoard.WarFoundry.API.Requirements
   47.30 +{	
   47.31 +	/// <summary>
   47.32 +	/// Abstract class for any requirement for adding an object to an army, e.g. adding units.
   47.33 +	/// </summary>
   47.34 +	public abstract class AbstractArmyRequirement : AbstractRequirement
   47.35 +	{		
   47.36 +		protected abstract AbstractFailedRequirement CanAddToArmy(Army army);
   47.37 +		protected abstract AbstractFailedRequirement CanRemoveFromArmy(Army army);
   47.38 +		
   47.39 +		public override AbstractFailedRequirement CanAddToWarFoundryObject (WarFoundryObject obj)
   47.40 +		{
   47.41 +			AbstractFailedRequirement fail = null;
   47.42 +			
   47.43 +			if (obj is Army)
   47.44 +			{
   47.45 +				fail = CanAddToArmy((Army)obj);
   47.46 +			}
   47.47 +			else
   47.48 +			{
   47.49 +				fail = new FailedRequirement(this);
   47.50 +			}
   47.51 +			
   47.52 +			return fail;
   47.53 +		}
   47.54 +		
   47.55 +		public override AbstractFailedRequirement CanRemoveFromWarFoundryObject (WarFoundryObject obj)
   47.56 +		{
   47.57 +			AbstractFailedRequirement fail = null;
   47.58 +			
   47.59 +			if (obj is Army)
   47.60 +			{
   47.61 +				fail = CanRemoveFromArmy((Army)obj);
   47.62 +			}
   47.63 +			else
   47.64 +			{
   47.65 +				fail = new FailedRequirement(this);
   47.66 +			}
   47.67 +			
   47.68 +			return fail;
   47.69 +		}
   47.70 +	}
   47.71 +}
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/api/Requirements/AbstractFailedRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    48.3 @@ -0,0 +1,36 @@
    48.4 +// AbstractFailedRequirement.cs
    48.5 +//
    48.6 +//  Copyright (C) 2008 IBBoard
    48.7 +//
    48.8 +// This library is free software; you can redistribute it and/or
    48.9 +// modify it under the terms of the GNU Lesser General Public
   48.10 +// License version 2.1 of the License as published by the Free
   48.11 +// Software Foundation.
   48.12 +//
   48.13 +// This library is distributed in the hope that it will be useful,
   48.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   48.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   48.16 +// Lesser General Public License for more details.
   48.17 +//
   48.18 +// You should have received a copy of the GNU Lesser General Public
   48.19 +// License along with this library; if not, write to the Free Software
   48.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   48.21 +//
   48.22 +//
   48.23 +
   48.24 +using System;
   48.25 +
   48.26 +namespace IBBoard.WarFoundry.API.Requirements
   48.27 +{
   48.28 +	public abstract class AbstractFailedRequirement
   48.29 +	{	
   48.30 +		protected AbstractRequirement failedReq;
   48.31 +		
   48.32 +		public AbstractFailedRequirement(AbstractRequirement req)
   48.33 +		{
   48.34 +			failedReq = req;
   48.35 +		}
   48.36 +		
   48.37 +		public abstract string Description { get; }
   48.38 +	}
   48.39 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/api/Requirements/AbstractRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    49.3 @@ -0,0 +1,35 @@
    49.4 +// AbstractRequirement.cs
    49.5 +//
    49.6 +//  Copyright (C) 2008 IBBoard
    49.7 +//
    49.8 +// This library is free software; you can redistribute it and/or
    49.9 +// modify it under the terms of the GNU Lesser General Public
   49.10 +// License version 2.1 of the License as published by the Free
   49.11 +// Software Foundation.
   49.12 +//
   49.13 +// This library is distributed in the hope that it will be useful,
   49.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   49.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   49.16 +// Lesser General Public License for more details.
   49.17 +//
   49.18 +// You should have received a copy of the GNU Lesser General Public
   49.19 +// License along with this library; if not, write to the Free Software
   49.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   49.21 +//
   49.22 +//
   49.23 +
   49.24 +using System;
   49.25 +using IBBoard.WarFoundry.API.Objects;
   49.26 +
   49.27 +namespace IBBoard.WarFoundry.API.Requirements
   49.28 +{	
   49.29 +	/// <summary>
   49.30 +	/// The base class for Requirements. Specific types of abstract requirement should extend this class.
   49.31 +	/// </summary>
   49.32 +	public abstract class AbstractRequirement
   49.33 +	{				
   49.34 +		public abstract string Description { get; }
   49.35 +		public abstract AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj);
   49.36 +		public abstract AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj);
   49.37 +	}
   49.38 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/api/Requirements/AbstractUnitRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    50.3 @@ -0,0 +1,66 @@
    50.4 +// AbstractUnitRequirement.cs
    50.5 +//
    50.6 +//  Copyright (C) 2008 IBBoard
    50.7 +//
    50.8 +// This library is free software; you can redistribute it and/or
    50.9 +// modify it under the terms of the GNU Lesser General Public
   50.10 +// License version 2.1 of the License as published by the Free
   50.11 +// Software Foundation.
   50.12 +//
   50.13 +// This library is distributed in the hope that it will be useful,
   50.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   50.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   50.16 +// Lesser General Public License for more details.
   50.17 +//
   50.18 +// You should have received a copy of the GNU Lesser General Public
   50.19 +// License along with this library; if not, write to the Free Software
   50.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   50.21 +//
   50.22 +//
   50.23 +
   50.24 +using System;
   50.25 +using IBBoard.WarFoundry.API.Objects;
   50.26 +
   50.27 +namespace IBBoard.WarFoundry.API.Requirements
   50.28 +{
   50.29 +	/// <summary>
   50.30 +	/// Base abstract class for all requirements related to adding/removing something from a Unit (e.g. adding equipment or abilities)
   50.31 +	/// </summary>
   50.32 +	public abstract class AbstractUnitRequirement : AbstractRequirement
   50.33 +	{		
   50.34 +		protected abstract AbstractFailedRequirement CanAddToUnit(Unit unit);
   50.35 +		protected abstract AbstractFailedRequirement CanRemoveFromUnit(Unit unit);
   50.36 +		
   50.37 +		public override AbstractFailedRequirement CanAddToWarFoundryObject (WarFoundryObject obj)
   50.38 +		{
   50.39 +			AbstractFailedRequirement fail = null;
   50.40 +			
   50.41 +			if (obj is Unit)
   50.42 +			{
   50.43 +				fail = CanAddToUnit((Unit)obj);
   50.44 +			}
   50.45 +			else
   50.46 +			{
   50.47 +				fail = new FailedRequirement(this);
   50.48 +			}
   50.49 +			
   50.50 +			return fail;
   50.51 +		}
   50.52 +		
   50.53 +		public override AbstractFailedRequirement CanRemoveFromWarFoundryObject (WarFoundryObject obj)
   50.54 +		{
   50.55 +			AbstractFailedRequirement fail = null;
   50.56 +			
   50.57 +			if (obj is Unit)
   50.58 +			{
   50.59 +				fail = CanRemoveFromUnit((Unit)obj);
   50.60 +			}
   50.61 +			else
   50.62 +			{
   50.63 +				fail = new FailedRequirement(this);
   50.64 +			}
   50.65 +			
   50.66 +			return fail;
   50.67 +		}
   50.68 +	}
   50.69 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/api/Requirements/Delegates.cs	Fri Dec 19 15:57:51 2008 +0000
    51.3 @@ -0,0 +1,27 @@
    51.4 +// Delegates.cs
    51.5 +//
    51.6 +//  Copyright (C) 2008 IBBoard
    51.7 +//
    51.8 +// This library is free software; you can redistribute it and/or
    51.9 +// modify it under the terms of the GNU Lesser General Public
   51.10 +// License version 2.1 of the License as published by the Free
   51.11 +// Software Foundation.
   51.12 +//
   51.13 +// This library is distributed in the hope that it will be useful,
   51.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   51.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   51.16 +// Lesser General Public License for more details.
   51.17 +//
   51.18 +// You should have received a copy of the GNU Lesser General Public
   51.19 +// License along with this library; if not, write to the Free Software
   51.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   51.21 +//
   51.22 +//
   51.23 +
   51.24 +using System;
   51.25 +using System.Collections.Generic;
   51.26 +
   51.27 +namespace IBBoard.WarFoundry.API.Requirements
   51.28 +{
   51.29 +	public delegate void FailedUnitRequirementDelegate(List<FailedUnitRequirement> failedRequirements);
   51.30 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/api/Requirements/FailedRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    52.3 @@ -0,0 +1,36 @@
    52.4 +// FailedRequirement.cs
    52.5 +//
    52.6 +//  Copyright (C) 2008 IBBoard
    52.7 +//
    52.8 +// This library is free software; you can redistribute it and/or
    52.9 +// modify it under the terms of the GNU Lesser General Public
   52.10 +// License version 2.1 of the License as published by the Free
   52.11 +// Software Foundation.
   52.12 +//
   52.13 +// This library is distributed in the hope that it will be useful,
   52.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   52.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   52.16 +// Lesser General Public License for more details.
   52.17 +//
   52.18 +// You should have received a copy of the GNU Lesser General Public
   52.19 +// License along with this library; if not, write to the Free Software
   52.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   52.21 +//
   52.22 +//
   52.23 +
   52.24 +using System;
   52.25 +
   52.26 +namespace IBBoard.WarFoundry.API.Requirements
   52.27 +{
   52.28 +	public class FailedRequirement : AbstractFailedRequirement
   52.29 +	{	
   52.30 +		public FailedRequirement(AbstractRequirement req) : base(req)
   52.31 +		{
   52.32 +		}
   52.33 +		
   52.34 +		public override string Description
   52.35 +		{
   52.36 +			get { return failedReq.Description; }
   52.37 +		}
   52.38 +	}
   52.39 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/api/Requirements/FailedUnitRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    53.3 @@ -0,0 +1,20 @@
    53.4 +using System;
    53.5 +
    53.6 +namespace IBBoard.WarFoundry.API.Requirements
    53.7 +{
    53.8 +	/// <summary>
    53.9 +	/// Summary description for UnitRequirement.
   53.10 +	/// </summary>
   53.11 +	public class FailedUnitRequirement : AbstractFailedRequirement
   53.12 +	{
   53.13 +		public FailedUnitRequirement(UnitRequirement requirement) : base(requirement)
   53.14 +		{
   53.15 +		}
   53.16 +		
   53.17 +		public override string Description
   53.18 +		{
   53.19 +			get { return failedReq.Description; }
   53.20 +		}
   53.21 +
   53.22 +	}
   53.23 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/api/Requirements/RequirementAND.cs	Fri Dec 19 15:57:51 2008 +0000
    54.3 @@ -0,0 +1,62 @@
    54.4 +using System;
    54.5 +using System.Collections.Generic;
    54.6 +using IBBoard.Lang;
    54.7 +using IBBoard.WarFoundry.API.Objects;
    54.8 +
    54.9 +namespace IBBoard.WarFoundry.API.Requirements
   54.10 +{
   54.11 +	/// <summary>
   54.12 +	/// Summary description for RequirementAND.
   54.13 +	/// </summary>
   54.14 +	public class RequirementAND : AbstractRequirement
   54.15 +	{
   54.16 +		private static string and;
   54.17 +
   54.18 +		static RequirementAND()
   54.19 +		{
   54.20 +			and = Translation.GetTranslation("requirement_and", true);
   54.21 +
   54.22 +			if (and == null)
   54.23 +			{
   54.24 +				and = "{0}; and {1}";
   54.25 +			}
   54.26 +		}
   54.27 +
   54.28 +		private AbstractRequirement reqA, reqB;
   54.29 +
   54.30 +		public RequirementAND(AbstractRequirement requirementA, AbstractRequirement requirementB)
   54.31 +		{
   54.32 +			reqA = requirementA;
   54.33 +			reqB = requirementB;
   54.34 +		}
   54.35 +
   54.36 +		public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj)
   54.37 +		{	
   54.38 +			FailedRequirement failed = null;
   54.39 +			
   54.40 +			if (reqA.CanAddToWarFoundryObject(obj) !=null || reqB.CanAddToWarFoundryObject(obj)!=null)
   54.41 +			{
   54.42 +				failed = new FailedRequirement(this);
   54.43 +			}
   54.44 +			
   54.45 +			return failed;
   54.46 +		}
   54.47 +
   54.48 +		public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj)
   54.49 +		{
   54.50 +			FailedRequirement failed = null;
   54.51 +			
   54.52 +			if (reqA.CanRemoveFromWarFoundryObject(obj) !=null || reqB.CanRemoveFromWarFoundryObject(obj)!=null)
   54.53 +			{
   54.54 +				failed = new FailedRequirement(this);
   54.55 +			}
   54.56 +			
   54.57 +			return failed;
   54.58 +		}
   54.59 +
   54.60 +		public override string Description 
   54.61 +		{
   54.62 +			get { return String.Format(and, reqA.Description, reqB.Description); }
   54.63 +		}
   54.64 +	}
   54.65 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/api/Requirements/RequirementOR.cs	Fri Dec 19 15:57:51 2008 +0000
    55.3 @@ -0,0 +1,62 @@
    55.4 +using System;
    55.5 +using System.Collections.Generic;
    55.6 +using IBBoard.Lang;
    55.7 +using IBBoard.WarFoundry.API.Objects;
    55.8 +
    55.9 +namespace IBBoard.WarFoundry.API.Requirements
   55.10 +{
   55.11 +	/// <summary>
   55.12 +	/// Summary description for UnitRequirementOR.
   55.13 +	/// </summary>
   55.14 +	public class RequirementOR : AbstractRequirement
   55.15 +	{
   55.16 +		private static string or;
   55.17 +
   55.18 +		static RequirementOR()
   55.19 +		{
   55.20 +			or = Translation.GetTranslation("requirement_or", true);
   55.21 +
   55.22 +			if (or == null)
   55.23 +			{
   55.24 +				or = "{0} or {1}";
   55.25 +			}
   55.26 +		}
   55.27 +
   55.28 +		private AbstractRequirement reqA, reqB;
   55.29 +
   55.30 +		public RequirementOR(AbstractRequirement requirementA, AbstractRequirement requirementB)
   55.31 +		{
   55.32 +			reqA = requirementA;
   55.33 +			reqB = requirementB;
   55.34 +		}
   55.35 +
   55.36 +		public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj)
   55.37 +		{		
   55.38 +			FailedRequirement failed = null;
   55.39 +			
   55.40 +			if (reqA.CanAddToWarFoundryObject(obj) !=null && reqB.CanAddToWarFoundryObject(obj)!=null)
   55.41 +			{
   55.42 +				failed = new FailedRequirement(this);
   55.43 +			}
   55.44 +			
   55.45 +			return failed;
   55.46 +		}
   55.47 +
   55.48 +		public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj)
   55.49 +		{		
   55.50 +			FailedRequirement failed = null;
   55.51 +			
   55.52 +			if (reqA.CanRemoveFromWarFoundryObject(obj)!=null && reqB.CanRemoveFromWarFoundryObject(obj)!=null)
   55.53 +			{
   55.54 +				failed = new FailedRequirement(this);
   55.55 +			}
   55.56 +			
   55.57 +			return failed;
   55.58 +		}
   55.59 +
   55.60 +		public override string Description 
   55.61 +		{
   55.62 +			get { return String.Format(or, reqA.Description, reqB.Description); }
   55.63 +		}
   55.64 +	}
   55.65 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/api/Requirements/UnitExcludesRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    56.3 @@ -0,0 +1,49 @@
    56.4 +using System;
    56.5 +using System.Collections.Generic;
    56.6 +using IBBoard.WarFoundry.API.Objects;
    56.7 +
    56.8 +namespace IBBoard.WarFoundry.API.Requirements
    56.9 +{
   56.10 +	/// <summary>
   56.11 +	/// Summary description for UnitExcludesRequirement.
   56.12 +	/// </summary>
   56.13 +	public class UnitExcludesRequirement : UnitRequirement
   56.14 +	{
   56.15 +		private UnitRequirementItem[] excludingTypes;
   56.16 +
   56.17 +		public UnitExcludesRequirement(UnitType type, UnitRequirementItem[] excludingUnitTypes) : base(type)
   56.18 +		{
   56.19 +			excludingTypes = excludingUnitTypes;
   56.20 +		}
   56.21 +
   56.22 +		public override string Description
   56.23 +		{
   56.24 +			get 
   56.25 +			{
   56.26 +				return "Some units are already included that excluded this unit";
   56.27 +			}
   56.28 +		}
   56.29 +
   56.30 +		protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type)
   56.31 +		{		
   56.32 +			FailedUnitRequirement failed = null;
   56.33 +
   56.34 +			for (int i = 0; i<excludingTypes.Length; i++)
   56.35 +			{
   56.36 +				if (army.GetUnitTypeCount(excludingTypes[i].UnitType) > 0)
   56.37 +				{
   56.38 +					failed = new FailedUnitRequirement(this);
   56.39 +					break;
   56.40 +				}
   56.41 +			}
   56.42 +			
   56.43 +			return failed;
   56.44 +		}
   56.45 +
   56.46 +		protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type)
   56.47 +		{
   56.48 +			return null;
   56.49 +		}
   56.50 +
   56.51 +	}
   56.52 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/api/Requirements/UnitExclusion.cs	Fri Dec 19 15:57:51 2008 +0000
    57.3 @@ -0,0 +1,41 @@
    57.4 +using System;
    57.5 +using System.Text;
    57.6 +using IBBoard.WarFoundry.API.Objects;
    57.7 +
    57.8 +namespace IBBoard.WarFoundry.API.Requirements
    57.9 +{
   57.10 +	/// <summary>
   57.11 +	/// Summary description for UnitMaxNumberRequirement.
   57.12 +	/// </summary>
   57.13 +	public class UnitExclusion : FailedUnitRequirement
   57.14 +	{
   57.15 +		private string unitList;
   57.16 +		private UnitType type;
   57.17 +
   57.18 +		public UnitExclusion(UnitRequirement req, UnitType unitType, UnitType[] excludingTypes) : base(req)
   57.19 +		{
   57.20 +			type = unitType;
   57.21 +
   57.22 +			if (excludingTypes.Length > 1)
   57.23 +			{
   57.24 +				StringBuilder sb = new StringBuilder(excludingTypes[0].Name);
   57.25 +
   57.26 +				for (int i = 1; i<excludingTypes.Length; i++)
   57.27 +				{
   57.28 +					sb.Append(", "+excludingTypes[i].Name);
   57.29 +				}
   57.30 +
   57.31 +				unitList = sb.ToString();
   57.32 +			}
   57.33 +			else
   57.34 +			{
   57.35 +				unitList = excludingTypes[0].Name;
   57.36 +			}
   57.37 +		}
   57.38 +
   57.39 +		public override string Description
   57.40 +		{
   57.41 +			get { return "The army cannot have any of the following units to include a unit of type "+type.Name+": "+unitList; }
   57.42 +		}
   57.43 +	}
   57.44 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/api/Requirements/UnitMaxNumberReached.cs	Fri Dec 19 15:57:51 2008 +0000
    58.3 @@ -0,0 +1,25 @@
    58.4 +using System;
    58.5 +using IBBoard;
    58.6 +using IBBoard.Lang;
    58.7 +using IBBoard.WarFoundry.API.Objects;
    58.8 +
    58.9 +namespace IBBoard.WarFoundry.API.Requirements
   58.10 +{
   58.11 +	/// <summary>
   58.12 +	/// Summary description for UnitMaxNumberRequirement.
   58.13 +	/// </summary>
   58.14 +	public class UnitMaxNumberReached : FailedUnitRequirement
   58.15 +	{
   58.16 +		private UnitType type;
   58.17 +
   58.18 +		public UnitMaxNumberReached(UnitType unitType, UnitRequirementMaxNumber requirement) : base(requirement)
   58.19 +		{
   58.20 +			type = unitType;
   58.21 +		}
   58.22 +
   58.23 +		public override string Description
   58.24 +		{
   58.25 +			get { return String.Format(Translation.GetTranslation("ErrorUnitMaxNumberReached", "The maximum number of units of type \"{0}\" has already been reached or exceeded."), type.Name); }
   58.26 +		}
   58.27 +	}
   58.28 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/api/Requirements/UnitMinNumberReached.cs	Fri Dec 19 15:57:51 2008 +0000
    59.3 @@ -0,0 +1,23 @@
    59.4 +using System;
    59.5 +using IBBoard.WarFoundry.API.Objects;
    59.6 +
    59.7 +namespace IBBoard.WarFoundry.API.Requirements
    59.8 +{
    59.9 +	/// <summary>
   59.10 +	/// Summary description for UnitMaxNumberRequirement.
   59.11 +	/// </summary>
   59.12 +	public class UnitMinNumberReached : FailedUnitRequirement
   59.13 +	{
   59.14 +		private UnitType type;
   59.15 +
   59.16 +		public UnitMinNumberReached(UnitType unitType, UnitRequirementMinNumber requirement) : base(requirement)
   59.17 +		{
   59.18 +			type = unitType;
   59.19 +		}
   59.20 +
   59.21 +		public override string Description
   59.22 +		{
   59.23 +			get { return "The minimum number of units of type "+type.Name+" is not currently met"; }
   59.24 +		}
   59.25 +	}
   59.26 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/api/Requirements/UnitRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    60.3 @@ -0,0 +1,92 @@
    60.4 +using System;
    60.5 +using System.Collections.Generic;
    60.6 +using IBBoard.WarFoundry.API;
    60.7 +using IBBoard.WarFoundry.API.Objects;
    60.8 +
    60.9 +namespace IBBoard.WarFoundry.API.Requirements
   60.10 +{
   60.11 +	/// <summary>
   60.12 +	/// Summary description for UnitRequirement.
   60.13 +	/// </summary>
   60.14 +	public abstract class UnitRequirement : AbstractArmyRequirement
   60.15 +	{
   60.16 +		protected UnitType unitType;
   60.17 +		
   60.18 +		protected UnitRequirement(UnitType requirementFor)
   60.19 +		{
   60.20 +			unitType = requirementFor;	
   60.21 +		}		
   60.22 +		
   60.23 +		/// <summary>
   60.24 +		/// Checks whether the specified unit type can be added to the specified army. Returns a <see cref="FailedRequirement"> obejct if a unit of that type cannot legally be added, or no failure (null) if it can be added. 
   60.25 +		/// </summary>
   60.26 +		/// <param name="army">
   60.27 +		/// The <see cref="Army"/> that the unit should be checked for adding to
   60.28 +		/// </param>
   60.29 +		/// <param name="type">
   60.30 +		/// The <see cref="UnitType"/> that is being checked.
   60.31 +		/// </param>
   60.32 +		/// <returns>
   60.33 +		/// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="UnitType"/> cannot be legally added, else <code>null</code>.
   60.34 +		/// </returns>
   60.35 +		protected abstract AbstractFailedRequirement CanAddToArmy(Army army, UnitType type);
   60.36 +		
   60.37 +		/// <summary>
   60.38 +		/// Checks whether the specified unit can be added to the specified army. Returns a <see cref="FailedRequirement"> obejct if the unit cannot legally be added, or no failure (null) if it can be added. 
   60.39 +		/// </summary>
   60.40 +		/// <param name="army">
   60.41 +		/// The <see cref="Army"/> that the unit should be checked for adding to
   60.42 +		/// </param>
   60.43 +		/// <param name="type">
   60.44 +		/// The <see cref="Unit"/> that is being checked.
   60.45 +		/// </param>
   60.46 +		/// <returns>
   60.47 +		/// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="Unit"/> cannot be legally added, else <code>null</code>.
   60.48 +		/// </returns>
   60.49 +		protected AbstractFailedRequirement CanAddToArmy(Army army, Unit unit)
   60.50 +		{
   60.51 +			return CanAddToArmy(army, unit.UnitType);
   60.52 +		}
   60.53 +		
   60.54 +		/// <summary>
   60.55 +		/// Checks whether the specified unit type can be removed from the specified army. Returns a <see cref="FailedRequirement"> obejct if a unit of that type cannot legally be removed, or no failure (null) if it can be removed. 
   60.56 +		/// </summary>
   60.57 +		/// <param name="army">
   60.58 +		/// The <see cref="Army"/> that the unit should be checked for adding to
   60.59 +		/// </param>
   60.60 +		/// <param name="type">
   60.61 +		/// The <see cref="UnitType"/> that is being checked.
   60.62 +		/// </param>
   60.63 +		/// <returns>
   60.64 +		/// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="UnitType"/> cannot be legally added, else <code>null</code>.
   60.65 +		/// </returns>
   60.66 +		protected abstract AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type);
   60.67 +		
   60.68 +		/// <summary>
   60.69 +		/// Checks whether the specified unit can be removed from the specified army. Returns a <see cref="FailedRequirement"> obejct if the unit cannot legally be removed, or no failure (null) if it can be removed. 
   60.70 +		/// </summary>
   60.71 +		/// <param name="army">
   60.72 +		/// The <see cref="Army"/> that the unit should be checked for adding to
   60.73 +		/// </param>
   60.74 +		/// <param name="type">
   60.75 +		/// The <see cref="Unit"/> that is being checked.
   60.76 +		/// </param>
   60.77 +		/// <returns>
   60.78 +		/// A <see cref="AbstractFailedRequirement"/> if the requirement means the <see cref="Unit"/> cannot be legally removed, else <code>null</code>.
   60.79 +		/// </returns>
   60.80 +		protected AbstractFailedRequirement CanRemoveFromArmy(Army army, Unit unit)
   60.81 +		{
   60.82 +			return CanRemoveFromArmy(army, unit.UnitType);
   60.83 +		}
   60.84 +				
   60.85 +		protected override AbstractFailedRequirement CanAddToArmy(Army army)
   60.86 +		{
   60.87 +			return CanAddToArmy(army, unitType);
   60.88 +		}
   60.89 +		
   60.90 +		protected override AbstractFailedRequirement CanRemoveFromArmy(Army army)
   60.91 +		{
   60.92 +			return CanRemoveFromArmy(army, unitType);
   60.93 +		}
   60.94 +	}
   60.95 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/api/Requirements/UnitRequirementItem.cs	Fri Dec 19 15:57:51 2008 +0000
    61.3 @@ -0,0 +1,32 @@
    61.4 +using System;
    61.5 +using IBBoard.WarFoundry.API.Objects;
    61.6 +
    61.7 +namespace IBBoard.WarFoundry.API.Requirements
    61.8 +{
    61.9 +	/// <summary>
   61.10 +	/// Summary description for UnitRequirementItem.
   61.11 +	/// </summary>
   61.12 +	public class UnitRequirementItem
   61.13 +	{
   61.14 +		private UnitType type;
   61.15 +		private int requiredNum;
   61.16 +
   61.17 +		public UnitRequirementItem(UnitType unitType, int reqNumber)
   61.18 +		{
   61.19 +			type = unitType;
   61.20 +			requiredNum = reqNumber;
   61.21 +		}
   61.22 +
   61.23 +		public UnitRequirementItem(UnitType type) : this(type, 1) { }
   61.24 +
   61.25 +		public UnitType UnitType
   61.26 +		{
   61.27 +			get { return type; }
   61.28 +		}
   61.29 +
   61.30 +		public int Amount
   61.31 +		{
   61.32 +			get { return requiredNum; }
   61.33 +		}
   61.34 +	}
   61.35 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/api/Requirements/UnitRequirementMaxNumber.cs	Fri Dec 19 15:57:51 2008 +0000
    62.3 @@ -0,0 +1,57 @@
    62.4 +// UnitRequirementMaxNumber.cs
    62.5 +//
    62.6 +//  Copyright (C) 2008 IBBoard
    62.7 +//
    62.8 +// This library is free software; you can redistribute it and/or
    62.9 +// modify it under the terms of the GNU Lesser General Public
   62.10 +// License version 2.1 of the License as published by the Free
   62.11 +// Software Foundation.
   62.12 +//
   62.13 +// This library is distributed in the hope that it will be useful,
   62.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   62.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   62.16 +// Lesser General Public License for more details.
   62.17 +//
   62.18 +// You should have received a copy of the GNU Lesser General Public
   62.19 +// License along with this library; if not, write to the Free Software
   62.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   62.21 +//
   62.22 +//
   62.23 +
   62.24 +using System;
   62.25 +using IBBoard.WarFoundry.API.Objects;
   62.26 +
   62.27 +namespace IBBoard.WarFoundry.API.Requirements
   62.28 +{
   62.29 +	public class UnitRequirementMaxNumber : UnitRequirement
   62.30 +	{		
   62.31 +		private int maxUnitCount;
   62.32 +		
   62.33 +		public UnitRequirementMaxNumber(UnitType type, int maxNumber) : base(type)
   62.34 +		{
   62.35 +			maxUnitCount = maxNumber;
   62.36 +		}
   62.37 +		
   62.38 +		public override string Description
   62.39 +		{
   62.40 +			get { return "You may only include up to "+maxUnitCount+" "+unitType.Name+" units in an army"; }
   62.41 +		}
   62.42 +		
   62.43 +		protected override AbstractFailedRequirement CanAddToArmy (Army army, UnitType type)
   62.44 +		{
   62.45 +			FailedUnitRequirement failed = null;
   62.46 +			
   62.47 +			if (army.GetUnitTypeCount(type) >= maxUnitCount)
   62.48 +			{
   62.49 +				failed = new FailedUnitRequirement(this);
   62.50 +			}
   62.51 +			
   62.52 +			return failed;
   62.53 +		}
   62.54 +
   62.55 +		protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type)
   62.56 +		{
   62.57 +			return null;
   62.58 +		}
   62.59 +	}
   62.60 +}
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/api/Requirements/UnitRequirementMinNumber.cs	Fri Dec 19 15:57:51 2008 +0000
    63.3 @@ -0,0 +1,57 @@
    63.4 +// UnitRequirementMinNumber.cs
    63.5 +//
    63.6 +//  Copyright (C) 2008 IBBoard
    63.7 +//
    63.8 +// This library is free software; you can redistribute it and/or
    63.9 +// modify it under the terms of the GNU Lesser General Public
   63.10 +// License version 2.1 of the License as published by the Free
   63.11 +// Software Foundation.
   63.12 +//
   63.13 +// This library is distributed in the hope that it will be useful,
   63.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   63.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   63.16 +// Lesser General Public License for more details.
   63.17 +//
   63.18 +// You should have received a copy of the GNU Lesser General Public
   63.19 +// License along with this library; if not, write to the Free Software
   63.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   63.21 +//
   63.22 +//
   63.23 +
   63.24 +using System;
   63.25 +using IBBoard.WarFoundry.API.Objects;
   63.26 +
   63.27 +namespace IBBoard.WarFoundry.API.Requirements
   63.28 +{
   63.29 +	public class UnitRequirementMinNumber : UnitRequirement
   63.30 +	{
   63.31 +		private int minUnitCount;
   63.32 +		
   63.33 +		public UnitRequirementMinNumber(UnitType type, int minNumber) : base(type)
   63.34 +		{
   63.35 +			minUnitCount = minNumber;
   63.36 +		}
   63.37 +		
   63.38 +		public override string Description
   63.39 +		{
   63.40 +			get { return "You must include at least "+minUnitCount+" "+unitType.Name+" units in an army"; }
   63.41 +		}
   63.42 +		
   63.43 +		protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type)
   63.44 +		{
   63.45 +			return null;
   63.46 +		}
   63.47 +
   63.48 +		protected override AbstractFailedRequirement CanRemoveFromArmy (Army army, UnitType type)
   63.49 +		{
   63.50 +			FailedUnitRequirement failed = null;
   63.51 +			
   63.52 +			if (army.GetUnitTypeCount(type) <= minUnitCount)
   63.53 +			{
   63.54 +				failed = new FailedUnitRequirement(this);
   63.55 +			}
   63.56 +			
   63.57 +			return failed;
   63.58 +		}
   63.59 +	}
   63.60 +}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/api/Requirements/UnitRequiresAtLeastRequirement.cs	Fri Dec 19 15:57:51 2008 +0000
    64.3 @@ -0,0 +1,80 @@
    64.4 +using System;
    64.5 +using System.Collections.Generic;
    64.6 +using System.Text;
    64.7 +using IBBoard.WarFoundry.API;
    64.8 +using IBBoard.WarFoundry.API.Objects;
    64.9 +
   64.10 +namespace IBBoard.WarFoundry.API.Requirements
   64.11 +{
   64.12 +	/// <summary>
   64.13 +	/// Summary description for UnitRequiresRequirement.
   64.14 +	/// </summary>
   64.15 +	public class UnitRequiresAtLeastRequirement : UnitRequirement
   64.16 +	{
   64.17 +		private UnitType[] requiredTypes;
   64.18 +		private int[] requiredCounts;
   64.19 +		private String unitList;
   64.20 +
   64.21 +		public UnitRequiresAtLeastRequirement(UnitType type, UnitType requiredUnitType) : this(type, new UnitType[]{requiredUnitType}, new int[]{1})
   64.22 +		{
   64.23 +		}
   64.24 +		
   64.25 +		public UnitRequiresAtLeastRequirement(UnitType type, UnitType[] requiredUnitTypes, int[] minNumsRequired) : base(type)
   64.26 +		{
   64.27 +			if (requiredUnitTypes.Length != minNumsRequired.Length)
   64.28 +			{
   64.29 +				throw new ArgumentException("List of required unit types and list of number of units required must be equal");
   64.30 +			}
   64.31 +			else if (requiredUnitTypes.Length == 1)
   64.32 +			{
   64.33 +				throw new ArgumentException("List of required unit types must not be empty");
   64.34 +			}
   64.35 +			
   64.36 +			requiredTypes = requiredUnitTypes;
   64.37 +			requiredCounts = minNumsRequired;
   64.38 +
   64.39 +			if (requiredTypes.Length > 1)
   64.40 +			{
   64.41 +				StringBuilder sb = new StringBuilder(requiredCounts[0]+" x "+requiredTypes[0].Name);
   64.42 +
   64.43 +				for (int i = 1; i<requiredTypes.Length; i++)
   64.44 +				{
   64.45 +					sb.Append(", "+requiredCounts[i]+" x "+requiredTypes[i].Name);
   64.46 +				}
   64.47 +
   64.48 +				unitList = sb.ToString();
   64.49 +			}
   64.50 +			else
   64.51 +			{
   64.52 +				unitList = requiredTypes[0].Name;
   64.53 +			}
   64.54 +		}
   64.55 +
   64.56 +		public override string Description
   64.57 +		{
   64.58 +			get { return "The army must include at least the following units to include a unit of type "+unitType.Name+": "+unitList; }
   64.59 +		}
   64.60 +
   64.61 +		protected override AbstractFailedRequirement CanRemoveFromArmy(Army army, UnitType type)
   64.62 +		{
   64.63 +			return null;
   64.64 +		}
   64.65 +
   64.66 +		protected override AbstractFailedRequirement CanAddToArmy(Army army, UnitType type)
   64.67 +		{
   64.68 +			FailedRequirement failure = null;
   64.69 +			int count = requiredTypes.Length;
   64.70 +			
   64.71 +			for (int i = 0; i < count; i++)
   64.72 +			{
   64.73 +				if (army.GetUnitTypeCount(requiredTypes[i]) < requiredCounts[i])
   64.74 +				{				
   64.75 +					failure = new FailedRequirement(this);
   64.76 +					break;
   64.77 +				}
   64.78 +			}
   64.79 +						
   64.80 +			return failure;
   64.81 +		}
   64.82 +	}
   64.83 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/api/Savers/IWarFoundryFileSaver.cs	Fri Dec 19 15:57:51 2008 +0000
    65.3 @@ -0,0 +1,42 @@
    65.4 +// IWarFoundryFileSaver.cs
    65.5 +//
    65.6 +//  Copyright (C) 2008 IBBoard
    65.7 +//
    65.8 +// This library is free software; you can redistribute it and/or
    65.9 +// modify it under the terms of the GNU Lesser General Public
   65.10 +// License as published by the Free Software Foundation; either
   65.11 +// version 2.1 of the License, or (at your option) any later version.
   65.12 +//
   65.13 +// This library is distributed in the hope that it will be useful,
   65.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   65.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   65.16 +// Lesser General Public License for more details.
   65.17 +//
   65.18 +// You should have received a copy of the GNU Lesser General Public
   65.19 +// License along with this library; if not, write to the Free Software
   65.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   65.21 +//
   65.22 +//
   65.23 +
   65.24 +using System;
   65.25 +using IBBoard.WarFoundry.API.Objects;
   65.26 +
   65.27 +namespace IBBoard.WarFoundry.API.Savers
   65.28 +{
   65.29 +	public interface IWarFoundryFileSaver
   65.30 +	{
   65.31 +		/// <summary>
   65.32 +		/// Saves an <see cref="Army"/> to a file on disk.
   65.33 +		/// </summary>
   65.34 +		/// <param name="army">
   65.35 +		/// The <see cref="Army"/> to save
   65.36 +		/// </param>
   65.37 +		/// <param name="path">
   65.38 +		/// The path to save the army to
   65.39 +		/// </param>
   65.40 +		/// <returns>
   65.41 +		/// TRUE if saving succedes, else FALSE
   65.42 +		/// </returns>
   65.43 +		bool Save(Army army, string path);
   65.44 +	}
   65.45 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/api/Savers/WarFoundrySaver.cs	Fri Dec 19 15:57:51 2008 +0000
    66.3 @@ -0,0 +1,39 @@
    66.4 +// WarFoundrySaver.cs
    66.5 +//
    66.6 +//  Copyright (C) 2008 IBBoard
    66.7 +//
    66.8 +// This library is free software; you can redistribute it and/or
    66.9 +// modify it under the terms of the GNU Lesser General Public
   66.10 +// License as published by the Free Software Foundation; either
   66.11 +// version 2.1 of the License, or (at your option) any later version.
   66.12 +//
   66.13 +// This library is distributed in the hope that it will be useful,
   66.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   66.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   66.16 +// Lesser General Public License for more details.
   66.17 +//
   66.18 +// You should have received a copy of the GNU Lesser General Public
   66.19 +// License along with this library; if not, write to the Free Software
   66.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   66.21 +//
   66.22 +//
   66.23 +
   66.24 +using System;
   66.25 +
   66.26 +namespace IBBoard.WarFoundry.API.Savers
   66.27 +{
   66.28 +	public class WarFoundrySaver
   66.29 +	{
   66.30 +		private static IWarFoundryFileSaver fileSaver;
   66.31 +		
   66.32 +		public static IWarFoundryFileSaver GetSaver()
   66.33 +		{
   66.34 +			return fileSaver;
   66.35 +		}
   66.36 +		
   66.37 +		public static void SetFileSaver(IWarFoundryFileSaver newFileSaver)
   66.38 +		{
   66.39 +			fileSaver = newFileSaver;
   66.40 +		}
   66.41 +	}
   66.42 +}
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/api/WarFoundryCore.cs	Fri Dec 19 15:57:51 2008 +0000
    67.3 @@ -0,0 +1,103 @@
    67.4 +// WarFoundry.cs
    67.5 +//
    67.6 +//  Copyright (C) 2008 IBBoard
    67.7 +//
    67.8 +// This library is free software; you can redistribute it and/or
    67.9 +// modify it under the terms of the GNU Lesser General Public
   67.10 +// License version 2.1 of the License as published by the Free
   67.11 +// Software Foundation.
   67.12 +//
   67.13 +// This library is distributed in the hope that it will be useful,
   67.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   67.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   67.16 +// Lesser General Public License for more details.
   67.17 +//
   67.18 +// You should have received a copy of the GNU Lesser General Public
   67.19 +// License along with this library; if not, write to the Free Software
   67.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   67.21 +//
   67.22 +//
   67.23 +
   67.24 +using System;
   67.25 +using IBBoard.Logging;
   67.26 +using IBBoard.WarFoundry.API.Objects;
   67.27 +
   67.28 +namespace IBBoard.WarFoundry.API
   67.29 +{
   67.30 +	public class WarFoundryCore
   67.31 +	{		
   67.32 +		public static event GameSystemChangedDelegate GameSystemChanged;
   67.33 +		public static event ArmyChangedDelegate ArmyChanged;
   67.34 +		
   67.35 +		private static GameSystem system;
   67.36 +		private static Army currentArmy;
   67.37 +				
   67.38 +		public static GameSystem CurrentGameSystem
   67.39 +		{
   67.40 +			get { return system; }
   67.41 +			set
   67.42 +			{
   67.43 +				if (system==null || !system.Equals(value))
   67.44 +				{
   67.45 +					GameSystem oldSystem = system;
   67.46 +					system = value;
   67.47 +					
   67.48 +					if (system==null)
   67.49 +					{
   67.50 +						LogNotifier.Debug(typeof(WarFoundryCore), "Game system set to null");
   67.51 +					}
   67.52 +					else
   67.53 +					{
   67.54 +						LogNotifier.DebugFormat(typeof(WarFoundryCore), "Game system set to {0} with ID {1}", system.Name, system.ID); 
   67.55 +					}
   67.56 +
   67.57 +					if (GameSystemChanged!=null)
   67.58 +					{
   67.59 +						GameSystemChanged(oldSystem, system);
   67.60 +					}
   67.61 +					
   67.62 +					//If we've changed the game system then we can't keep the current army
   67.63 +					CurrentArmy = null;
   67.64 +				}
   67.65 +			}
   67.66 +		}
   67.67 +		
   67.68 +		public static Army CurrentArmy
   67.69 +		{
   67.70 +			get { return currentArmy; }
   67.71 +			set
   67.72 +			{
   67.73 +				if (currentArmy==null || !currentArmy.Equals(value))
   67.74 +				{
   67.75 +					/*if (currentArmy!=null)
   67.76 +					{
   67.77 +						currentArmy.UnitAdded-= UnitAddedMethod;
   67.78 +						currentArmy.UnitRemoved-= UnitRemovedMethod;
   67.79 +						currentArmy.PointsValueChanged-= PointsValueChangedMethod;
   67.80 +						currentArmy.FailedRequirement-=FailedUnitRequirementMethod;
   67.81 +					}*/
   67.82 +					Army oldArmy = currentArmy;
   67.83 +					currentArmy = value;
   67.84 +					
   67.85 +					if (currentArmy!=null)
   67.86 +					{
   67.87 +						CurrentGameSystem = currentArmy.GameSystem; //Set the game system in case the new army is from a different system
   67.88 +					}
   67.89 +
   67.90 +					/*if (currentArmy!=null)
   67.91 +					{
   67.92 +						currentArmy.UnitAdded+= UnitAddedMethod;
   67.93 +						currentArmy.UnitRemoved+= UnitRemovedMethod;
   67.94 +						currentArmy.PointsValueChanged+= PointsValueChangedMethod;
   67.95 +						currentArmy.FailedRequirement+=FailedUnitRequirementMethod;
   67.96 +					}*/
   67.97 +
   67.98 +					if (ArmyChanged!=null)
   67.99 +					{
  67.100 +						ArmyChanged(oldArmy, currentArmy);
  67.101 +					}
  67.102 +				}
  67.103 +			}
  67.104 +		}
  67.105 +	}
  67.106 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/api/WarFoundryLoader.cs	Fri Dec 19 15:57:51 2008 +0000
    68.3 @@ -0,0 +1,664 @@
    68.4 +// WarFoundryLoader.cs
    68.5 +//
    68.6 +//  Copyright (C) 2007 IBBoard
    68.7 +//
    68.8 +// This library is free software; you can redistribute it and/or
    68.9 +// modify it under the terms of the GNU Lesser General Public
   68.10 +// License version 2.1 of the License as published by the Free
   68.11 +// Software Foundation.
   68.12 +//
   68.13 +// This library is distributed in the hope that it will be useful,
   68.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
   68.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   68.16 +// Lesser General Public License for more details.
   68.17 +//
   68.18 +// You should have received a copy of the GNU Lesser General Public
   68.19 +// License along with this library; if not, write to the Free Software
   68.20 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
   68.21 +//
   68.22 +//
   68.23 +
   68.24 +using System;
   68.25 +using System.Collections.Generic;
   68.26 +using System.IO;
   68.27 +using IBBoard.Collections;
   68.28 +using IBBoard.IO;
   68.29 +using IBBoard.Logging;
   68.30 +using IBBoard.WarFoundry.API.Factories;
   68.31 +using IBBoard.WarFoundry.API.Objects;
   68.32 +using ICSharpCode.SharpZipLib.Zip;
   68.33 +
   68.34 +namespace IBBoard.WarFoundry.API
   68.35 +{
   68.36 +	public class WarFoundryLoader
   68.37 +	{		
   68.38 +		private static WarFoundryLoader loader;
   68.39 +		
   68.40 +		/// <summary>
   68.41 +		/// Gets the default <see cref="WarFoundryLoader"/> used to load WarFoundry data files.
   68.42 +		/// </summary>
   68.43 +		/// <returns>
   68.44 +		/// The default <see cref="WarFoundryLoader"/>
   68.45 +		/// </returns>
   68.46 +		public static WarFoundryLoader GetDefault()
   68.47 +		{
   68.48 +			if (loader == null)
   68.49 +			{
   68.50 +				loader = new WarFoundryLoader();
   68.51 +			}
   68.52 +			
   68.53 +			return loader;
   68.54 +		}
   68.55 +		
   68.56 +		private ICollection<DirectoryInfo> directories;
   68.57 +		private ICollection<INativeWarFoundryFactory> factories;
   68.58 +		private ICollection<INonNativeWarFoundryFactory> nonNativeFactories;
   68.59 +		private Dictionary<string, GameSystem> systemsTable;
   68.60 +		private Dictionary<string, Dictionary<string, Dictionary<string, Race>>> racesTable; //Keys are: System, Race, SubRace
   68.61 +		private Dictionary<IWarFoundryFactory, SimpleSet<IWarFoundryObject>> loadedObjects;
   68.62 +		
   68.63 +		protected WarFoundryLoader()
   68.64 +		{
   68.65 +			directories = new List<DirectoryInfo>();
   68.66 +			factories = new List<INativeWarFoundryFactory>();
   68.67 +			nonNativeFactories = new List<INonNativeWarFoundryFactory>();
   68.68 +			loadedObjects = new Dictionary<IWarFoundryFactory,SimpleSet<IWarFoundryObject>>();
   68.69 +		}
   68.70 +		
   68.71 +		/// <summary>
   68.72 +		/// Adds a directory to the collection of directories that will be searched for WarFoundry data files.
   68.73 +		/// </summary>
   68.74 +		/// <param name="directory">
   68.75 +		/// The <see cref="DirectoryInfo"/> to add to the list for searching for data files
   68.76 +		/// </param>
   68.77 +		public void AddLoadDirectory(DirectoryInfo directory)
   68.78 +		{
   68.79 +			if (!directories.Contains(directory))
   68.80 +			{
   68.81 +				directories.Add(directory);
   68.82 +			}
   68.83 +		}
   68.84 +		
   68.85 +		/// <summary>
   68.86 +		/// Removes a directory from the collection of directories that will be searched for WarFoundry data files.
   68.87 +		/// </summary>
   68.88 +		/// <param name="directory">
   68.89 +		/// A <see cref="DirectoryInfo"/>
   68.90 +		/// </param>
   68.91 +		public void RemoveLoadDirectory(DirectoryInfo directory)
   68.92 +		{
   68.93 +			if (directories.Contains(directory))
   68.94 +			{
   68.95 +				directories.Remove(directory);
   68.96 +			}
   68.97 +		}
   68.98 +		
   68.99 +		/// <summary>
  68.100 +		/// Registers a <see cref="INativeWarFoundryFactory"/> as a factory that can parse native data files.
  68.101 +		/// </summary>
  68.102 +		/// <param name="factory">
  68.103 +		/// The <see cref="INativeWarFoundryFactory"/> to register to parse native data files.
  68.104 +		/// </param>
  68.105 +		public void RegisterFactory(INativeWarFoundryFactory factory)
  68.106 +		{
  68.107 +			if (!factories.Contains(factory))
  68.108 +			{
  68.109 +				factories.Add(factory);
  68.110 +			}
  68.111 +		}
  68.112 +		
  68.113 +		/// <summary>
  68.114 +		/// Unregisters a <see cref="INativeWarFoundryFactory"/> so that it will no longer be used to try to parse native data files.
  68.115 +		/// </summary>
  68.116 +		/// <param name="factory">
  68.117 +		/// The <see cref="INativeWarFoundryFactory"/> to remove from the collection of factories that are used to try to parse native data files.
  68.118 +		/// </param>
  68.119 +		public void UnregisterFactory(INativeWarFoundryFactory factory)
  68.120 +		{
  68.121 +			if (factories.Contains(factory))
  68.122 +			{
  68.123 +				factories.Remove(factory);
  68.124 +			}
  68.125 +		}
  68.126 +		
  68.127 +		/// <summary>
  68.128 +		/// Registers a <see cref="INonNativeWarFoundryFactory"/> so that it will be used to try to parse non-native data files from other applications.
  68.129 +		/// </summary>
  68.130 +		/// <param name="factory">
  68.131 +		/// The <see cref="INonNativeWarFoundryFactory"/> to register to parse non-native data files.
  68.132 +		/// </param>
  68.133 +		public void RegisterNonNativeFactory(INonNativeWarFoundryFactory factory)
  68.134 +		{
  68.135 +			if (!nonNativeFactories.Contains(factory))
  68.136 +			{
  68.137 +				nonNativeFactories.Add(factory);
  68.138 +			}
  68.139 +		}
  68.140 +		
  68.141 +		/// <summary>
  68.142 +		/// Unregisters a <see cref="INonNativeWarFoundryFactory"/> so that it will no longer be used to try to parse non-native data files from other applications.
  68.143 +		/// </summary>
  68.144 +		/// <param name="factory">
  68.145 +		/// The <see cref="INonNativeWarFoundryFactory"/> to remove from the collection of factories that are used to try to parse non-native data files.
  68.146 +		/// </param>
  68.147 +		public void UnregisterNonNativeFactory(INonNativeWarFoundryFactory factory)
  68.148 +		{
  68.149 +			if (nonNativeFactories.Contains(factory))
  68.150 +			{
  68.151 +				nonNativeFactories.Remove(factory);
  68.152 +			}
  68.153 +		}
  68.154 +		
  68.155 +		/// <summary>
  68.156 +		/// Loads all of the data files in the registered directories.
  68.157 +		/// </summary>
  68.158 +		public void LoadFiles()
  68.159 +		{
  68.160 +			LogNotifier.Debug(GetType(), "Load files");
  68.161 +			PrepareForFileLoad();
  68.162 +			
  68.163 +			foreach (DirectoryInfo directory in directories)
  68.164 +			{
  68.165 +				LogNotifier.Debug(GetType(), "Load from "+directory.FullName);
  68.166 +				
  68.167 +				foreach (FileInfo file in directory.GetFiles())
  68.168 +				{
  68.169 +					LoadFile(file);
  68.170 +				}
  68.171 +			}
  68.172 +			
  68.173 +			ICollection<Race> races = new List<Race>(); 
  68.174 +			
  68.175 +			foreach (SimpleSet<IWarFoundryObject> objs in loadedObjects.Values)
  68.176 +			{			
  68.177 +				foreach (IWarFoundryObject obj in  objs)
  68.178 +				{
  68.179 +					if (obj is Race)
  68.180 +					{
  68.181 +						races.Add((Race)obj);
  68.182 +					}
  68.183 +					else if (obj is GameSystem)
  68.184 +					{
  68.185 +						StoreGameSystem((GameSystem)obj);
  68.186 +					}
  68.187 +				}
  68.188 +			}
  68.189 +			
  68.190 +			foreach (Race race in races)
  68.191 +			{
  68.192 +				StoreRace(race);
  68.193 +			}					
  68.194 +		}
  68.195 +		
  68.196 +		protected void PrepareForFileLoad()
  68.197 +		{
  68.198 +			//Just set up blank dictionaries for now - may try different and more complex handling in future
  68.199 +			systemsTable = new Dictionary<string,GameSystem>();
  68.200 +			racesTable = new Dictionary<string,Dictionary<string,Dictionary<string,Race>>>();
  68.201 +		}
  68.202 +		
  68.203 +		/// <summary>
  68.204 +		/// Loads a single file through the registered WarFoundryFactories, if a factory exists that supports the file format.
  68.205 +		/// </summary>
  68.206 +		/// <param name="file">
  68.207 +		/// A <see cref="FileInfo"/> for the file to attempt to load
  68.208 +		/// </param>
  68.209 +		protected void LoadFile(FileInfo file)
  68.210 +		{
  68.211 +			bool handled = false;
  68.212 +			
  68.213 +			if (!handled)
  68.214 +			{
  68.215 +				ICollection<IWarFoundryObject> objs = null;
  68.216 +				IWarFoundryFactory loadFactory = null;
  68.217 +				
  68.218 +				if (nonNativeFactories.Count > 0)
  68.219 +				{
  68.220 +					LogNotifier.Debug(GetType(), "Attempting to load "+file.FullName+" as a non-native file");
  68.221 +					
  68.222 +					foreach (INonNativeWarFoundryFactory factory in nonNativeFactories)
  68.223 +					{
  68.224 +						LogNotifier.Debug(GetType(), "Load using "+factory.GetType().AssemblyQualifiedName+"? " + (factory.CanHandleFileFormat(file) ? "yes" : "no"));
  68.225 +						
  68.226 +						if (factory.CanHandleFileFormat(file))
  68.227 +						{
  68.228 +							objs = factory.CreateObjectsFromFile(file);
  68.229 +							
  68.230 +							if (objs!=null)
  68.231 +							{
  68.232 +								loadFactory = factory;
  68.233 +								break;
  68.234 +							}
  68.235 +						}			         
  68.236 +					}
  68.237 +				}
  68.238 +				
  68.239 +				if (objs == null)
  68.240 +				{
  68.241 +					LogNotifier.Debug(GetType(), "Attempting to load "+file.FullName+" as native file");
  68.242 +					
  68.243 +					foreach (INativeWarFoundryFactory factory in factories)
  68.244 +					{
  68.245 +						if (factory.CanHandleFileFormat(file))
  68.246 +						{
  68.247 +							objs = factory.CreateObjectsFromFile(file);
  68.248 +							
  68.249 +							if (objs!=null)
  68.250 +							{
  68.251 +								loadFactory = factory;
  68.252 +								break;
  68.253 +							}
  68.254 +						}
  68.255 +					}
  68.256 +				}
  68.257 +					
  68.258 +				if (objs!=null)
  68.259 +				{
  68.260 +					AddLoadedObjects(objs, loadFactory);
  68.261 +				}
  68.262 +			}
  68.263 +		}
  68.264 +		
  68.265 +		private void AddLoadedObjects(ICollection<IWarFoundryObject> loadedObjs, IWarFoundryFactory factory)
  68.266 +		{
  68.267 +			SimpleSet<IWarFoundryObject> objs;
  68.268 +			loadedObjects.TryGetValue(factory, out objs);
  68.269 +			
  68.270 +			if (objs == null)
  68.271 +			{
  68.272 +				objs = new SimpleSet<IWarFoundryObject>();
  68.273 +				loadedObjects.Add(factory, objs);
  68.274 +			}
  68.275 +				
  68.276 +			objs.AddRange(loadedObjs);
  68.277 +		}
  68.278 +		
  68.279 +		private void AddLoadedObject(IWarFoundryObject obj, IWarFoundryFactory factory)
  68.280 +		{
  68.281 +			SimpleSet<IWarFoundryObject> objs;
  68.282 +			loadedObjects.TryGetValue(factory, out objs);
  68.283 +			
  68.284 +			if (objs == null)
  68.285 +			{
  68.286 +				objs = new SimpleSet<IWarFoundryObject>();
  68.287 +				loadedObjects.Add(factory, objs);
  68.288 +			}
  68.289 +				
  68.290 +			objs.Add(obj);
  68.291 +		}
  68.292 +		
  68.293 +		protected virtual ZipFile MakeZipFile(FileInfo file)
  68.294 +		{
  68.295 +			return new ZipFile(file.FullName);
  68.296 +		}
  68.297 +		
  68.298 +		protected void StoreGameSystem(GameSystem system)
  68.299 +		{
  68.300 +			string sysid = system.ID.ToLower();
  68.301 +					
  68.302 +			if (systemsTable.ContainsKey(sysid))
  68.303 +			{
  68.304 +				LogNotifier.WarnFormat(GetType(), "System {0} ({1}) has already been loaded. Duplicate file ({3}) discarded", system.Name, system.ID, system.SourceFile.FullName);
  68.305 +			}
  68.306 +			else
  68.307 +			{
  68.308 +				systemsTable.Add(sysid, (GameSystem)system);
  68.309 +			}
  68.310 +		}
  68.311 +		
  68.312 +		
  68.313 +		/// <summary>
  68.314 +		/// Stores a loaded <see cref="GameSystem"/> that has been generated outside the core loading structure.
  68.315 +		/// 
  68.316 +		/// Note: Calls to this function should be made before calls to StoreRace(Race, IWarFoundryFactory).
  68.317 +		/// </summary>
  68.318 +		/// <param name="system">
  68.319 +		/// The <see cref="GameSystem"/> to register as loaded.
  68.320 +		/// </param>
  68.321 +		/// <param name="factory">
  68.322 +		/// The <see cref="IWarFoundryFactory"/> that created it.
  68.323 +		/// </param>
  68.324 +		public void StoreGameSystem(GameSystem system, IWarFoundryFactory factory)
  68.325 +		{
  68.326 +			AddLoadedObject(system, factory);	
  68.327 +			StoreGameSystem(system);
  68.328 +		}
  68.329 +		
  68.330 +		protected void StoreRace(Race race)
  68.331 +		{
  68.332 +			Dictionary<string, Dictionary<string, Race>> systemRaces;
  68.333 +
  68.334 +			if (race.GameSystem == null)
  68.335 +			{
  68.336 +				throw new InvalidOperationException("Race cannot have null game system. Game system should be loaded before race.");
  68.337 +			}
  68.338 +			
  68.339 +			string systemID = race.GameSystem.ID.ToLower();
  68.340 +			racesTable.TryGetValue(systemID, out systemRaces);
  68.341 +			
  68.342 +			if (systemRaces==null)
  68.343 +			{
  68.344 +				systemRaces = new Dictionary<string,Dictionary<string,Race>>();
  68.345 +				racesTable.Add(systemID, systemRaces);
  68.346 +			}
  68.347 +			
  68.348 +			Dictionary<string, Race> subRaces;
  68.349 +			systemRaces.TryGetValue(race.ID.ToLower(), out subRaces);
  68.350 +			
  68.351 +			if (subRaces==null)
  68.352 +			{
  68.353 +				subRaces = new Dictionary<string,Race>();
  68.354 +				systemRaces.Add(race.ID.ToLower(), subRaces);
  68.355 +			}
  68.356 +
  68.357 +			if (subRaces.ContainsKey(race.SubID.ToLower()))
  68.358 +			{
  68.359 +				LogNotifier.WarnFormat(GetType(), "Race {0} ({1} - {2}) for system {3} ({4}) has already been loaded. Duplicate file ({5}) discarded", race.Name, race.ID, race.SubID, race.GameSystem.ID, race.GameSystem.Name, race.SourceFile.Name);
  68.360 +				race = null;
  68.361 +			}
  68.362 +			else
  68.363 +			{
  68.364 +				subRaces.Add(race.SubID.ToLower(), race);
  68.365 +			}
  68.366 +		}
  68.367 +		
  68.368 +		/// <summary>
  68.369 +		/// Stores a loaded <see cref="Race"/> that has been generated outside the core loading structure.
  68.370 +		/// 
  68.371 +		/// Note: Calls to this function should ensure that the relevant <see cref="GameSystem"> has been created first.
  68.372 +		/// </summary>
  68.373 +		/// <param name="race">
  68.374 +		/// The <see cref="Race"/> to register as loaded.
  68.375 +		/// </param>
  68.376 +		/// <param name="factory">
  68.377 +		/// The <see cref="IWarFoundryFactory"/> that created it
  68.378 +		/// </param>
  68.379 +		public void StoreRace(Race race, IWarFoundryFactory factory)
  68.380 +		{
  68.381 +			AddLoadedObject(race, factory);
  68.382 +			StoreRace(race);
  68.383 +		}
  68.384 +		
  68.385 +		/// <summary>
  68.386 +		/// Gets all <see cref="GameSystem"/>s that are currently available, determined by those that can be loaded with the current <see cref="IWarFoundryFactory"/>s. 
  68.387 +		/// </summary>
  68.388 +		/// <returns>
  68.389 +		/// An array of <see cref="GameSystem"/>s that are currently available.
  68.390 +		/// </returns>
  68.391 +		public GameSystem[] GetGameSystems()
  68.392 +		{
  68.393 +			if (systemsTable==null)
  68.394 +			{
  68.395 +				LoadFiles();
  68.396 +			}
  68.397 +			
  68.398 +			GameSystem[] systems = new GameSystem[systemsTable.Count];
  68.399 +			int iSys = 0;
  68.400 +			
  68.401 +			foreach (GameSystem sys in systemsTable.Values)
  68.402 +			{
  68.403 +				systems[iSys++] = sys;
  68.404 +			}
  68.405 +			
  68.406 +			return systems;
  68.407 +		}
  68.408 +
  68.409 +		/// <summary>
  68.410 +		/// Gets a single <see cref="GameSystem"/> with a given ID. 
  68.411 +		/// </summary>
  68.412 +		/// <param name="systemID">
  68.413 +		/// The ID of the <see cref="GameSystem"/> to get, as a <see cref="System.String"/>.
  68.414 +		/// </param>
  68.415 +		/// <returns>
  68.416 +		/// The <see cref="GameSystem"/> with the given ID, or <code>null</code> if one doesn't exist.
  68.417 +		/// </returns>
  68.418 +		public GameSystem GetGameSystem(string systemID)
  68.419 +		{
  68.420 +			if (systemsTable==null)
  68.421 +			{
  68.422 +				LoadFiles();
  68.423 +			}
  68.424 +			
  68.425 +			GameSystem system;
  68.426 +			systemsTable.TryGetValue(systemID.ToLower(), out system);
  68.427 +			return system;
  68.428 +		}
  68.429 +
  68.430 +		/// <summary>
  68.431 +		/// Gets an array of the races for the specified <see cref="GameSystem"/>.
  68.432 +		/// </summary>
  68.433 +		/// <param name="system">
  68.434 +		/// The <see cref="GameSystem"/> to get the available races for.
  68.435 +		/// </param>
  68.436 +		/// <returns>
  68.437 +		/// An array of <see cref="Race"/>s for the <see cref="GameSystem"/>
  68.438 +		/// </returns>
  68.439 +		public Race[] GetRaces(GameSystem system)
  68.440 +		{
  68.441 +			return GetRaces(system.ID);
  68.442 +		}
  68.443 +
  68.444 +		/// <summary>
  68.445 +		/// Gets an array of the races for a game system by ID.
  68.446 +		/// </summary>
  68.447 +		/// <param name="systemID">
  68.448 +		/// The <see cref="System.String"/> ID of the game system to get races for
  68.449 +		/// </param>
  68.450 +		/// <returns>
  68.451 +		/// An array of <see cref="Race"/>s for the specified game system
  68.452 +		/// </returns>
  68.453 +		public Race[] GetRaces(string systemID)
  68.454 +		{
  68.455 +			if (racesTable==null)
  68.456 +			{
  68.457 +				LoadFiles();
  68.458 +			}
  68.459 +			
  68.460 +			systemID = systemID.ToLower();
  68.461 +			
  68.462 +			foreach (string key in racesTable.Keys)
  68.463 +			{
  68.464 +				Console.WriteLine(key);
  68.465 +			}
  68.466 +
  68.467 +			Dictionary<string, Dictionary<string, Race>> system;
  68.468 +			racesTable.TryGetValue(systemID, out system);
  68.469 +			
  68.470 +			if (system==null)
  68.471 +			{
  68.472 +				return new Race[0];
  68.473 +			}
  68.474 +
  68.475 +			int count = 0;
  68.476 +
  68.477 +			foreach (Dictionary<string, Race> racesDict in system.Values)
  68.478 +			{
  68.479 +				count+= racesDict.Count;
  68.480 +			}
  68.481 +
  68.482 +			Race[] races = new Race[count];
  68.483 +			int i = 0;
  68.484 +
  68.485 +			foreach (string raceID in system.Keys)
  68.486 +			{
  68.487 +				foreach (string raceSubId in system[raceID].Keys)
  68.488 +				{
  68.489 +					races[i++] = GetRace(systemID, raceID, raceSubId);
  68.490 +				}
  68.491 +			}
  68.492 +
  68.493 +			return races;
  68.494 +		}
  68.495 +
  68.496 +		/// <summary>
  68.497 +		/// Gets a single race for a given <see cref="GameSystem"/> by ID of the race.
  68.498 +		/// </summary>
  68.499 +		/// <param name="system">
  68.500 +		/// The <see cref="GameSystem"/> that the race is part of.
  68.501 +		/// </param>
  68.502 +		/// <param name="raceID">
  68.503 +		/// A <see cref="System.String"/> ID for the race to load.
  68.504 +		/// </param>
  68.505 +		/// <returns>
  68.506 +		/// A <see cref="Race"/> with the specified ID from the <see cref="GameSystem"/>, or <code>null</code> if one doesn't exist.
  68.507 +		/// </returns>
  68.508 +		public Race GetRace(GameSystem system, string raceID)
  68.509 +		{
  68.510 +			return GetRace(system.ID, raceID);
  68.511 +		}
  68.512 +
  68.513 +		/// <summary>
  68.514 +		/// Gets a single race for a given game system by ID of the game system and race.
  68.515 +		/// </summary>
  68.516 +		/// <param name="systemID">
  68.517 +		/// The <see cref="System.String"/> ID of the game system that the race is part of.
  68.518 +		/// </param>
  68.519 +		/// <param name="raceID">
  68.520 +		/// The <see cref="System.String"/> ID for the race to load.
  68.521 +		/// </param>
  68.522 +		/// <returns>
  68.523 +		/// A <see cref="Race"/> with the specified ID from the game system with the specified ID, or <code>null</code> if there is no race or game system with those IDs.
  68.524 +		/// </returns>
  68.525 +		public Race GetRace(string systemID, string raceID)
  68.526 +		{
  68.527 +			return GetRace(systemID, raceID, "");
  68.528 +		}
  68.529 +
  68.530 +		/// <summary>
  68.531 +		/// Gets a single race for a given <see cref="GameSystem"/> by the race's ID and sub-race ID.
  68.532 +		/// </summary>
  68.533 +		/// <param name="system">
  68.534 +		/// The <see cref="GameSystem"/> that the race is part of.
  68.535 +		/// </param>
  68.536 +		/// <param name="raceID">
  68.537 +		/// The <see cref="System.String"/> ID for the race to load.
  68.538 +		/// </param>
  68.539 +		/// <param name="raceSubID">
  68.540 +		/// A <see cref="System.String"/>
  68.541 +		/// </param>
  68.542 +		/// <returns>
  68.543 +		/// A <see cref="Race"/>
  68.544 +		/// </returns>
  68.545 +		public Race GetRace(GameSystem system, string raceID, string raceSubID)
  68.546 +		{
  68.547 +			return GetRace(system.ID, raceID, raceSubID);
  68.548 +		}
  68.549 +
  68.550 +		/// <summary>
  68.551 +		/// Gets a single race for a given game system by the game system's ID and the race's ID and sub-race ID.
  68.552 +		/// </summary>
  68.553 +		/// <param name="systemID">
  68.554 +		/// The <see cref="System.String"/> ID of the game system that the race is part of.
  68.555 +		/// </param>
  68.556 +		/// <param name="raceID">
  68.557 +		/// The <see cref="System.String"/> ID for the race to load.
  68.558 +		/// </param>
  68.559 +		/// <param name="raceSubID">
  68.560 +		/// A <see cref="System.String"/>
  68.561 +		/// </param>
  68.562 +		/// <returns>
  68.563 +		/// A <see cref="Race"/>
  68.564 +		/// </returns>
  68.565 +		public Race GetRace(string systemID, string raceID, string raceSubID)
  68.566 +		{
  68.567 +			if (racesTable==null)
  68.568 +			{
  68.569 +				LoadFiles();
  68.570 +			}
  68.571 +			
  68.572 +			Race race = null;
  68.573 +			
  68.574 +			systemID = systemID.ToLower();
  68.575 +
  68.576 +			Dictionary<string, Dictionary<string, Race>> races;
  68.577 +			racesTable.TryGetValue(systemID, out races);
  68.578 +
  68.579 +			if (races!=null)
  68.580 +			{
  68.581 +				Dictionary<string, Race> subraces;
  68.582 +				races.TryGetValue(raceID, out subraces);
  68.583 +
  68.584 +				if (subraces!=null)
  68.585 +				{
  68.586 +					subraces.TryGetValue(raceSubID, out race);
  68.587 +				}
  68.588 +			}
  68.589 +			
  68.590 +			return race;
  68.591 +		}
  68.592 +
  68.593 +		/// <summary>
  68.594 +		/// Gets the IDs of all of the game systems currently available.
  68.595 +		/// </summary>
  68.596 +		/// <returns>
  68.597 +		/// An array of <see cref="System.String"/>s representing the IDs of the game systems.
  68.598 +		/// </returns>
  68.599 +		public string[] GetGameSystemIDs()
  68.600 +		{
  68.601 +			if (systemsTable==null)
  68.602 +			{
  68.603 +				LoadFiles();
  68.604 +			}
  68.605 +
  68.606 +			string[] keys = new string[systemsTable.Keys.Count];
  68.607 +			int i = 0;
  68.608 +
  68.609 +			foreach (string key in systemsTable.Keys)
  68.610 +			{
  68.611 +				keys[i++] = key;
  68.612 +			}
  68.613 +
  68.614 +			return keys;
  68.615 +		}
  68.616 +		
  68.617 +		/// <summary>
  68.618 +		/// Gets the IDs of all of the races of a specified game system.
  68.619 +		/// </summary>
  68.620 +		/// <param name="system">
  68.621 +		/// The <see cref="GameSystem"/> to get the available races for.
  68.622 +		/// </param>
  68.623 +		/// <returns>
  68.624 +		/// An array of <see cref="System.String"/>s representing the IDs of the races of the specified game system.
  68.625 +		/// </returns>
  68.626 +		public string[] GetSystemRaceIDs(GameSystem system)
  68.627 +		{
  68.628 +			return GetSystemRaceIDs(system.ID);
  68.629 +		}
  68.630 +
  68.631 +		/// <summary>
  68.632 +		/// Gets the IDs of all of the races of a specified game system.
  68.633 +		/// </summary>
  68.634 +		/// <param name="systemID">
  68.635 +		/// The <see cref="System.String"/> ID of the game system to get the available races for.
  68.636 +		/// </param>
  68.637 +		/// <returns>
  68.638 +		/// An array of <see cref="System.String"/>s representing the IDs of the races of the specified game system.
  68.639 +		/// </returns>
  68.640 +		public string[] GetSystemRaceIDs(string systemID)
  68.641 +		{
  68.642 +			if (racesTable == null)
  68.643 +			{
  68.644 +				LoadFiles();
  68.645 +			}
  68.646 +
  68.647 +			Dictionary<string, Dictionary<string, Race>> races = racesTable[systemID.ToLower()];
  68.648 +
  68.649 +			if (races==null)
  68.650 +			{
  68.651 +				return new string[0];
  68.652 +			}
  68.653 +			else
  68.654 +			{
  68.655 +				string[] keys = new string[races.Keys.Count];
  68.656 +				int i = 0;
  68.657 +
  68.658 +				foreach (string key in races.Keys)
  68.659 +				{
  68.660 +					keys[i++] = key;
  68.661 +				}
  68.662 +
  68.663 +				return keys;
  68.664 +			}
  68.665 +		}
  68.666 +	}
  68.667 +}
    69.1 Binary file libs/ICSharpCode.SharpZipLib.dll has changed
    70.1 Binary file libs/log4net.dll has changed
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/libs/log4net.xml	Fri Dec 19 15:57:51 2008 +0000
    71.3 @@ -0,0 +1,27658 @@
    71.4 +<?xml version="1.0"?>
    71.5 +<doc>
    71.6 +    <assembly>
    71.7 +        <name>log4net</name>
    71.8 +    </assembly>
    71.9 +    <members>
   71.10 +        <member name="T:log4net.Appender.AdoNetAppender">
   71.11 +            <summary>
   71.12 +            Appender that logs to a database.
   71.13 +            </summary>
   71.14 +            <remarks>
   71.15 +            <para>
   71.16 +            <see cref="T:log4net.Appender.AdoNetAppender"/> appends logging events to a table within a
   71.17 +            database. The appender can be configured to specify the connection 
   71.18 +            string by setting the <see cref="P:log4net.Appender.AdoNetAppender.ConnectionString"/> property. 
   71.19 +            The connection type (provider) can be specified by setting the <see cref="P:log4net.Appender.AdoNetAppender.ConnectionType"/>
   71.20 +            property. For more information on database connection strings for
   71.21 +            your specific database see <a href="http://www.connectionstrings.com/">http://www.connectionstrings.com/</a>.
   71.22 +            </para>
   71.23 +            <para>
   71.24 +            Records are written into the database either using a prepared
   71.25 +            statement or a stored procedure. The <see cref="P:log4net.Appender.AdoNetAppender.CommandType"/> property
   71.26 +            is set to <see cref="F:System.Data.CommandType.Text"/> (<c>System.Data.CommandType.Text</c>) to specify a prepared statement
   71.27 +            or to <see cref="F:System.Data.CommandType.StoredProcedure"/> (<c>System.Data.CommandType.StoredProcedure</c>) to specify a stored
   71.28 +            procedure.
   71.29 +            </para>
   71.30 +            <para>
   71.31 +            The prepared statement text or the name of the stored procedure
   71.32 +            must be set in the <see cref="P:log4net.Appender.AdoNetAppender.CommandText"/> property.
   71.33 +            </para>
   71.34 +            <para>
   71.35 +            The prepared statement or stored procedure can take a number
   71.36 +            of parameters. Parameters are added using the <see cref="M:log4net.Appender.AdoNetAppender.AddParameter(log4net.Appender.AdoNetAppenderParameter)"/>
   71.37 +            method. This adds a single <see cref="T:log4net.Appender.AdoNetAppenderParameter"/> to the
   71.38 +            ordered list of parameters. The <see cref="T:log4net.Appender.AdoNetAppenderParameter"/>
   71.39 +            type may be subclassed if required to provide database specific
   71.40 +            functionality. The <see cref="T:log4net.Appender.AdoNetAppenderParameter"/> specifies
   71.41 +            the parameter name, database type, size, and how the value should
   71.42 +            be generated using a <see cref="T:log4net.Layout.ILayout"/>.
   71.43 +            </para>
   71.44 +            </remarks>
   71.45 +            <example>
   71.46 +            An example of a SQL Server table that could be logged to:
   71.47 +            <code lang="SQL">
   71.48 +            CREATE TABLE [dbo].[Log] ( 
   71.49 +              [ID] [int] IDENTITY (1, 1) NOT NULL ,
   71.50 +              [Date] [datetime] NOT NULL ,
   71.51 +              [Thread] [varchar] (255) NOT NULL ,
   71.52 +              [Level] [varchar] (20) NOT NULL ,
   71.53 +              [Logger] [varchar] (255) NOT NULL ,
   71.54 +              [Message] [varchar] (4000) NOT NULL 
   71.55 +            ) ON [PRIMARY]
   71.56 +            </code>
   71.57 +            </example>
   71.58 +            <example>
   71.59 +            An example configuration to log to the above table:
   71.60 +            <code lang="XML" escaped="true">
   71.61 +            <appender name="AdoNetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
   71.62 +              <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
   71.63 +              <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;User ID=sa;Password=sa"/>
   71.64 +              <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)"/>
   71.65 +              <parameter>
   71.66 +                <parameterName value="@log_date"/>
   71.67 +                <dbType value="DateTime"/>
   71.68 +                <layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}"/>
   71.69 +              </parameter>
   71.70 +              <parameter>
   71.71 +                <parameterName value="@thread"/>
   71.72 +                <dbType value="String"/>
   71.73 +                <size value="255"/>
   71.74 +                <layout type="log4net.Layout.PatternLayout" value="%thread"/>
   71.75 +              </parameter>
   71.76 +              <parameter>
   71.77 +                <parameterName value="@log_level"/>
   71.78 +                <dbType value="String"/>
   71.79 +                <size value="50"/>
   71.80 +                <layout type="log4net.Layout.PatternLayout" value="%level"/>
   71.81 +              </parameter>
   71.82 +              <parameter>
   71.83 +                <parameterName value="@logger"/>
   71.84 +                <dbType value="String"/>
   71.85 +                <size value="255"/>
   71.86 +                <layout type="log4net.Layout.PatternLayout" value="%logger"/>
   71.87 +              </parameter>
   71.88 +              <parameter>
   71.89 +                <parameterName value="@message"/>
   71.90 +                <dbType value="String"/>
   71.91 +                <size value="4000"/>
   71.92 +                <layout type="log4net.Layout.PatternLayout" value="%message"/>
   71.93 +              </parameter>
   71.94 +            </appender>
   71.95 +            </code>
   71.96 +            </example>
   71.97 +            <author>Julian Biddle</author>
   71.98 +            <author>Nicko Cadell</author>
   71.99 +            <author>Gert Driesen</author>
  71.100 +            <author>Lance Nehring</author>
  71.101 +        </member>
  71.102 +        <member name="T:log4net.Appender.BufferingAppenderSkeleton">
  71.103 +            <summary>
  71.104 +            Abstract base class implementation of <see cref="T:log4net.Appender.IAppender"/> that 
  71.105 +            buffers events in a fixed size buffer.
  71.106 +            </summary>
  71.107 +            <remarks>
  71.108 +            <para>
  71.109 +            This base class should be used by appenders that need to buffer a 
  71.110 +            number of events before logging them. For example the <see cref="T:log4net.Appender.AdoNetAppender"/> 
  71.111 +            buffers events and then submits the entire contents of the buffer to 
  71.112 +            the underlying database in one go.
  71.113 +            </para>
  71.114 +            <para>
  71.115 +            Subclasses should override the <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>
  71.116 +            method to deliver the buffered events.
  71.117 +            </para>
  71.118 +            <para>The BufferingAppenderSkeleton maintains a fixed size cyclic 
  71.119 +            buffer of events. The size of the buffer is set using 
  71.120 +            the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize"/> property.
  71.121 +            </para>
  71.122 +            <para>A <see cref="T:log4net.Core.ITriggeringEventEvaluator"/> is used to inspect 
  71.123 +            each event as it arrives in the appender. If the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> 
  71.124 +            triggers, then the current buffer is sent immediately 
  71.125 +            (see <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>). Otherwise the event 
  71.126 +            is stored in the buffer. For example, an evaluator can be used to 
  71.127 +            deliver the events immediately when an ERROR event arrives.
  71.128 +            </para>
  71.129 +            <para>
  71.130 +            The buffering appender can be configured in a <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> mode. 
  71.131 +            By default the appender is NOT lossy. When the buffer is full all 
  71.132 +            the buffered events are sent with <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>.
  71.133 +            If the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> property is set to <c>true</c> then the 
  71.134 +            buffer will not be sent when it is full, and new events arriving 
  71.135 +            in the appender will overwrite the oldest event in the buffer. 
  71.136 +            In lossy mode the buffer will only be sent when the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/>
  71.137 +            triggers. This can be useful behavior when you need to know about 
  71.138 +            ERROR events but not about events with a lower level, configure an 
  71.139 +            evaluator that will trigger when an ERROR event arrives, the whole 
  71.140 +            buffer will be sent which gives a history of events leading up to
  71.141 +            the ERROR event.
  71.142 +            </para>
  71.143 +            </remarks>
  71.144 +            <author>Nicko Cadell</author>
  71.145 +            <author>Gert Driesen</author>
  71.146 +        </member>
  71.147 +        <member name="T:log4net.Appender.AppenderSkeleton">
  71.148 +            <summary>
  71.149 +            Abstract base class implementation of <see cref="T:log4net.Appender.IAppender"/>. 
  71.150 +            </summary>
  71.151 +            <remarks>
  71.152 +            <para>
  71.153 +            This class provides the code for common functionality, such 
  71.154 +            as support for threshold filtering and support for general filters.
  71.155 +            </para>
  71.156 +            <para>
  71.157 +            Appenders can also implement the <see cref="T:log4net.Core.IOptionHandler"/> interface. Therefore
  71.158 +            they would require that the <see cref="M:log4net.Core.IOptionHandler.ActivateOptions"/> method
  71.159 +            be called after the appenders properties have been configured.
  71.160 +            </para>
  71.161 +            </remarks>
  71.162 +            <author>Nicko Cadell</author>
  71.163 +            <author>Gert Driesen</author>
  71.164 +        </member>
  71.165 +        <member name="T:log4net.Appender.IAppender">
  71.166 +            <summary>
  71.167 +            Implement this interface for your own strategies for printing log statements.
  71.168 +            </summary>
  71.169 +            <remarks>
  71.170 +            <para>
  71.171 +            Implementors should consider extending the <see cref="T:log4net.Appender.AppenderSkeleton"/>
  71.172 +            class which provides a default implementation of this interface.
  71.173 +            </para>
  71.174 +            <para>
  71.175 +            Appenders can also implement the <see cref="T:log4net.Core.IOptionHandler"/> interface. Therefore
  71.176 +            they would require that the <see cref="M:log4net.Core.IOptionHandler.ActivateOptions"/> method
  71.177 +            be called after the appenders properties have been configured.
  71.178 +            </para>
  71.179 +            </remarks>
  71.180 +            <author>Nicko Cadell</author>
  71.181 +            <author>Gert Driesen</author>
  71.182 +        </member>
  71.183 +        <member name="M:log4net.Appender.IAppender.Close">
  71.184 +            <summary>
  71.185 +            Closes the appender and releases resources.
  71.186 +            </summary>
  71.187 +            <remarks>
  71.188 +            <para>
  71.189 +            Releases any resources allocated within the appender such as file handles, 
  71.190 +            network connections, etc.
  71.191 +            </para>
  71.192 +            <para>
  71.193 +            It is a programming error to append to a closed appender.
  71.194 +            </para>
  71.195 +            </remarks>
  71.196 +        </member>
  71.197 +        <member name="M:log4net.Appender.IAppender.DoAppend(log4net.Core.LoggingEvent)">
  71.198 +            <summary>
  71.199 +            Log the logging event in Appender specific way.
  71.200 +            </summary>
  71.201 +            <param name="loggingEvent">The event to log</param>
  71.202 +            <remarks>
  71.203 +            <para>
  71.204 +            This method is called to log a message into this appender.
  71.205 +            </para>
  71.206 +            </remarks>
  71.207 +        </member>
  71.208 +        <member name="P:log4net.Appender.IAppender.Name">
  71.209 +            <summary>
  71.210 +            Gets or sets the name of this appender.
  71.211 +            </summary>
  71.212 +            <value>The name of the appender.</value>
  71.213 +            <remarks>
  71.214 +            <para>The name uniquely identifies the appender.</para>
  71.215 +            </remarks>
  71.216 +        </member>
  71.217 +        <member name="T:log4net.Appender.IBulkAppender">
  71.218 +            <summary>
  71.219 +            Interface for appenders that support bulk logging.
  71.220 +            </summary>
  71.221 +            <remarks>
  71.222 +            <para>
  71.223 +            This interface extends the <see cref="T:log4net.Appender.IAppender"/> interface to
  71.224 +            support bulk logging of <see cref="T:log4net.Core.LoggingEvent"/> objects. Appenders
  71.225 +            should only implement this interface if they can bulk log efficiently.
  71.226 +            </para>
  71.227 +            </remarks>
  71.228 +            <author>Nicko Cadell</author>
  71.229 +        </member>
  71.230 +        <member name="M:log4net.Appender.IBulkAppender.DoAppend(log4net.Core.LoggingEvent[])">
  71.231 +            <summary>
  71.232 +            Log the array of logging events in Appender specific way.
  71.233 +            </summary>
  71.234 +            <param name="loggingEvents">The events to log</param>
  71.235 +            <remarks>
  71.236 +            <para>
  71.237 +            This method is called to log an array of events into this appender.
  71.238 +            </para>
  71.239 +            </remarks>
  71.240 +        </member>
  71.241 +        <member name="T:log4net.Core.IOptionHandler">
  71.242 +            <summary>
  71.243 +            Interface used to delay activate a configured object.
  71.244 +            </summary>
  71.245 +            <remarks>
  71.246 +            <para>
  71.247 +            This allows an object to defer activation of its options until all
  71.248 +            options have been set. This is required for components which have
  71.249 +            related options that remain ambiguous until all are set.
  71.250 +            </para>
  71.251 +            <para>
  71.252 +            If a component implements this interface then the <see cref="M:log4net.Core.IOptionHandler.ActivateOptions"/> method 
  71.253 +            must be called by the container after its all the configured properties have been set 
  71.254 +            and before the component can be used.
  71.255 +            </para>
  71.256 +            </remarks>
  71.257 +            <author>Nicko Cadell</author>
  71.258 +        </member>
  71.259 +        <member name="M:log4net.Core.IOptionHandler.ActivateOptions">
  71.260 +            <summary>
  71.261 +            Activate the options that were previously set with calls to properties.
  71.262 +            </summary>
  71.263 +            <remarks>
  71.264 +            <para>
  71.265 +            This allows an object to defer activation of its options until all
  71.266 +            options have been set. This is required for components which have
  71.267 +            related options that remain ambiguous until all are set.
  71.268 +            </para>
  71.269 +            <para>
  71.270 +            If a component implements this interface then this method must be called
  71.271 +            after its properties have been set before the component can be used.
  71.272 +            </para>
  71.273 +            </remarks>
  71.274 +        </member>
  71.275 +        <member name="F:log4net.Appender.AppenderSkeleton.c_renderBufferSize">
  71.276 +            <summary>
  71.277 +            Initial buffer size
  71.278 +            </summary>
  71.279 +        </member>
  71.280 +        <member name="F:log4net.Appender.AppenderSkeleton.c_renderBufferMaxCapacity">
  71.281 +            <summary>
  71.282 +            Maximum buffer size before it is recycled
  71.283 +            </summary>
  71.284 +        </member>
  71.285 +        <member name="M:log4net.Appender.AppenderSkeleton.#ctor">
  71.286 +            <summary>
  71.287 +            Default constructor
  71.288 +            </summary>
  71.289 +            <remarks>
  71.290 +            <para>Empty default constructor</para>
  71.291 +            </remarks>
  71.292 +        </member>
  71.293 +        <member name="M:log4net.Appender.AppenderSkeleton.Finalize">
  71.294 +            <summary>
  71.295 +            Finalizes this appender by calling the implementation's 
  71.296 +            <see cref="M:log4net.Appender.AppenderSkeleton.Close"/> method.
  71.297 +            </summary>
  71.298 +            <remarks>
  71.299 +            <para>
  71.300 +            If this appender has not been closed then the <c>Finalize</c> method
  71.301 +            will call <see cref="M:log4net.Appender.AppenderSkeleton.Close"/>.
  71.302 +            </para>
  71.303 +            </remarks>
  71.304 +        </member>
  71.305 +        <member name="M:log4net.Appender.AppenderSkeleton.ActivateOptions">
  71.306 +            <summary>
  71.307 +            Initialize the appender based on the options set
  71.308 +            </summary>
  71.309 +            <remarks>
  71.310 +            <para>
  71.311 +            This is part of the <see cref="T:log4net.Core.IOptionHandler"/> delayed object
  71.312 +            activation scheme. The <see cref="M:log4net.Appender.AppenderSkeleton.ActivateOptions"/> method must 
  71.313 +            be called on this object after the configuration properties have
  71.314 +            been set. Until <see cref="M:log4net.Appender.AppenderSkeleton.ActivateOptions"/> is called this
  71.315 +            object is in an undefined state and must not be used. 
  71.316 +            </para>
  71.317 +            <para>
  71.318 +            If any of the configuration properties are modified then 
  71.319 +            <see cref="M:log4net.Appender.AppenderSkeleton.ActivateOptions"/> must be called again.
  71.320 +            </para>
  71.321 +            </remarks>
  71.322 +        </member>
  71.323 +        <member name="M:log4net.Appender.AppenderSkeleton.Close">
  71.324 +            <summary>
  71.325 +            Closes the appender and release resources.
  71.326 +            </summary>
  71.327 +            <remarks>
  71.328 +            <para>
  71.329 +            Release any resources allocated within the appender such as file handles, 
  71.330 +            network connections, etc.
  71.331 +            </para>
  71.332 +            <para>
  71.333 +            It is a programming error to append to a closed appender.
  71.334 +            </para>
  71.335 +            <para>
  71.336 +            This method cannot be overridden by subclasses. This method 
  71.337 +            delegates the closing of the appender to the <see cref="M:log4net.Appender.AppenderSkeleton.OnClose"/>
  71.338 +            method which must be overridden in the subclass.
  71.339 +            </para>
  71.340 +            </remarks>
  71.341 +        </member>
  71.342 +        <member name="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)">
  71.343 +            <summary>
  71.344 +            Performs threshold checks and invokes filters before 
  71.345 +            delegating actual logging to the subclasses specific 
  71.346 +            <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> method.
  71.347 +            </summary>
  71.348 +            <param name="loggingEvent">The event to log.</param>
  71.349 +            <remarks>
  71.350 +            <para>
  71.351 +            This method cannot be overridden by derived classes. A
  71.352 +            derived class should override the <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> method
  71.353 +            which is called by this method.
  71.354 +            </para>
  71.355 +            <para>
  71.356 +            The implementation of this method is as follows:
  71.357 +            </para>
  71.358 +            <para>
  71.359 +            <list type="bullet">
  71.360 +            	<item>
  71.361 +            		<description>
  71.362 +            		Checks that the severity of the <paramref name="loggingEvent"/>
  71.363 +            		is greater than or equal to the <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> of this
  71.364 +            		appender.</description>
  71.365 +            	</item>
  71.366 +            	<item>
  71.367 +            		<description>
  71.368 +            		Checks that the <see cref="T:log4net.Filter.IFilter"/> chain accepts the 
  71.369 +            		<paramref name="loggingEvent"/>.
  71.370 +            		</description>
  71.371 +            	</item>
  71.372 +            	<item>
  71.373 +            		<description>
  71.374 +            		Calls <see cref="M:log4net.Appender.AppenderSkeleton.PreAppendCheck"/> and checks that 
  71.375 +            		it returns <c>true</c>.</description>
  71.376 +            	</item>
  71.377 +            </list>
  71.378 +            </para>
  71.379 +            <para>
  71.380 +            If all of the above steps succeed then the <paramref name="loggingEvent"/>
  71.381 +            will be passed to the abstract <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> method.
  71.382 +            </para>
  71.383 +            </remarks>
  71.384 +        </member>
  71.385 +        <member name="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent[])">
  71.386 +            <summary>
  71.387 +            Performs threshold checks and invokes filters before 
  71.388 +            delegating actual logging to the subclasses specific 
  71.389 +            <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent[])"/> method.
  71.390 +            </summary>
  71.391 +            <param name="loggingEvents">The array of events to log.</param>
  71.392 +            <remarks>
  71.393 +            <para>
  71.394 +            This method cannot be overridden by derived classes. A
  71.395 +            derived class should override the <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent[])"/> method
  71.396 +            which is called by this method.
  71.397 +            </para>
  71.398 +            <para>
  71.399 +            The implementation of this method is as follows:
  71.400 +            </para>
  71.401 +            <para>
  71.402 +            <list type="bullet">
  71.403 +            	<item>
  71.404 +            		<description>
  71.405 +            		Checks that the severity of the <paramref name="loggingEvent"/>
  71.406 +            		is greater than or equal to the <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> of this
  71.407 +            		appender.</description>
  71.408 +            	</item>
  71.409 +            	<item>
  71.410 +            		<description>
  71.411 +            		Checks that the <see cref="T:log4net.Filter.IFilter"/> chain accepts the 
  71.412 +            		<paramref name="loggingEvent"/>.
  71.413 +            		</description>
  71.414 +            	</item>
  71.415 +            	<item>
  71.416 +            		<description>
  71.417 +            		Calls <see cref="M:log4net.Appender.AppenderSkeleton.PreAppendCheck"/> and checks that 
  71.418 +            		it returns <c>true</c>.</description>
  71.419 +            	</item>
  71.420 +            </list>
  71.421 +            </para>
  71.422 +            <para>
  71.423 +            If all of the above steps succeed then the <paramref name="loggingEvents"/>
  71.424 +            will be passed to the <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent[])"/> method.
  71.425 +            </para>
  71.426 +            </remarks>
  71.427 +        </member>
  71.428 +        <member name="M:log4net.Appender.AppenderSkeleton.FilterEvent(log4net.Core.LoggingEvent)">
  71.429 +            <summary>
  71.430 +            Test if the logging event should we output by this appender
  71.431 +            </summary>
  71.432 +            <param name="loggingEvent">the event to test</param>
  71.433 +            <returns><c>true</c> if the event should be output, <c>false</c> if the event should be ignored</returns>
  71.434 +            <remarks>
  71.435 +            <para>
  71.436 +            This method checks the logging event against the threshold level set
  71.437 +            on this appender and also against the filters specified on this
  71.438 +            appender.
  71.439 +            </para>
  71.440 +            <para>
  71.441 +            The implementation of this method is as follows:
  71.442 +            </para>
  71.443 +            <para>
  71.444 +            <list type="bullet">
  71.445 +            	<item>
  71.446 +            		<description>
  71.447 +            		Checks that the severity of the <paramref name="loggingEvent"/>
  71.448 +            		is greater than or equal to the <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> of this
  71.449 +            		appender.</description>
  71.450 +            	</item>
  71.451 +            	<item>
  71.452 +            		<description>
  71.453 +            		Checks that the <see cref="T:log4net.Filter.IFilter"/> chain accepts the 
  71.454 +            		<paramref name="loggingEvent"/>.
  71.455 +            		</description>
  71.456 +            	</item>
  71.457 +            </list>
  71.458 +            </para>
  71.459 +            </remarks>
  71.460 +        </member>
  71.461 +        <member name="M:log4net.Appender.AppenderSkeleton.AddFilter(log4net.Filter.IFilter)">
  71.462 +            <summary>
  71.463 +            Adds a filter to the end of the filter chain.
  71.464 +            </summary>
  71.465 +            <param name="filter">the filter to add to this appender</param>
  71.466 +            <remarks>
  71.467 +            <para>
  71.468 +            The Filters are organized in a linked list.
  71.469 +            </para>
  71.470 +            <para>
  71.471 +            Setting this property causes the new filter to be pushed onto the 
  71.472 +            back of the filter chain.
  71.473 +            </para>
  71.474 +            </remarks>
  71.475 +        </member>
  71.476 +        <member name="M:log4net.Appender.AppenderSkeleton.ClearFilters">
  71.477 +            <summary>
  71.478 +            Clears the filter list for this appender.
  71.479 +            </summary>
  71.480 +            <remarks>
  71.481 +            <para>
  71.482 +            Clears the filter list for this appender.
  71.483 +            </para>
  71.484 +            </remarks>
  71.485 +        </member>
  71.486 +        <member name="M:log4net.Appender.AppenderSkeleton.IsAsSevereAsThreshold(log4net.Core.Level)">
  71.487 +            <summary>
  71.488 +            Checks if the message level is below this appender's threshold.
  71.489 +            </summary>
  71.490 +            <param name="level"><see cref="T:log4net.Core.Level"/> to test against.</param>
  71.491 +            <remarks>
  71.492 +            <para>
  71.493 +            If there is no threshold set, then the return value is always <c>true</c>.
  71.494 +            </para>
  71.495 +            </remarks>
  71.496 +            <returns>
  71.497 +            <c>true</c> if the <paramref name="level"/> meets the <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> 
  71.498 +            requirements of this appender.
  71.499 +            </returns>
  71.500 +        </member>
  71.501 +        <member name="M:log4net.Appender.AppenderSkeleton.OnClose">
  71.502 +            <summary>
  71.503 +            Is called when the appender is closed. Derived classes should override 
  71.504 +            this method if resources need to be released.
  71.505 +            </summary>
  71.506 +            <remarks>
  71.507 +            <para>
  71.508 +            Releases any resources allocated within the appender such as file handles, 
  71.509 +            network connections, etc.
  71.510 +            </para>
  71.511 +            <para>
  71.512 +            It is a programming error to append to a closed appender.
  71.513 +            </para>
  71.514 +            </remarks>
  71.515 +        </member>
  71.516 +        <member name="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)">
  71.517 +            <summary>
  71.518 +            Subclasses of <see cref="T:log4net.Appender.AppenderSkeleton"/> should implement this method 
  71.519 +            to perform actual logging.
  71.520 +            </summary>
  71.521 +            <param name="loggingEvent">The event to append.</param>
  71.522 +            <remarks>
  71.523 +            <para>
  71.524 +            A subclass must implement this method to perform
  71.525 +            logging of the <paramref name="loggingEvent"/>.
  71.526 +            </para>
  71.527 +            <para>This method will be called by <see cref="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/>
  71.528 +            if all the conditions listed for that method are met.
  71.529 +            </para>
  71.530 +            <para>
  71.531 +            To restrict the logging of events in the appender
  71.532 +            override the <see cref="M:log4net.Appender.AppenderSkeleton.PreAppendCheck"/> method.
  71.533 +            </para>
  71.534 +            </remarks>
  71.535 +        </member>
  71.536 +        <member name="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent[])">
  71.537 +            <summary>
  71.538 +            Append a bulk array of logging events.
  71.539 +            </summary>
  71.540 +            <param name="loggingEvents">the array of logging events</param>
  71.541 +            <remarks>
  71.542 +            <para>
  71.543 +            This base class implementation calls the <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/>
  71.544 +            method for each element in the bulk array.
  71.545 +            </para>
  71.546 +            <para>
  71.547 +            A sub class that can better process a bulk array of events should
  71.548 +            override this method in addition to <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/>.
  71.549 +            </para>
  71.550 +            </remarks>
  71.551 +        </member>
  71.552 +        <member name="M:log4net.Appender.AppenderSkeleton.PreAppendCheck">
  71.553 +            <summary>
  71.554 +            Called before <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> as a precondition.
  71.555 +            </summary>
  71.556 +            <remarks>
  71.557 +            <para>
  71.558 +            This method is called by <see cref="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/>
  71.559 +            before the call to the abstract <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> method.
  71.560 +            </para>
  71.561 +            <para>
  71.562 +            This method can be overridden in a subclass to extend the checks 
  71.563 +            made before the event is passed to the <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> method.
  71.564 +            </para>
  71.565 +            <para>
  71.566 +            A subclass should ensure that they delegate this call to
  71.567 +            this base class if it is overridden.
  71.568 +            </para>
  71.569 +            </remarks>
  71.570 +            <returns><c>true</c> if the call to <see cref="M:log4net.Appender.AppenderSkeleton.Append(log4net.Core.LoggingEvent)"/> should proceed.</returns>
  71.571 +        </member>
  71.572 +        <member name="M:log4net.Appender.AppenderSkeleton.RenderLoggingEvent(log4net.Core.LoggingEvent)">
  71.573 +            <summary>
  71.574 +            Renders the <see cref="T:log4net.Core.LoggingEvent"/> to a string.
  71.575 +            </summary>
  71.576 +            <param name="loggingEvent">The event to render.</param>
  71.577 +            <returns>The event rendered as a string.</returns>
  71.578 +            <remarks>
  71.579 +            <para>
  71.580 +            Helper method to render a <see cref="T:log4net.Core.LoggingEvent"/> to 
  71.581 +            a string. This appender must have a <see cref="P:log4net.Appender.AppenderSkeleton.Layout"/>
  71.582 +            set to render the <paramref name="loggingEvent"/> to 
  71.583 +            a string.
  71.584 +            </para>
  71.585 +            <para>If there is exception data in the logging event and 
  71.586 +            the layout does not process the exception, this method 
  71.587 +            will append the exception text to the rendered string.
  71.588 +            </para>
  71.589 +            <para>
  71.590 +            Where possible use the alternative version of this method
  71.591 +            <see cref="M:log4net.Appender.AppenderSkeleton.RenderLoggingEvent(System.IO.TextWriter,log4net.Core.LoggingEvent)"/>.
  71.592 +            That method streams the rendering onto an existing Writer
  71.593 +            which can give better performance if the caller already has
  71.594 +            a <see cref="T:System.IO.TextWriter"/> open and ready for writing.
  71.595 +            </para>
  71.596 +            </remarks>
  71.597 +        </member>
  71.598 +        <member name="M:log4net.Appender.AppenderSkeleton.RenderLoggingEvent(System.IO.TextWriter,log4net.Core.LoggingEvent)">
  71.599 +            <summary>
  71.600 +            Renders the <see cref="T:log4net.Core.LoggingEvent"/> to a string.
  71.601 +            </summary>
  71.602 +            <param name="loggingEvent">The event to render.</param>
  71.603 +            <param name="writer">The TextWriter to write the formatted event to</param>
  71.604 +            <remarks>
  71.605 +            <para>
  71.606 +            Helper method to render a <see cref="T:log4net.Core.LoggingEvent"/> to 
  71.607 +            a string. This appender must have a <see cref="P:log4net.Appender.AppenderSkeleton.Layout"/>
  71.608 +            set to render the <paramref name="loggingEvent"/> to 
  71.609 +            a string.
  71.610 +            </para>
  71.611 +            <para>If there is exception data in the logging event and 
  71.612 +            the layout does not process the exception, this method 
  71.613 +            will append the exception text to the rendered string.
  71.614 +            </para>
  71.615 +            <para>
  71.616 +            Use this method in preference to <see cref="M:log4net.Appender.AppenderSkeleton.RenderLoggingEvent(log4net.Core.LoggingEvent)"/>
  71.617 +            where possible. If, however, the caller needs to render the event
  71.618 +            to a string then <see cref="M:log4net.Appender.AppenderSkeleton.RenderLoggingEvent(log4net.Core.LoggingEvent)"/> does
  71.619 +            provide an efficient mechanism for doing so.
  71.620 +            </para>
  71.621 +            </remarks>
  71.622 +        </member>
  71.623 +        <member name="F:log4net.Appender.AppenderSkeleton.m_layout">
  71.624 +            <summary>
  71.625 +            The layout of this appender.
  71.626 +            </summary>
  71.627 +            <remarks>
  71.628 +            See <see cref="P:log4net.Appender.AppenderSkeleton.Layout"/> for more information.
  71.629 +            </remarks>
  71.630 +        </member>
  71.631 +        <member name="F:log4net.Appender.AppenderSkeleton.m_name">
  71.632 +            <summary>
  71.633 +            The name of this appender.
  71.634 +            </summary>
  71.635 +            <remarks>
  71.636 +            See <see cref="P:log4net.Appender.AppenderSkeleton.Name"/> for more information.
  71.637 +            </remarks>
  71.638 +        </member>
  71.639 +        <member name="F:log4net.Appender.AppenderSkeleton.m_threshold">
  71.640 +            <summary>
  71.641 +            The level threshold of this appender.
  71.642 +            </summary>
  71.643 +            <remarks>
  71.644 +            <para>
  71.645 +            There is no level threshold filtering by default.
  71.646 +            </para>
  71.647 +            <para>
  71.648 +            See <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> for more information.
  71.649 +            </para>
  71.650 +            </remarks>
  71.651 +        </member>
  71.652 +        <member name="F:log4net.Appender.AppenderSkeleton.m_errorHandler">
  71.653 +            <summary>
  71.654 +            It is assumed and enforced that errorHandler is never null.
  71.655 +            </summary>
  71.656 +            <remarks>
  71.657 +            <para>
  71.658 +            It is assumed and enforced that errorHandler is never null.
  71.659 +            </para>
  71.660 +            <para>
  71.661 +            See <see cref="P:log4net.Appender.AppenderSkeleton.ErrorHandler"/> for more information.
  71.662 +            </para>
  71.663 +            </remarks>
  71.664 +        </member>
  71.665 +        <member name="F:log4net.Appender.AppenderSkeleton.m_headFilter">
  71.666 +            <summary>
  71.667 +            The first filter in the filter chain.
  71.668 +            </summary>
  71.669 +            <remarks>
  71.670 +            <para>
  71.671 +            Set to <c>null</c> initially.
  71.672 +            </para>
  71.673 +            <para>
  71.674 +            See <see cref="T:log4net.Filter.IFilter"/> for more information.
  71.675 +            </para>
  71.676 +            </remarks>
  71.677 +        </member>
  71.678 +        <member name="F:log4net.Appender.AppenderSkeleton.m_tailFilter">
  71.679 +            <summary>
  71.680 +            The last filter in the filter chain.
  71.681 +            </summary>
  71.682 +            <remarks>
  71.683 +            See <see cref="T:log4net.Filter.IFilter"/> for more information.
  71.684 +            </remarks>
  71.685 +        </member>
  71.686 +        <member name="F:log4net.Appender.AppenderSkeleton.m_closed">
  71.687 +            <summary>
  71.688 +            Flag indicating if this appender is closed.
  71.689 +            </summary>
  71.690 +            <remarks>
  71.691 +            See <see cref="M:log4net.Appender.AppenderSkeleton.Close"/> for more information.
  71.692 +            </remarks>
  71.693 +        </member>
  71.694 +        <member name="F:log4net.Appender.AppenderSkeleton.m_recursiveGuard">
  71.695 +            <summary>
  71.696 +            The guard prevents an appender from repeatedly calling its own DoAppend method
  71.697 +            </summary>
  71.698 +        </member>
  71.699 +        <member name="F:log4net.Appender.AppenderSkeleton.m_renderWriter">
  71.700 +            <summary>
  71.701 +            StringWriter used to render events
  71.702 +            </summary>
  71.703 +        </member>
  71.704 +        <member name="P:log4net.Appender.AppenderSkeleton.Threshold">
  71.705 +            <summary>
  71.706 +            Gets or sets the threshold <see cref="T:log4net.Core.Level"/> of this appender.
  71.707 +            </summary>
  71.708 +            <value>
  71.709 +            The threshold <see cref="T:log4net.Core.Level"/> of the appender. 
  71.710 +            </value>
  71.711 +            <remarks>
  71.712 +            <para>
  71.713 +            All log events with lower level than the threshold level are ignored 
  71.714 +            by the appender.
  71.715 +            </para>
  71.716 +            <para>
  71.717 +            In configuration files this option is specified by setting the
  71.718 +            value of the <see cref="P:log4net.Appender.AppenderSkeleton.Threshold"/> option to a level
  71.719 +            string, such as "DEBUG", "INFO" and so on.
  71.720 +            </para>
  71.721 +            </remarks>
  71.722 +        </member>
  71.723 +        <member name="P:log4net.Appender.AppenderSkeleton.ErrorHandler">
  71.724 +            <summary>
  71.725 +            Gets or sets the <see cref="T:log4net.Core.IErrorHandler"/> for this appender.
  71.726 +            </summary>
  71.727 +            <value>The <see cref="T:log4net.Core.IErrorHandler"/> of the appender</value>
  71.728 +            <remarks>
  71.729 +            <para>
  71.730 +            The <see cref="T:log4net.Appender.AppenderSkeleton"/> provides a default 
  71.731 +            implementation for the <see cref="P:log4net.Appender.AppenderSkeleton.ErrorHandler"/> property. 
  71.732 +            </para>
  71.733 +            </remarks>
  71.734 +        </member>
  71.735 +        <member name="P:log4net.Appender.AppenderSkeleton.FilterHead">
  71.736 +            <summary>
  71.737 +            The filter chain.
  71.738 +            </summary>
  71.739 +            <value>The head of the filter chain filter chain.</value>
  71.740 +            <remarks>
  71.741 +            <para>
  71.742 +            Returns the head Filter. The Filters are organized in a linked list
  71.743 +            and so all Filters on this Appender are available through the result.
  71.744 +            </para>
  71.745 +            </remarks>
  71.746 +        </member>
  71.747 +        <member name="P:log4net.Appender.AppenderSkeleton.Layout">
  71.748 +            <summary>
  71.749 +            Gets or sets the <see cref="T:log4net.Layout.ILayout"/> for this appender.
  71.750 +            </summary>
  71.751 +            <value>The layout of the appender.</value>
  71.752 +            <remarks>
  71.753 +            <para>
  71.754 +            See <see cref="P:log4net.Appender.AppenderSkeleton.RequiresLayout"/> for more information.
  71.755 +            </para>
  71.756 +            </remarks>
  71.757 +            <seealso cref="P:log4net.Appender.AppenderSkeleton.RequiresLayout"/>
  71.758 +        </member>
  71.759 +        <member name="P:log4net.Appender.AppenderSkeleton.Name">
  71.760 +            <summary>
  71.761 +            Gets or sets the name of this appender.
  71.762 +            </summary>
  71.763 +            <value>The name of the appender.</value>
  71.764 +            <remarks>
  71.765 +            <para>
  71.766 +            The name uniquely identifies the appender.
  71.767 +            </para>
  71.768 +            </remarks>
  71.769 +        </member>
  71.770 +        <member name="P:log4net.Appender.AppenderSkeleton.RequiresLayout">
  71.771 +            <summary>
  71.772 +            Tests if this appender requires a <see cref="P:log4net.Appender.AppenderSkeleton.Layout"/> to be set.
  71.773 +            </summary>
  71.774 +            <remarks>
  71.775 +            <para>
  71.776 +            In the rather exceptional case, where the appender 
  71.777 +            implementation admits a layout but can also work without it, 
  71.778 +            then the appender should return <c>true</c>.
  71.779 +            </para>
  71.780 +            <para>
  71.781 +            This default implementation always returns <c>true</c>.
  71.782 +            </para>
  71.783 +            </remarks>
  71.784 +            <returns>
  71.785 +            <c>true</c> if the appender requires a layout object, otherwise <c>false</c>.
  71.786 +            </returns>
  71.787 +        </member>
  71.788 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.DEFAULT_BUFFER_SIZE">
  71.789 +            <summary>
  71.790 +            The default buffer size.
  71.791 +            </summary>
  71.792 +            <remarks>
  71.793 +            The default size of the cyclic buffer used to store events.
  71.794 +            This is set to 512 by default.
  71.795 +            </remarks>
  71.796 +        </member>
  71.797 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.#ctor">
  71.798 +            <summary>
  71.799 +            Initializes a new instance of the <see cref="T:log4net.Appender.BufferingAppenderSkeleton"/> class.
  71.800 +            </summary>
  71.801 +            <remarks>
  71.802 +            <para>
  71.803 +            Protected default constructor to allow subclassing.
  71.804 +            </para>
  71.805 +            </remarks>
  71.806 +        </member>
  71.807 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.#ctor(System.Boolean)">
  71.808 +            <summary>
  71.809 +            Initializes a new instance of the <see cref="T:log4net.Appender.BufferingAppenderSkeleton"/> class.
  71.810 +            </summary>
  71.811 +            <param name="eventMustBeFixed">the events passed through this appender must be
  71.812 +            fixed by the time that they arrive in the derived class' <c>SendBuffer</c> method.</param>
  71.813 +            <remarks>
  71.814 +            <para>
  71.815 +            Protected constructor to allow subclassing.
  71.816 +            </para>
  71.817 +            <para>
  71.818 +            The <paramref name="eventMustBeFixed"/> should be set if the subclass
  71.819 +            expects the events delivered to be fixed even if the 
  71.820 +            <see cref="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize"/> is set to zero, i.e. when no buffering occurs.
  71.821 +            </para>
  71.822 +            </remarks>
  71.823 +        </member>
  71.824 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.Flush">
  71.825 +            <summary>
  71.826 +            Flush the currently buffered events
  71.827 +            </summary>
  71.828 +            <remarks>
  71.829 +            <para>
  71.830 +            Flushes any events that have been buffered.
  71.831 +            </para>
  71.832 +            <para>
  71.833 +            If the appender is buffering in <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> mode then the contents
  71.834 +            of the buffer will NOT be flushed to the appender.
  71.835 +            </para>
  71.836 +            </remarks>
  71.837 +        </member>
  71.838 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.Flush(System.Boolean)">
  71.839 +            <summary>
  71.840 +            Flush the currently buffered events
  71.841 +            </summary>
  71.842 +            <param name="flushLossyBuffer">set to <c>true</c> to flush the buffer of lossy events</param>
  71.843 +            <remarks>
  71.844 +            <para>
  71.845 +            Flushes events that have been buffered. If <paramref name="flushLossyBuffer"/> is
  71.846 +            <c>false</c> then events will only be flushed if this buffer is non-lossy mode.
  71.847 +            </para>
  71.848 +            <para>
  71.849 +            If the appender is buffering in <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> mode then the contents
  71.850 +            of the buffer will only be flushed if <paramref name="flushLossyBuffer"/> is <c>true</c>.
  71.851 +            In this case the contents of the buffer will be tested against the 
  71.852 +            <see cref="P:log4net.Appender.BufferingAppenderSkeleton.LossyEvaluator"/> and if triggering will be output. All other buffered
  71.853 +            events will be discarded.
  71.854 +            </para>
  71.855 +            <para>
  71.856 +            If <paramref name="flushLossyBuffer"/> is <c>true</c> then the buffer will always
  71.857 +            be emptied by calling this method.
  71.858 +            </para>
  71.859 +            </remarks>
  71.860 +        </member>
  71.861 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions">
  71.862 +            <summary>
  71.863 +            Initialize the appender based on the options set
  71.864 +            </summary>
  71.865 +            <remarks>
  71.866 +            <para>
  71.867 +            This is part of the <see cref="T:log4net.Core.IOptionHandler"/> delayed object
  71.868 +            activation scheme. The <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> method must 
  71.869 +            be called on this object after the configuration properties have
  71.870 +            been set. Until <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> is called this
  71.871 +            object is in an undefined state and must not be used. 
  71.872 +            </para>
  71.873 +            <para>
  71.874 +            If any of the configuration properties are modified then 
  71.875 +            <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> must be called again.
  71.876 +            </para>
  71.877 +            </remarks>
  71.878 +        </member>
  71.879 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.OnClose">
  71.880 +            <summary>
  71.881 +            Close this appender instance.
  71.882 +            </summary>
  71.883 +            <remarks>
  71.884 +            <para>
  71.885 +            Close this appender instance. If this appender is marked
  71.886 +            as not <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> then the remaining events in 
  71.887 +            the buffer must be sent when the appender is closed.
  71.888 +            </para>
  71.889 +            </remarks>
  71.890 +        </member>
  71.891 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.Append(log4net.Core.LoggingEvent)">
  71.892 +            <summary>
  71.893 +            This method is called by the <see cref="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/> method. 
  71.894 +            </summary>
  71.895 +            <param name="loggingEvent">the event to log</param>
  71.896 +            <remarks>
  71.897 +            <para>
  71.898 +            Stores the <paramref name="loggingEvent"/> in the cyclic buffer.
  71.899 +            </para>
  71.900 +            <para>
  71.901 +            The buffer will be sent (i.e. passed to the <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/> 
  71.902 +            method) if one of the following conditions is met:
  71.903 +            </para>
  71.904 +            <list type="bullet">
  71.905 +            	<item>
  71.906 +            		<description>The cyclic buffer is full and this appender is
  71.907 +            		marked as not lossy (see <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/>)</description>
  71.908 +            	</item>
  71.909 +            	<item>
  71.910 +            		<description>An <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> is set and
  71.911 +            		it is triggered for the <paramref name="loggingEvent"/>
  71.912 +            		specified.</description>
  71.913 +            	</item>
  71.914 +            </list>
  71.915 +            <para>
  71.916 +            Before the event is stored in the buffer it is fixed
  71.917 +            (see <see cref="M:log4net.Core.LoggingEvent.FixVolatileData(log4net.Core.FixFlags)"/>) to ensure that
  71.918 +            any data referenced by the event will be valid when the buffer
  71.919 +            is processed.
  71.920 +            </para>
  71.921 +            </remarks>
  71.922 +        </member>
  71.923 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.SendFromBuffer(log4net.Core.LoggingEvent,log4net.Util.CyclicBuffer)">
  71.924 +            <summary>
  71.925 +            Sends the contents of the buffer.
  71.926 +            </summary>
  71.927 +            <param name="firstLoggingEvent">The first logging event.</param>
  71.928 +            <param name="buffer">The buffer containing the events that need to be send.</param>
  71.929 +            <remarks>
  71.930 +            <para>
  71.931 +            The subclass must override <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>.
  71.932 +            </para>
  71.933 +            </remarks>
  71.934 +        </member>
  71.935 +        <member name="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])">
  71.936 +            <summary>
  71.937 +            Sends the events.
  71.938 +            </summary>
  71.939 +            <param name="events">The events that need to be send.</param>
  71.940 +            <remarks>
  71.941 +            <para>
  71.942 +            The subclass must override this method to process the buffered events.
  71.943 +            </para>
  71.944 +            </remarks>
  71.945 +        </member>
  71.946 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_bufferSize">
  71.947 +            <summary>
  71.948 +            The size of the cyclic buffer used to hold the logging events.
  71.949 +            </summary>
  71.950 +            <remarks>
  71.951 +            Set to <see cref="F:log4net.Appender.BufferingAppenderSkeleton.DEFAULT_BUFFER_SIZE"/> by default.
  71.952 +            </remarks>
  71.953 +        </member>
  71.954 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_cb">
  71.955 +            <summary>
  71.956 +            The cyclic buffer used to store the logging events.
  71.957 +            </summary>
  71.958 +        </member>
  71.959 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_evaluator">
  71.960 +            <summary>
  71.961 +            The triggering event evaluator that causes the buffer to be sent immediately.
  71.962 +            </summary>
  71.963 +            <remarks>
  71.964 +            The object that is used to determine if an event causes the entire
  71.965 +            buffer to be sent immediately. This field can be <c>null</c>, which 
  71.966 +            indicates that event triggering is not to be done. The evaluator
  71.967 +            can be set using the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> property. If this appender
  71.968 +            has the <see cref="F:log4net.Appender.BufferingAppenderSkeleton.m_lossy"/> (<see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> property) set to 
  71.969 +            <c>true</c> then an <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> must be set.
  71.970 +            </remarks>
  71.971 +        </member>
  71.972 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_lossy">
  71.973 +            <summary>
  71.974 +            Indicates if the appender should overwrite events in the cyclic buffer 
  71.975 +            when it becomes full, or if the buffer should be flushed when the 
  71.976 +            buffer is full.
  71.977 +            </summary>
  71.978 +            <remarks>
  71.979 +            If this field is set to <c>true</c> then an <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> must 
  71.980 +            be set.
  71.981 +            </remarks>
  71.982 +        </member>
  71.983 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_lossyEvaluator">
  71.984 +            <summary>
  71.985 +            The triggering event evaluator filters discarded events.
  71.986 +            </summary>
  71.987 +            <remarks>
  71.988 +            The object that is used to determine if an event that is discarded should
  71.989 +            really be discarded or if it should be sent to the appenders. 
  71.990 +            This field can be <c>null</c>, which indicates that all discarded events will
  71.991 +            be discarded. 
  71.992 +            </remarks>
  71.993 +        </member>
  71.994 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_fixFlags">
  71.995 +            <summary>
  71.996 +            Value indicating which fields in the event should be fixed
  71.997 +            </summary>
  71.998 +            <remarks>
  71.999 +            By default all fields are fixed
 71.1000 +            </remarks>
 71.1001 +        </member>
 71.1002 +        <member name="F:log4net.Appender.BufferingAppenderSkeleton.m_eventMustBeFixed">
 71.1003 +            <summary>
 71.1004 +            The events delivered to the subclass must be fixed.
 71.1005 +            </summary>
 71.1006 +        </member>
 71.1007 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.Lossy">
 71.1008 +            <summary>
 71.1009 +            Gets or sets a value that indicates whether the appender is lossy.
 71.1010 +            </summary>
 71.1011 +            <value>
 71.1012 +            <c>true</c> if the appender is lossy, otherwise <c>false</c>. The default is <c>false</c>.
 71.1013 +            </value>
 71.1014 +            <remarks>
 71.1015 +            <para>
 71.1016 +            This appender uses a buffer to store logging events before 
 71.1017 +            delivering them. A triggering event causes the whole buffer
 71.1018 +            to be send to the remote sink. If the buffer overruns before
 71.1019 +            a triggering event then logging events could be lost. Set
 71.1020 +            <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> to <c>false</c> to prevent logging events 
 71.1021 +            from being lost.
 71.1022 +            </para>
 71.1023 +            <para>If <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> is set to <c>true</c> then an
 71.1024 +            <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> must be specified.</para>
 71.1025 +            </remarks>
 71.1026 +        </member>
 71.1027 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize">
 71.1028 +            <summary>
 71.1029 +            Gets or sets the size of the cyclic buffer used to hold the 
 71.1030 +            logging events.
 71.1031 +            </summary>
 71.1032 +            <value>
 71.1033 +            The size of the cyclic buffer used to hold the logging events.
 71.1034 +            </value>
 71.1035 +            <remarks>
 71.1036 +            <para>
 71.1037 +            The <see cref="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize"/> option takes a positive integer
 71.1038 +            representing the maximum number of logging events to collect in 
 71.1039 +            a cyclic buffer. When the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize"/> is reached,
 71.1040 +            oldest events are deleted as new events are added to the
 71.1041 +            buffer. By default the size of the cyclic buffer is 512 events.
 71.1042 +            </para>
 71.1043 +            <para>
 71.1044 +            If the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.BufferSize"/> is set to a value less than
 71.1045 +            or equal to 1 then no buffering will occur. The logging event
 71.1046 +            will be delivered synchronously (depending on the <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/>
 71.1047 +            and <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> properties). Otherwise the event will
 71.1048 +            be buffered.
 71.1049 +            </para>
 71.1050 +            </remarks>
 71.1051 +        </member>
 71.1052 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator">
 71.1053 +            <summary>
 71.1054 +            Gets or sets the <see cref="T:log4net.Core.ITriggeringEventEvaluator"/> that causes the 
 71.1055 +            buffer to be sent immediately.
 71.1056 +            </summary>
 71.1057 +            <value>
 71.1058 +            The <see cref="T:log4net.Core.ITriggeringEventEvaluator"/> that causes the buffer to be
 71.1059 +            sent immediately.
 71.1060 +            </value>
 71.1061 +            <remarks>
 71.1062 +            <para>
 71.1063 +            The evaluator will be called for each event that is appended to this 
 71.1064 +            appender. If the evaluator triggers then the current buffer will 
 71.1065 +            immediately be sent (see <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>).
 71.1066 +            </para>
 71.1067 +            <para>If <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Lossy"/> is set to <c>true</c> then an
 71.1068 +            <see cref="P:log4net.Appender.BufferingAppenderSkeleton.Evaluator"/> must be specified.</para>
 71.1069 +            </remarks>
 71.1070 +        </member>
 71.1071 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.LossyEvaluator">
 71.1072 +            <summary>
 71.1073 +            Gets or sets the value of the <see cref="T:log4net.Core.ITriggeringEventEvaluator"/> to use.
 71.1074 +            </summary>
 71.1075 +            <value>
 71.1076 +            The value of the <see cref="T:log4net.Core.ITriggeringEventEvaluator"/> to use.
 71.1077 +            </value>
 71.1078 +            <remarks>
 71.1079 +            <para>
 71.1080 +            The evaluator will be called for each event that is discarded from this 
 71.1081 +            appender. If the evaluator triggers then the current buffer will immediately 
 71.1082 +            be sent (see <see cref="M:log4net.Appender.BufferingAppenderSkeleton.SendBuffer(log4net.Core.LoggingEvent[])"/>).
 71.1083 +            </para>
 71.1084 +            </remarks>
 71.1085 +        </member>
 71.1086 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.OnlyFixPartialEventData">
 71.1087 +            <summary>
 71.1088 +            Gets or sets a value indicating if only part of the logging event data
 71.1089 +            should be fixed.
 71.1090 +            </summary>
 71.1091 +            <value>
 71.1092 +            <c>true</c> if the appender should only fix part of the logging event 
 71.1093 +            data, otherwise <c>false</c>. The default is <c>false</c>.
 71.1094 +            </value>
 71.1095 +            <remarks>
 71.1096 +            <para>
 71.1097 +            Setting this property to <c>true</c> will cause only part of the
 71.1098 +            event data to be fixed and serialized. This will improve performance.
 71.1099 +            </para>
 71.1100 +            <para>
 71.1101 +            See <see cref="M:log4net.Core.LoggingEvent.FixVolatileData(log4net.Core.FixFlags)"/> for more information.
 71.1102 +            </para>
 71.1103 +            </remarks>
 71.1104 +        </member>
 71.1105 +        <member name="P:log4net.Appender.BufferingAppenderSkeleton.Fix">
 71.1106 +            <summary>
 71.1107 +            Gets or sets a the fields that will be fixed in the event
 71.1108 +            </summary>
 71.1109 +            <value>
 71.1110 +            The event fields that will be fixed before the event is buffered
 71.1111 +            </value>
 71.1112 +            <remarks>
 71.1113 +            <para>
 71.1114 +            The logging event needs to have certain thread specific values 
 71.1115 +            captured before it can be buffered. See <see cref="P:log4net.Core.LoggingEvent.Fix"/>
 71.1116 +            for details.
 71.1117 +            </para>
 71.1118 +            </remarks>
 71.1119 +            <seealso cref="P:log4net.Core.LoggingEvent.Fix"/>
 71.1120 +        </member>
 71.1121 +        <member name="M:log4net.Appender.AdoNetAppender.#ctor">
 71.1122 +            <summary> 
 71.1123 +            Initializes a new instance of the <see cref="T:log4net.Appender.AdoNetAppender"/> class.
 71.1124 +            </summary>
 71.1125 +            <remarks>
 71.1126 +            Public default constructor to initialize a new instance of this class.
 71.1127 +            </remarks>
 71.1128 +        </member>
 71.1129 +        <member name="M:log4net.Appender.AdoNetAppender.ActivateOptions">
 71.1130 +            <summary>
 71.1131 +            Initialize the appender based on the options set
 71.1132 +            </summary>
 71.1133 +            <remarks>
 71.1134 +            <para>
 71.1135 +            This is part of the <see cref="T:log4net.Core.IOptionHandler"/> delayed object
 71.1136 +            activation scheme. The <see cref="M:log4net.Appender.AdoNetAppender.ActivateOptions"/> method must 
 71.1137 +            be called on this object after the configuration properties have
 71.1138 +            been set. Until <see cref="M:log4net.Appender.AdoNetAppender.ActivateOptions"/> is called this
 71.1139 +            object is in an undefined state and must not be used. 
 71.1140 +            </para>
 71.1141 +            <para>
 71.1142 +            If any of the configuration properties are modified then 
 71.1143 +            <see cref="M:log4net.Appender.AdoNetAppender.ActivateOptions"/> must be called again.
 71.1144 +            </para>
 71.1145 +            </remarks>
 71.1146 +        </member>
 71.1147 +        <member name="M:log4net.Appender.AdoNetAppender.OnClose">
 71.1148 +            <summary>
 71.1149 +            Override the parent method to close the database
 71.1150 +            </summary>
 71.1151 +            <remarks>
 71.1152 +            <para>
 71.1153 +            Closes the database command and database connection.
 71.1154 +            </para>
 71.1155 +            </remarks>
 71.1156 +        </member>
 71.1157 +        <member name="M:log4net.Appender.AdoNetAppender.SendBuffer(log4net.Core.LoggingEvent[])">
 71.1158 +            <summary>
 71.1159 +            Inserts the events into the database.
 71.1160 +            </summary>
 71.1161 +            <param name="events">The events to insert into the database.</param>
 71.1162 +            <remarks>
 71.1163 +            <para>
 71.1164 +            Insert all the events specified in the <paramref name="events"/>
 71.1165 +            array into the database.
 71.1166 +            </para>
 71.1167 +            </remarks>
 71.1168 +        </member>
 71.1169 +        <member name="M:log4net.Appender.AdoNetAppender.AddParameter(log4net.Appender.AdoNetAppenderParameter)">
 71.1170 +            <summary>
 71.1171 +            Adds a parameter to the command.
 71.1172 +            </summary>
 71.1173 +            <param name="parameter">The parameter to add to the command.</param>
 71.1174 +            <remarks>
 71.1175 +            <para>
 71.1176 +            Adds a parameter to the ordered list of command parameters.
 71.1177 +            </para>
 71.1178 +            </remarks>
 71.1179 +        </member>
 71.1180 +        <member name="M:log4net.Appender.AdoNetAppender.SendBuffer(System.Data.IDbTransaction,log4net.Core.LoggingEvent[])">
 71.1181 +            <summary>
 71.1182 +            Writes the events to the database using the transaction specified.
 71.1183 +            </summary>
 71.1184 +            <param name="dbTran">The transaction that the events will be executed under.</param>
 71.1185 +            <param name="events">The array of events to insert into the database.</param>
 71.1186 +            <remarks>
 71.1187 +            <para>
 71.1188 +            The transaction argument can be <c>null</c> if the appender has been
 71.1189 +            configured not to use transactions. See <see cref="P:log4net.Appender.AdoNetAppender.UseTransactions"/>
 71.1190 +            property for more information.
 71.1191 +            </para>
 71.1192 +            </remarks>
 71.1193 +        </member>
 71.1194 +        <member name="M:log4net.Appender.AdoNetAppender.GetLogStatement(log4net.Core.LoggingEvent)">
 71.1195 +            <summary>
 71.1196 +            Formats the log message into database statement text.
 71.1197 +            </summary>
 71.1198 +            <param name="logEvent">The event being logged.</param>
 71.1199 +            <remarks>
 71.1200 +            This method can be overridden by subclasses to provide 
 71.1201 +            more control over the format of the database statement.
 71.1202 +            </remarks>
 71.1203 +            <returns>
 71.1204 +            Text that can be passed to a <see cref="T:System.Data.IDbCommand"/>.
 71.1205 +            </returns>
 71.1206 +        </member>
 71.1207 +        <member name="M:log4net.Appender.AdoNetAppender.InitializeDatabaseConnection">
 71.1208 +            <summary>
 71.1209 +            Connects to the database.
 71.1210 +            </summary>		
 71.1211 +        </member>
 71.1212 +        <member name="M:log4net.Appender.AdoNetAppender.ResolveConnectionType">
 71.1213 +            <summary>
 71.1214 +            Retrieves the class type of the ADO.NET provider.
 71.1215 +            </summary>
 71.1216 +            <remarks>
 71.1217 +            <para>
 71.1218 +            Gets the Type of the ADO.NET provider to use to connect to the
 71.1219 +            database. This method resolves the type specified in the 
 71.1220 +            <see cref="P:log4net.Appender.AdoNetAppender.ConnectionType"/> property.
 71.1221 +            </para>
 71.1222 +            <para>
 71.1223 +            Subclasses can override this method to return a different type
 71.1224 +            if necessary.
 71.1225 +            </para>
 71.1226 +            </remarks>
 71.1227 +            <returns>The <see cref="T:System.Type"/> of the ADO.NET provider</returns>
 71.1228 +        </member>
 71.1229 +        <member name="M:log4net.Appender.AdoNetAppender.InitializeDatabaseCommand">
 71.1230 +            <summary>
 71.1231 +            Prepares the database command and initialize the parameters.
 71.1232 +            </summary>
 71.1233 +        </member>
 71.1234 +        <member name="F:log4net.Appender.AdoNetAppender.m_usePreparedCommand">
 71.1235 +            <summary>
 71.1236 +            Flag to indicate if we are using a command object
 71.1237 +            </summary>
 71.1238 +            <remarks>
 71.1239 +            <para>
 71.1240 +            Set to <c>true</c> when the appender is to use a prepared
 71.1241 +            statement or stored procedure to insert into the database.
 71.1242 +            </para>
 71.1243 +            </remarks>
 71.1244 +        </member>
 71.1245 +        <member name="F:log4net.Appender.AdoNetAppender.m_parameters">
 71.1246 +            <summary>
 71.1247 +            The list of <see cref="T:log4net.Appender.AdoNetAppenderParameter"/> objects.
 71.1248 +            </summary>
 71.1249 +            <remarks>
 71.1250 +            <para>
 71.1251 +            The list of <see cref="T:log4net.Appender.AdoNetAppenderParameter"/> objects.
 71.1252 +            </para>
 71.1253 +            </remarks>
 71.1254 +        </member>
 71.1255 +        <member name="F:log4net.Appender.AdoNetAppender.m_securityContext">
 71.1256 +            <summary>
 71.1257 +            The security context to use for privileged calls
 71.1258 +            </summary>
 71.1259 +        </member>
 71.1260 +        <member name="F:log4net.Appender.AdoNetAppender.m_dbConnection">
 71.1261 +            <summary>
 71.1262 +            The <see cref="T:System.Data.IDbConnection"/> that will be used
 71.1263 +            to insert logging events into a database.
 71.1264 +            </summary>
 71.1265 +        </member>
 71.1266 +        <member name="F:log4net.Appender.AdoNetAppender.m_dbCommand">
 71.1267 +            <summary>
 71.1268 +            The database command.
 71.1269 +            </summary>
 71.1270 +        </member>
 71.1271 +        <member name="F:log4net.Appender.AdoNetAppender.m_connectionString">
 71.1272 +            <summary>
 71.1273 +            Database connection string.
 71.1274 +            </summary>
 71.1275 +        </member>
 71.1276 +        <member name="F:log4net.Appender.AdoNetAppender.m_connectionType">
 71.1277 +            <summary>
 71.1278 +            String type name of the <see cref="T:System.Data.IDbConnection"/> type name.
 71.1279 +            </summary>
 71.1280 +        </member>
 71.1281 +        <member name="F:log4net.Appender.AdoNetAppender.m_commandText">
 71.1282 +            <summary>
 71.1283 +            The text of the command.
 71.1284 +            </summary>
 71.1285 +        </member>
 71.1286 +        <member name="F:log4net.Appender.AdoNetAppender.m_commandType">
 71.1287 +            <summary>
 71.1288 +            The command type.
 71.1289 +            </summary>
 71.1290 +        </member>
 71.1291 +        <member name="F:log4net.Appender.AdoNetAppender.m_useTransactions">
 71.1292 +            <summary>
 71.1293 +            Indicates whether to use transactions when writing to the database.
 71.1294 +            </summary>
 71.1295 +        </member>
 71.1296 +        <member name="F:log4net.Appender.AdoNetAppender.m_reconnectOnError">
 71.1297 +            <summary>
 71.1298 +            Indicates whether to use transactions when writing to the database.
 71.1299 +            </summary>
 71.1300 +        </member>
 71.1301 +        <member name="P:log4net.Appender.AdoNetAppender.ConnectionString">
 71.1302 +            <summary>
 71.1303 +            Gets or sets the database connection string that is used to connect to 
 71.1304 +            the database.
 71.1305 +            </summary>
 71.1306 +            <value>
 71.1307 +            The database connection string used to connect to the database.
 71.1308 +            </value>
 71.1309 +            <remarks>
 71.1310 +            <para>
 71.1311 +            The connections string is specific to the connection type.
 71.1312 +            See <see cref="P:log4net.Appender.AdoNetAppender.ConnectionType"/> for more information.
 71.1313 +            </para>
 71.1314 +            </remarks>
 71.1315 +            <example>Connection string for MS Access via ODBC:
 71.1316 +            <code>"DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb"</code>
 71.1317 +            </example>
 71.1318 +            <example>Another connection string for MS Access via ODBC:
 71.1319 +            <code>"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;"</code>
 71.1320 +            </example>
 71.1321 +            <example>Connection string for MS Access via OLE DB:
 71.1322 +            <code>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;"</code>
 71.1323 +            </example>
 71.1324 +        </member>
 71.1325 +        <member name="P:log4net.Appender.AdoNetAppender.ConnectionType">
 71.1326 +            <summary>
 71.1327 +            Gets or sets the type name of the <see cref="T:System.Data.IDbConnection"/> connection
 71.1328 +            that should be created.
 71.1329 +            </summary>
 71.1330 +            <value>
 71.1331 +            The type name of the <see cref="T:System.Data.IDbConnection"/> connection.
 71.1332 +            </value>
 71.1333 +            <remarks>
 71.1334 +            <para>
 71.1335 +            The type name of the ADO.NET provider to use.
 71.1336 +            </para>
 71.1337 +            <para>
 71.1338 +            The default is to use the OLE DB provider.
 71.1339 +            </para>
 71.1340 +            </remarks>
 71.1341 +            <example>Use the OLE DB Provider. This is the default value.
 71.1342 +            <code>System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</code>
 71.1343 +            </example>
 71.1344 +            <example>Use the MS SQL Server Provider. 
 71.1345 +            <code>System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</code>
 71.1346 +            </example>
 71.1347 +            <example>Use the ODBC Provider. 
 71.1348 +            <code>Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral</code>
 71.1349 +            This is an optional package that you can download from 
 71.1350 +            <a href="http://msdn.microsoft.com/downloads">http://msdn.microsoft.com/downloads</a> 
 71.1351 +            search for <b>ODBC .NET Data Provider</b>.
 71.1352 +            </example>
 71.1353 +            <example>Use the Oracle Provider. 
 71.1354 +            <code>System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</code>
 71.1355 +            This is an optional package that you can download from 
 71.1356 +            <a href="http://msdn.microsoft.com/downloads">http://msdn.microsoft.com/downloads</a> 
 71.1357 +            search for <b>.NET Managed Provider for Oracle</b>.
 71.1358 +            </example>
 71.1359 +        </member>
 71.1360 +        <member name="P:log4net.Appender.AdoNetAppender.CommandText">
 71.1361 +            <summary>
 71.1362 +            Gets or sets the command text that is used to insert logging events
 71.1363 +            into the database.
 71.1364 +            </summary>
 71.1365 +            <value>
 71.1366 +            The command text used to insert logging events into the database.
 71.1367 +            </value>
 71.1368 +            <remarks>
 71.1369 +            <para>
 71.1370 +            Either the text of the prepared statement or the
 71.1371 +            name of the stored procedure to execute to write into
 71.1372 +            the database.
 71.1373 +            </para>
 71.1374 +            <para>
 71.1375 +            The <see cref="P:log4net.Appender.AdoNetAppender.CommandType"/> property determines if
 71.1376 +            this text is a prepared statement or a stored procedure.
 71.1377 +            </para>
 71.1378 +            </remarks>
 71.1379 +        </member>
 71.1380 +        <member name="P:log4net.Appender.AdoNetAppender.CommandType">
 71.1381 +            <summary>
 71.1382 +            Gets or sets the command type to execute.
 71.1383 +            </summary>
 71.1384 +            <value>
 71.1385 +            The command type to execute.
 71.1386 +            </value>
 71.1387 +            <remarks>
 71.1388 +            <para>
 71.1389 +            This value may be either <see cref="F:System.Data.CommandType.Text"/> (<c>System.Data.CommandType.Text</c>) to specify
 71.1390 +            that the <see cref="P:log4net.Appender.AdoNetAppender.CommandText"/> is a prepared statement to execute, 
 71.1391 +            or <see cref="F:System.Data.CommandType.StoredProcedure"/> (<c>System.Data.CommandType.StoredProcedure</c>) to specify that the
 71.1392 +            <see cref="P:log4net.Appender.AdoNetAppender.CommandText"/> property is the name of a stored procedure
 71.1393 +            to execute.
 71.1394 +            </para>
 71.1395 +            <para>
 71.1396 +            The default value is <see cref="F:System.Data.CommandType.Text"/> (<c>System.Data.CommandType.Text</c>).
 71.1397 +            </para>
 71.1398 +            </remarks>
 71.1399 +        </member>
 71.1400 +        <member name="P:log4net.Appender.AdoNetAppender.UseTransactions">
 71.1401 +            <summary>
 71.1402 +            Should transactions be used to insert logging events in the database.
 71.1403 +            </summary>
 71.1404 +            <value>
 71.1405 +            <c>true</c> if transactions should be used to insert logging events in
 71.1406 +            the database, otherwise <c>false</c>. The default value is <c>true</c>.
 71.1407 +            </value>
 71.1408 +            <remarks>
 71.1409 +            <para>
 71.1410 +            Gets or sets a value that indicates whether transactions should be used
 71.1411 +            to insert logging events in the database.
 71.1412 +            </para>
 71.1413 +            <para>
 71.1414 +            When set a single transaction will be used to insert the buffered events
 71.1415 +            into the database. Otherwise each event will be inserted without using
 71.1416 +            an explicit transaction.
 71.1417 +            </para>
 71.1418 +            </remarks>
 71.1419 +        </member>
 71.1420 +        <member name="P:log4net.Appender.AdoNetAppender.SecurityContext">
 71.1421 +            <summary>
 71.1422 +            Gets or sets the <see cref="P:log4net.Appender.AdoNetAppender.SecurityContext"/> used to call the NetSend method.
 71.1423 +            </summary>
 71.1424 +            <value>
 71.1425 +            The <see cref="P:log4net.Appender.AdoNetAppender.SecurityContext"/> used to call the NetSend method.
 71.1426 +            </value>
 71.1427 +            <remarks>
 71.1428 +            <para>
 71.1429 +            Unless a <see cref="P:log4net.Appender.AdoNetAppender.SecurityContext"/> specified here for this appender
 71.1430 +            the <see cref="P:log4net.Core.SecurityContextProvider.DefaultProvider"/> is queried for the
 71.1431 +            security context to use. The default behavior is to use the security context
 71.1432 +            of the current thread.
 71.1433 +            </para>
 71.1434 +            </remarks>
 71.1435 +        </member>
 71.1436 +        <member name="P:log4net.Appender.AdoNetAppender.ReconnectOnError">
 71.1437 +            <summary>
 71.1438 +            Should this appender try to reconnect to the database on error.
 71.1439 +            </summary>
 71.1440 +            <value>
 71.1441 +            <c>true</c> if the appender should try to reconnect to the database after an
 71.1442 +            error has occurred, otherwise <c>false</c>. The default value is <c>false</c>, 
 71.1443 +            i.e. not to try to reconnect.
 71.1444 +            </value>
 71.1445 +            <remarks>
 71.1446 +            <para>
 71.1447 +            The default behaviour is for the appender not to try to reconnect to the
 71.1448 +            database if an error occurs. Subsequent logging events are discarded.
 71.1449 +            </para>
 71.1450 +            <para>
 71.1451 +            To force the appender to attempt to reconnect to the database set this
 71.1452 +            property to <c>true</c>.
 71.1453 +            </para>
 71.1454 +            <note>
 71.1455 +            When the appender attempts to connect to the database there may be a
 71.1456 +            delay of up to the connection timeout specified in the connection string.
 71.1457 +            This delay will block the calling application's thread. 
 71.1458 +            Until the connection can be reestablished this potential delay may occur multiple times.
 71.1459 +            </note>
 71.1460 +            </remarks>
 71.1461 +        </member>
 71.1462 +        <member name="P:log4net.Appender.AdoNetAppender.Connection">
 71.1463 +            <summary>
 71.1464 +            Gets or sets the underlying <see cref="T:System.Data.IDbConnection"/>.
 71.1465 +            </summary>
 71.1466 +            <value>
 71.1467 +            The underlying <see cref="T:System.Data.IDbConnection"/>.
 71.1468 +            </value>
 71.1469 +            <remarks>
 71.1470 +            <see cref="T:log4net.Appender.AdoNetAppender"/> creates a <see cref="T:System.Data.IDbConnection"/> to insert 
 71.1471 +            logging events into a database.  Classes deriving from <see cref="T:log4net.Appender.AdoNetAppender"/> 
 71.1472 +            can use this property to get or set this <see cref="T:System.Data.IDbConnection"/>.  Use the 
 71.1473 +            underlying <see cref="T:System.Data.IDbConnection"/> returned from <see cref="P:log4net.Appender.AdoNetAppender.Connection"/> if 
 71.1474 +            you require access beyond that which <see cref="T:log4net.Appender.AdoNetAppender"/> provides.
 71.1475 +            </remarks>
 71.1476 +        </member>
 71.1477 +        <member name="T:log4net.Appender.AdoNetAppenderParameter">
 71.1478 +            <summary>
 71.1479 +            Parameter type used by the <see cref="T:log4net.Appender.AdoNetAppender"/>.
 71.1480 +            </summary>
 71.1481 +            <remarks>
 71.1482 +            <para>
 71.1483 +            This class provides the basic database parameter properties
 71.1484 +            as defined by the <see cref="T:System.Data.IDbDataParameter"/> interface.
 71.1485 +            </para>
 71.1486 +            <para>This type can be subclassed to provide database specific
 71.1487 +            functionality. The two methods that are called externally are
 71.1488 +            <see cref="M:log4net.Appender.AdoNetAppenderParameter.Prepare(System.Data.IDbCommand)"/> and <see cref="M:log4net.Appender.AdoNetAppenderParameter.FormatValue(System.Data.IDbCommand,log4net.Core.LoggingEvent)"/>.
 71.1489 +            </para>
 71.1490 +            </remarks>
 71.1491 +        </member>
 71.1492 +        <member name="M:log4net.Appender.AdoNetAppenderParameter.#ctor">
 71.1493 +            <summary>
 71.1494 +            Initializes a new instance of the <see cref="T:log4net.Appender.AdoNetAppenderParameter"/> class.
 71.1495 +            </summary>
 71.1496 +            <remarks>
 71.1497 +            Default constructor for the AdoNetAppenderParameter class.
 71.1498 +            </remarks>
 71.1499 +        </member>
 71.1500 +        <member name="M:log4net.Appender.AdoNetAppenderParameter.Prepare(System.Data.IDbCommand)">
 71.1501 +            <summary>
 71.1502 +            Prepare the specified database command object.
 71.1503 +            </summary>
 71.1504 +            <param name="command">The command to prepare.</param>
 71.1505 +            <remarks>
 71.1506 +            <para>
 71.1507 +            Prepares the database command object by adding
 71.1508 +            this parameter to its collection of parameters.
 71.1509 +            </para>
 71.1510 +            </remarks>
 71.1511 +        </member>
 71.1512 +        <member name="M:log4net.Appender.AdoNetAppenderParameter.FormatValue(System.Data.IDbCommand,log4net.Core.LoggingEvent)">
 71.1513 +            <summary>
 71.1514 +            Renders the logging event and set the parameter value in the command.
 71.1515 +            </summary>
 71.1516 +            <param name="command">The command containing the parameter.</param>
 71.1517 +            <param name="loggingEvent">The event to be rendered.</param>
 71.1518 +            <remarks>
 71.1519 +            <para>
 71.1520 +            Renders the logging event using this parameters layout
 71.1521 +            object. Sets the value of the parameter on the command object.
 71.1522 +            </para>
 71.1523 +            </remarks>
 71.1524 +        </member>
 71.1525 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_parameterName">
 71.1526 +            <summary>
 71.1527 +            The name of this parameter.
 71.1528 +            </summary>
 71.1529 +        </member>
 71.1530 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_dbType">
 71.1531 +            <summary>
 71.1532 +            The database type for this parameter.
 71.1533 +            </summary>
 71.1534 +        </member>
 71.1535 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_inferType">
 71.1536 +            <summary>
 71.1537 +            Flag to infer type rather than use the DbType
 71.1538 +            </summary>
 71.1539 +        </member>
 71.1540 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_precision">
 71.1541 +            <summary>
 71.1542 +            The precision for this parameter.
 71.1543 +            </summary>
 71.1544 +        </member>
 71.1545 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_scale">
 71.1546 +            <summary>
 71.1547 +            The scale for this parameter.
 71.1548 +            </summary>
 71.1549 +        </member>
 71.1550 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_size">
 71.1551 +            <summary>
 71.1552 +            The size for this parameter.
 71.1553 +            </summary>
 71.1554 +        </member>
 71.1555 +        <member name="F:log4net.Appender.AdoNetAppenderParameter.m_layout">
 71.1556 +            <summary>
 71.1557 +            The <see cref="T:log4net.Layout.IRawLayout"/> to use to render the
 71.1558 +            logging event into an object for this parameter.
 71.1559 +            </summary>
 71.1560 +        </member>
 71.1561 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.ParameterName">
 71.1562 +            <summary>
 71.1563 +            Gets or sets the name of this parameter.
 71.1564 +            </summary>
 71.1565 +            <value>
 71.1566 +            The name of this parameter.
 71.1567 +            </value>
 71.1568 +            <remarks>
 71.1569 +            <para>
 71.1570 +            The name of this parameter. The parameter name
 71.1571 +            must match up to a named parameter to the SQL stored procedure
 71.1572 +            or prepared statement.
 71.1573 +            </para>
 71.1574 +            </remarks>
 71.1575 +        </member>
 71.1576 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.DbType">
 71.1577 +            <summary>
 71.1578 +            Gets or sets the database type for this parameter.
 71.1579 +            </summary>
 71.1580 +            <value>
 71.1581 +            The database type for this parameter.
 71.1582 +            </value>
 71.1583 +            <remarks>
 71.1584 +            <para>
 71.1585 +            The database type for this parameter. This property should
 71.1586 +            be set to the database type from the <see cref="P:log4net.Appender.AdoNetAppenderParameter.DbType"/>
 71.1587 +            enumeration. See <see cref="P:System.Data.IDataParameter.DbType"/>.
 71.1588 +            </para>
 71.1589 +            <para>
 71.1590 +            This property is optional. If not specified the ADO.NET provider 
 71.1591 +            will attempt to infer the type from the value.
 71.1592 +            </para>
 71.1593 +            </remarks>
 71.1594 +            <seealso cref="P:System.Data.IDataParameter.DbType"/>
 71.1595 +        </member>
 71.1596 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.Precision">
 71.1597 +            <summary>
 71.1598 +            Gets or sets the precision for this parameter.
 71.1599 +            </summary>
 71.1600 +            <value>
 71.1601 +            The precision for this parameter.
 71.1602 +            </value>
 71.1603 +            <remarks>
 71.1604 +            <para>
 71.1605 +            The maximum number of digits used to represent the Value.
 71.1606 +            </para>
 71.1607 +            <para>
 71.1608 +            This property is optional. If not specified the ADO.NET provider 
 71.1609 +            will attempt to infer the precision from the value.
 71.1610 +            </para>
 71.1611 +            </remarks>
 71.1612 +            <seealso cref="P:System.Data.IDbDataParameter.Precision"/>
 71.1613 +        </member>
 71.1614 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.Scale">
 71.1615 +            <summary>
 71.1616 +            Gets or sets the scale for this parameter.
 71.1617 +            </summary>
 71.1618 +            <value>
 71.1619 +            The scale for this parameter.
 71.1620 +            </value>
 71.1621 +            <remarks>
 71.1622 +            <para>
 71.1623 +            The number of decimal places to which Value is resolved.
 71.1624 +            </para>
 71.1625 +            <para>
 71.1626 +            This property is optional. If not specified the ADO.NET provider 
 71.1627 +            will attempt to infer the scale from the value.
 71.1628 +            </para>
 71.1629 +            </remarks>
 71.1630 +            <seealso cref="P:System.Data.IDbDataParameter.Scale"/>
 71.1631 +        </member>
 71.1632 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.Size">
 71.1633 +            <summary>
 71.1634 +            Gets or sets the size for this parameter.
 71.1635 +            </summary>
 71.1636 +            <value>
 71.1637 +            The size for this parameter.
 71.1638 +            </value>
 71.1639 +            <remarks>
 71.1640 +            <para>
 71.1641 +            The maximum size, in bytes, of the data within the column.
 71.1642 +            </para>
 71.1643 +            <para>
 71.1644 +            This property is optional. If not specified the ADO.NET provider 
 71.1645 +            will attempt to infer the size from the value.
 71.1646 +            </para>
 71.1647 +            </remarks>
 71.1648 +            <seealso cref="P:System.Data.IDbDataParameter.Size"/>
 71.1649 +        </member>
 71.1650 +        <member name="P:log4net.Appender.AdoNetAppenderParameter.Layout">
 71.1651 +            <summary>
 71.1652 +            Gets or sets the <see cref="T:log4net.Layout.IRawLayout"/> to use to 
 71.1653 +            render the logging event into an object for this 
 71.1654 +            parameter.
 71.1655 +            </summary>
 71.1656 +            <value>
 71.1657 +            The <see cref="T:log4net.Layout.IRawLayout"/> used to render the
 71.1658 +            logging event into an object for this parameter.
 71.1659 +            </value>
 71.1660 +            <remarks>
 71.1661 +            <para>
 71.1662 +            The <see cref="T:log4net.Layout.IRawLayout"/> that renders the value for this
 71.1663 +            parameter.
 71.1664 +            </para>
 71.1665 +            <para>
 71.1666 +            The <see cref="T:log4net.Layout.RawLayoutConverter"/> can be used to adapt
 71.1667 +            any <see cref="T:log4net.Layout.ILayout"/> into a <see cref="T:log4net.Layout.IRawLayout"/>
 71.1668 +            for use in the property.
 71.1669 +            </para>
 71.1670 +            </remarks>
 71.1671 +        </member>
 71.1672 +        <member name="T:log4net.Appender.AnsiColorTerminalAppender">
 71.1673 +            <summary>
 71.1674 +            Appends logging events to the terminal using ANSI color escape sequences.
 71.1675 +            </summary>
 71.1676 +            <remarks>
 71.1677 +            <para>
 71.1678 +            AnsiColorTerminalAppender appends log events to the standard output stream
 71.1679 +            or the error output stream using a layout specified by the 
 71.1680 +            user. It also allows the color of a specific level of message to be set.
 71.1681 +            </para>
 71.1682 +            <note>
 71.1683 +            This appender expects the terminal to understand the VT100 control set 
 71.1684 +            in order to interpret the color codes. If the terminal or console does not
 71.1685 +            understand the control codes the behavior is not defined.
 71.1686 +            </note>
 71.1687 +            <para>
 71.1688 +            By default, all output is written to the console's standard output stream.
 71.1689 +            The <see cref="P:log4net.Appender.AnsiColorTerminalAppender.Target"/> property can be set to direct the output to the
 71.1690 +            error stream.
 71.1691 +            </para>
 71.1692 +            <para>
 71.1693 +            NOTE: This appender writes each message to the <c>System.Console.Out</c> or 
 71.1694 +            <c>System.Console.Error</c> that is set at the time the event is appended.
 71.1695 +            Therefore it is possible to programmatically redirect the output of this appender 
 71.1696 +            (for example NUnit does this to capture program output). While this is the desired
 71.1697 +            behavior of this appender it may have security implications in your application. 
 71.1698 +            </para>
 71.1699 +            <para>
 71.1700 +            When configuring the ANSI colored terminal appender, a mapping should be
 71.1701 +            specified to map a logging level to a color. For example:
 71.1702 +            </para>
 71.1703 +            <code lang="XML" escaped="true">
 71.1704 +            <mapping>
 71.1705 +            	<level value="ERROR"/>
 71.1706 +            	<foreColor value="White"/>
 71.1707 +            	<backColor value="Red"/>
 71.1708 +                <attributes value="Bright,Underscore"/>
 71.1709 +            </mapping>
 71.1710 +            <mapping>
 71.1711 +            	<level value="DEBUG"/>
 71.1712 +            	<backColor value="Green"/>
 71.1713 +            </mapping>
 71.1714 +            </code>
 71.1715 +            <para>
 71.1716 +            The Level is the standard log4net logging level and ForeColor and BackColor can be any
 71.1717 +            of the following values:
 71.1718 +            <list type="bullet">
 71.1719 +            <item><term>Blue</term><description></description></item>
 71.1720 +            <item><term>Green</term><description></description></item>
 71.1721 +            <item><term>Red</term><description></description></item>
 71.1722 +            <item><term>White</term><description></description></item>
 71.1723 +            <item><term>Yellow</term><description></description></item>
 71.1724 +            <item><term>Purple</term><description></description></item>
 71.1725 +            <item><term>Cyan</term><description></description></item>
 71.1726 +            </list>
 71.1727 +            These color values cannot be combined together to make new colors.
 71.1728 +            </para>
 71.1729 +            <para>
 71.1730 +            The attributes can be any combination of the following:
 71.1731 +            <list type="bullet">
 71.1732 +            <item><term>Bright</term><description>foreground is brighter</description></item>
 71.1733 +            <item><term>Dim</term><description>foreground is dimmer</description></item>
 71.1734 +            <item><term>Underscore</term><description>message is underlined</description></item>
 71.1735 +            <item><term>Blink</term><description>foreground is blinking (does not work on all terminals)</description></item>
 71.1736 +            <item><term>Reverse</term><description>foreground and background are reversed</description></item>
 71.1737 +            <item><term>Hidden</term><description>output is hidden</description></item>
 71.1738 +            <item><term>Strikethrough</term><description>message has a line through it</description></item>
 71.1739 +            </list>
 71.1740 +            While any of these attributes may be combined together not all combinations
 71.1741 +            work well together, for example setting both <i>Bright</i> and <i>Dim</i> attributes makes
 71.1742 +            no sense.
 71.1743 +            </para>
 71.1744 +            </remarks>
 71.1745 +            <author>Patrick Wagstrom</author>
 71.1746 +            <author>Nicko Cadell</author>
 71.1747 +        </member>
 71.1748 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.ConsoleOut">
 71.1749 +            <summary>
 71.1750 +            The <see cref="P:log4net.Appender.AnsiColorTerminalAppender.Target"/> to use when writing to the Console 
 71.1751 +            standard output stream.
 71.1752 +            </summary>
 71.1753 +            <remarks>
 71.1754 +            <para>
 71.1755 +            The <see cref="P:log4net.Appender.AnsiColorTerminalAppender.Target"/> to use when writing to the Console 
 71.1756 +            standard output stream.
 71.1757 +            </para>
 71.1758 +            </remarks>
 71.1759 +        </member>
 71.1760 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.ConsoleError">
 71.1761 +            <summary>
 71.1762 +            The <see cref="P:log4net.Appender.AnsiColorTerminalAppender.Target"/> to use when writing to the Console 
 71.1763 +            standard error output stream.
 71.1764 +            </summary>
 71.1765 +            <remarks>
 71.1766 +            <para>
 71.1767 +            The <see cref="P:log4net.Appender.AnsiColorTerminalAppender.Target"/> to use when writing to the Console 
 71.1768 +            standard error output stream.
 71.1769 +            </para>
 71.1770 +            </remarks>
 71.1771 +        </member>
 71.1772 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.PostEventCodes">
 71.1773 +            <summary>
 71.1774 +            Ansi code to reset terminal
 71.1775 +            </summary>
 71.1776 +        </member>
 71.1777 +        <member name="M:log4net.Appender.AnsiColorTerminalAppender.#ctor">
 71.1778 +            <summary>
 71.1779 +            Initializes a new instance of the <see cref="T:log4net.Appender.AnsiColorTerminalAppender"/> class.
 71.1780 +            </summary>
 71.1781 +            <remarks>
 71.1782 +            The instance of the <see cref="T:log4net.Appender.AnsiColorTerminalAppender"/> class is set up to write 
 71.1783 +            to the standard output stream.
 71.1784 +            </remarks>
 71.1785 +        </member>
 71.1786 +        <member name="M:log4net.Appender.AnsiColorTerminalAppender.AddMapping(log4net.Appender.AnsiColorTerminalAppender.LevelColors)">
 71.1787 +            <summary>
 71.1788 +            Add a mapping of level to color
 71.1789 +            </summary>
 71.1790 +            <param name="mapping">The mapping to add</param>
 71.1791 +            <remarks>
 71.1792 +            <para>
 71.1793 +            Add a <see cref="T:log4net.Appender.AnsiColorTerminalAppender.LevelColors"/> mapping to this appender.
 71.1794 +            Each mapping defines the foreground and background colours
 71.1795 +            for a level.
 71.1796 +            </para>
 71.1797 +            </remarks>
 71.1798 +        </member>
 71.1799 +        <member name="M:log4net.Appender.AnsiColorTerminalAppender.Append(log4net.Core.LoggingEvent)">
 71.1800 +            <summary>
 71.1801 +            This method is called by the <see cref="M:log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/> method.
 71.1802 +            </summary>
 71.1803 +            <param name="loggingEvent">The event to log.</param>
 71.1804 +            <remarks>
 71.1805 +            <para>
 71.1806 +            Writes the event to the console.
 71.1807 +            </para>
 71.1808 +            <para>
 71.1809 +            The format of the output will depend on the appender's layout.
 71.1810 +            </para>
 71.1811 +            </remarks>
 71.1812 +        </member>
 71.1813 +        <member name="M:log4net.Appender.AnsiColorTerminalAppender.ActivateOptions">
 71.1814 +            <summary>
 71.1815 +            Initialize the options for this appender
 71.1816 +            </summary>
 71.1817 +            <remarks>
 71.1818 +            <para>
 71.1819 +            Initialize the level to color mappings set on this appender.
 71.1820 +            </para>
 71.1821 +            </remarks>
 71.1822 +        </member>
 71.1823 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.m_writeToErrorStream">
 71.1824 +            <summary>
 71.1825 +            Flag to write output to the error stream rather than the standard output stream
 71.1826 +            </summary>
 71.1827 +        </member>
 71.1828 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.m_levelMapping">
 71.1829 +            <summary>
 71.1830 +            Mapping from level object to color value
 71.1831 +            </summary>
 71.1832 +        </member>
 71.1833 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.Target">
 71.1834 +            <summary>
 71.1835 +            Target is the value of the console output stream.
 71.1836 +            </summary>
 71.1837 +            <value>
 71.1838 +            Target is the value of the console output stream.
 71.1839 +            This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
 71.1840 +            </value>
 71.1841 +            <remarks>
 71.1842 +            <para>
 71.1843 +            Target is the value of the console output stream.
 71.1844 +            This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
 71.1845 +            </para>
 71.1846 +            </remarks>
 71.1847 +        </member>
 71.1848 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.RequiresLayout">
 71.1849 +            <summary>
 71.1850 +            This appender requires a <see cref="N:log4net.Layout"/> to be set.
 71.1851 +            </summary>
 71.1852 +            <value><c>true</c></value>
 71.1853 +            <remarks>
 71.1854 +            <para>
 71.1855 +            This appender requires a <see cref="N:log4net.Layout"/> to be set.
 71.1856 +            </para>
 71.1857 +            </remarks>
 71.1858 +        </member>
 71.1859 +        <member name="T:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes">
 71.1860 +            <summary>
 71.1861 +            The enum of possible display attributes
 71.1862 +            </summary>
 71.1863 +            <remarks>
 71.1864 +            <para>
 71.1865 +            The following flags can be combined together to
 71.1866 +            form the ANSI color attributes.
 71.1867 +            </para>
 71.1868 +            </remarks>
 71.1869 +            <seealso cref="T:log4net.Appender.AnsiColorTerminalAppender"/>
 71.1870 +        </member>
 71.1871 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Bright">
 71.1872 +            <summary>
 71.1873 +            text is bright
 71.1874 +            </summary>
 71.1875 +        </member>
 71.1876 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Dim">
 71.1877 +            <summary>
 71.1878 +            text is dim
 71.1879 +            </summary>
 71.1880 +        </member>
 71.1881 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Underscore">
 71.1882 +            <summary>
 71.1883 +            text is underlined
 71.1884 +            </summary>
 71.1885 +        </member>
 71.1886 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Blink">
 71.1887 +            <summary>
 71.1888 +            text is blinking
 71.1889 +            </summary>
 71.1890 +            <remarks>
 71.1891 +            Not all terminals support this attribute
 71.1892 +            </remarks>
 71.1893 +        </member>
 71.1894 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Reverse">
 71.1895 +            <summary>
 71.1896 +            text and background colors are reversed
 71.1897 +            </summary>
 71.1898 +        </member>
 71.1899 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Hidden">
 71.1900 +            <summary>
 71.1901 +            text is hidden
 71.1902 +            </summary>
 71.1903 +        </member>
 71.1904 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiAttributes.Strikethrough">
 71.1905 +            <summary>
 71.1906 +            text is displayed with a strikethrough
 71.1907 +            </summary>
 71.1908 +        </member>
 71.1909 +        <member name="T:log4net.Appender.AnsiColorTerminalAppender.AnsiColor">
 71.1910 +            <summary>
 71.1911 +            The enum of possible foreground or background color values for 
 71.1912 +            use with the color mapping method
 71.1913 +            </summary>
 71.1914 +            <remarks>
 71.1915 +            <para>
 71.1916 +            The output can be in one for the following ANSI colors.
 71.1917 +            </para>
 71.1918 +            </remarks>
 71.1919 +            <seealso cref="T:log4net.Appender.AnsiColorTerminalAppender"/>
 71.1920 +        </member>
 71.1921 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Black">
 71.1922 +            <summary>
 71.1923 +            color is black
 71.1924 +            </summary>
 71.1925 +        </member>
 71.1926 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Red">
 71.1927 +            <summary>
 71.1928 +            color is red
 71.1929 +            </summary>
 71.1930 +        </member>
 71.1931 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Green">
 71.1932 +            <summary>
 71.1933 +            color is green
 71.1934 +            </summary>
 71.1935 +        </member>
 71.1936 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Yellow">
 71.1937 +            <summary>
 71.1938 +            color is yellow
 71.1939 +            </summary>
 71.1940 +        </member>
 71.1941 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Blue">
 71.1942 +            <summary>
 71.1943 +            color is blue
 71.1944 +            </summary>
 71.1945 +        </member>
 71.1946 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Magenta">
 71.1947 +            <summary>
 71.1948 +            color is magenta
 71.1949 +            </summary>
 71.1950 +        </member>
 71.1951 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.Cyan">
 71.1952 +            <summary>
 71.1953 +            color is cyan
 71.1954 +            </summary>
 71.1955 +        </member>
 71.1956 +        <member name="F:log4net.Appender.AnsiColorTerminalAppender.AnsiColor.White">
 71.1957 +            <summary>
 71.1958 +            color is white
 71.1959 +            </summary>
 71.1960 +        </member>
 71.1961 +        <member name="T:log4net.Appender.AnsiColorTerminalAppender.LevelColors">
 71.1962 +            <summary>
 71.1963 +            A class to act as a mapping between the level that a logging call is made at and
 71.1964 +            the color it should be displayed as.
 71.1965 +            </summary>
 71.1966 +            <remarks>
 71.1967 +            <para>
 71.1968 +            Defines the mapping between a level and the color it should be displayed in.
 71.1969 +            </para>
 71.1970 +            </remarks>
 71.1971 +        </member>
 71.1972 +        <member name="T:log4net.Util.LevelMappingEntry">
 71.1973 +            <summary>
 71.1974 +            An entry in the <see cref="T:log4net.Util.LevelMapping"/>
 71.1975 +            </summary>
 71.1976 +            <remarks>
 71.1977 +            <para>
 71.1978 +            This is an abstract base class for types that are stored in the
 71.1979 +            <see cref="T:log4net.Util.LevelMapping"/> object.
 71.1980 +            </para>
 71.1981 +            </remarks>
 71.1982 +            <author>Nicko Cadell</author>
 71.1983 +        </member>
 71.1984 +        <member name="M:log4net.Util.LevelMappingEntry.#ctor">
 71.1985 +            <summary>
 71.1986 +            Default protected constructor
 71.1987 +            </summary>
 71.1988 +            <remarks>
 71.1989 +            <para>
 71.1990 +            Default protected constructor
 71.1991 +            </para>
 71.1992 +            </remarks>
 71.1993 +        </member>
 71.1994 +        <member name="M:log4net.Util.LevelMappingEntry.ActivateOptions">
 71.1995 +            <summary>
 71.1996 +            Initialize any options defined on this entry
 71.1997 +            </summary>
 71.1998 +            <remarks>
 71.1999 +            <para>
 71.2000 +            Should be overridden by any classes that need to initialise based on their options
 71.2001 +            </para>
 71.2002 +            </remarks>
 71.2003 +        </member>
 71.2004 +        <member name="P:log4net.Util.LevelMappingEntry.Level">
 71.2005 +            <summary>
 71.2006 +            The level that is the key for this mapping 
 71.2007 +            </summary>
 71.2008 +            <value>
 71.2009 +            The <see cref="P:log4net.Util.LevelMappingEntry.Level"/> that is the key for this mapping 
 71.2010 +            </value>
 71.2011 +            <remarks>
 71.2012 +            <para>
 71.2013 +            Get or set the <see cref="P:log4net.Util.LevelMappingEntry.Level"/> that is the key for this
 71.2014 +            mapping subclass.
 71.2015 +            </para>
 71.2016 +            </remarks>
 71.2017 +        </member>
 71.2018 +        <member name="M:log4net.Appender.AnsiColorTerminalAppender.LevelColors.ActivateOptions">
 71.2019 +            <summary>
 71.2020 +            Initialize the options for the object
 71.2021 +            </summary>
 71.2022 +            <remarks>
 71.2023 +            <para>
 71.2024 +            Combine the <see cref="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.ForeColor"/> and <see cref="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.BackColor"/> together
 71.2025 +            and append the attributes.
 71.2026 +            </para>
 71.2027 +            </remarks>
 71.2028 +        </member>
 71.2029 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.ForeColor">
 71.2030 +            <summary>
 71.2031 +            The mapped foreground color for the specified level
 71.2032 +            </summary>
 71.2033 +            <remarks>
 71.2034 +            <para>
 71.2035 +            Required property.
 71.2036 +            The mapped foreground color for the specified level
 71.2037 +            </para>
 71.2038 +            </remarks>
 71.2039 +        </member>
 71.2040 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.BackColor">
 71.2041 +            <summary>
 71.2042 +            The mapped background color for the specified level
 71.2043 +            </summary>
 71.2044 +            <remarks>
 71.2045 +            <para>
 71.2046 +            Required property.
 71.2047 +            The mapped background color for the specified level
 71.2048 +            </para>
 71.2049 +            </remarks>
 71.2050 +        </member>
 71.2051 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.Attributes">
 71.2052 +            <summary>
 71.2053 +            The color attributes for the specified level
 71.2054 +            </summary>
 71.2055 +            <remarks>
 71.2056 +            <para>
 71.2057 +            Required property.
 71.2058 +            The color attributes for the specified level
 71.2059 +            </para>
 71.2060 +            </remarks>
 71.2061 +        </member>
 71.2062 +        <member name="P:log4net.Appender.AnsiColorTerminalAppender.LevelColors.CombinedColor">
 71.2063 +            <summary>
 71.2064 +            The combined <see cref="P:log4net.