changeset 30:92cf25b0493b

Re #32 - Migrate to using Schemas * Replace decimal with double to try to get around type cast issues * Correct schema to use minNum and maxNum instead of min/maxNumber for attributes * Use new FileLoadFailure parameters to better log errors while loading files
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2009 20:16:09 +0000
parents d7899f462d8c
children 457c9357dd64
files api/WarFoundryLoader.cs dtds/race.xsd dtds/warfoundry-core.xsd
diffstat 3 files changed, 13 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/api/WarFoundryLoader.cs	Sat Mar 14 20:14:07 2009 +0000
     1.2 +++ b/api/WarFoundryLoader.cs	Sat Mar 14 20:16:09 2009 +0000
     1.3 @@ -204,7 +204,9 @@
     1.4  					}
     1.5  					else
     1.6  					{
     1.7 -						fails.Add(new FileLoadFailure(file, "FileNotHandled", "File not handled as a Race or Game System definition: {0}"));
     1.8 +						FileLoadFailure failure = new FileLoadFailure(file, "File not handled as a Race or Game System definition: {0}", "FileNotHandled");
     1.9 +						fails.Add(failure);
    1.10 +						LogNotifier.Info(GetType(), failure.Message);
    1.11  					}
    1.12  				}
    1.13  			}
    1.14 @@ -288,7 +290,7 @@
    1.15  				}
    1.16  				catch (Exception ex)
    1.17  				{
    1.18 -					failure = new FileLoadFailure(file, ex.Message);
    1.19 +					failure = new FileLoadFailure(file, null, ex.Message, null, ex);
    1.20  				}
    1.21  						
    1.22  				if (failure!=null)
    1.23 @@ -320,13 +322,13 @@
    1.24  				}
    1.25  				catch (Exception ex)
    1.26  				{
    1.27 -					failure = new FileLoadFailure(file, ex.Message);
    1.28 +					failure = new FileLoadFailure(file, null, ex.Message, null, ex);
    1.29  				}
    1.30  						
    1.31  				if (failure!=null)
    1.32  				{
    1.33  					fails.Add(failure);
    1.34 -					LogNotifier.Warn(GetType(), failure.Message);
    1.35 +					LogNotifier.Warn(GetType(), failure.Message, failure.Exception);
    1.36  				}
    1.37  			}
    1.38  			
     2.1 --- a/dtds/race.xsd	Sat Mar 14 20:14:07 2009 +0000
     2.2 +++ b/dtds/race.xsd	Sat Mar 14 20:16:09 2009 +0000
     2.3 @@ -35,8 +35,8 @@
     2.4    <xs:attribute name="cat" type="xs:string" use="required"/>
     2.5    <xs:attribute name="unitPoints" type="core:nonNegativeDecimal" default="0"/>
     2.6    <xs:attribute name="points" type="core:nonNegativeDecimal" use="required"/>
     2.7 -  <xs:attribute name="minNumber" type="xs:nonNegativeInteger" default="0"/>
     2.8 -  <xs:attribute name="maxNumber" type="core:infiniteOrNonNegativeInteger" default="-1"/>
     2.9 +  <xs:attribute name="minNum" type="xs:nonNegativeInteger" default="0"/>
    2.10 +  <xs:attribute name="maxNum" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.11    <xs:attribute name="minSize" type="xs:positiveInteger" default="5"/>
    2.12    <xs:attribute name="maxSize" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.13    <xs:attribute name="baseSize" type="xs:nonNegativeInteger" default="0"/>
    2.14 @@ -62,8 +62,8 @@
    2.15    <xs:attribute name="equipID" type="xs:IDREF" />
    2.16    <xs:attribute name="required" type="xs:boolean" default="false"/>
    2.17    <xs:attribute name="exclusivityGroup" type="xs:string" default=""/>
    2.18 -  <xs:attribute name="minNumber" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.19 -  <xs:attribute name="maxNumber" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.20 +  <xs:attribute name="minNum" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.21 +  <xs:attribute name="maxNum" type="core:infiniteOrNonNegativeInteger" default="-1"/>
    2.22    <xs:attribute name="minPercentage" type="core:percentage" default="100"/>
    2.23    <xs:attribute name="maxPercentage" type="core:percentage" default="100"/>
    2.24    <xs:attribute name="roundDirection" type="updowntype" default="up"/>
     3.1 --- a/dtds/warfoundry-core.xsd	Sat Mar 14 20:14:07 2009 +0000
     3.2 +++ b/dtds/warfoundry-core.xsd	Sat Mar 14 20:16:09 2009 +0000
     3.3 @@ -2,7 +2,7 @@
     3.4  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ibboard.co.uk/warfoundry/core"
     3.5  xmlns="http://ibboard.co.uk/warfoundry/core" elementFormDefault="qualified">
     3.6  <xs:simpleType name="infiniteOrNonNegativeDecimal">
     3.7 -  <xs:restriction base="xs:decimal">
     3.8 +  <xs:restriction base="xs:double">
     3.9      <xs:minInclusive value="-1"/>
    3.10    </xs:restriction>
    3.11  </xs:simpleType>
    3.12 @@ -12,12 +12,12 @@
    3.13    </xs:restriction>
    3.14  </xs:simpleType>
    3.15  <xs:simpleType name="nonNegativeDecimal">
    3.16 -  <xs:restriction base="xs:decimal">
    3.17 +  <xs:restriction base="xs:double">
    3.18      <xs:minInclusive value="0"/>
    3.19    </xs:restriction>
    3.20  </xs:simpleType>
    3.21  <xs:simpleType name="percentage">
    3.22 -  <xs:restriction base="xs:decimal">
    3.23 +  <xs:restriction base="xs:double">
    3.24      <xs:minInclusive value="0"/>
    3.25      <xs:maxInclusive value="100"/>
    3.26    </xs:restriction>