comparison api/Factories/Xml/WarFoundryXmlFactoryUtils.cs @ 179:c1caf467dd40

Re #193: Unhandled exception in dictionary? * Make defaultStats attribute required by schema Also: * Remove some references to log notifier
author IBBoard <dev@ibboard.co.uk>
date Sat, 24 Oct 2009 15:00:36 +0000
parents 0b32cc40d82f
children 89e26d51afc2
comparison
equal deleted inserted replaced
178:ca2cd24f6872 179:c1caf467dd40
4 4
5 using System; 5 using System;
6 using System.IO; 6 using System.IO;
7 using System.Xml; 7 using System.Xml;
8 using System.Xml.Schema; 8 using System.Xml.Schema;
9 using IBBoard.Logging;
10 using IBBoard.WarFoundry.API.Objects; 9 using IBBoard.WarFoundry.API.Objects;
11 10
12 namespace IBBoard.WarFoundry.API.Factories.Xml 11 namespace IBBoard.WarFoundry.API.Factories.Xml
13 { 12 {
14 /// <summary> 13 /// <summary>
90 { 89 {
91 cache.Add(xmlNamespace, schemaLocation); 90 cache.Add(xmlNamespace, schemaLocation);
92 } 91 }
93 catch (IOException ex) 92 catch (IOException ex)
94 { 93 {
95 LogNotifier.Warn(typeof(WarFoundryXmlFactoryUtils), "Problem reading schema: " + ex.Message, ex); 94 //TODO: Warn on schema failure
96 } 95 }
97 catch (XmlSchemaException ex) 96 catch (XmlSchemaException ex)
98 { 97 {
99 LogNotifier.Warn(typeof(WarFoundryXmlFactoryUtils), "Problem validating schema for WarFoundry data: " + ex.Message, ex); 98 //TODO: Warn on schema failure
100 } 99 }
101 catch (XmlException ex) 100 catch (XmlException ex)
102 { 101 {
103 LogNotifier.Warn(typeof(WarFoundryXmlFactoryUtils), "Problem reading data for schema: " + ex.Message, ex); 102 //TODO: Warn on schema failure
104 } 103 }
105 } 104 }
106 105
107 public static XmlDocument CreateXmlDocumentFromStream(Stream stream) 106 public static XmlDocument CreateXmlDocumentFromStream(Stream stream)
108 { 107 {
126 { 125 {
127 bool canLoad = true; 126 bool canLoad = true;
128 127
129 if (obj.IsFullyLoaded) 128 if (obj.IsFullyLoaded)
130 { 129 {
131 LogNotifier.DebugFormat(typeof(WarFoundryXmlFactoryUtils), "Object of type {0} with ID {1} is already fully loaded", obj.GetType().Name, obj.ID);
132 canLoad = false; 130 canLoad = false;
133 } 131 }
134 else if (obj.IsLoading) 132 else if (obj.IsLoading)
135 { 133 {
136 LogNotifier.WarnFormat(typeof(WarFoundryXmlFactoryUtils), "Object of type {0} with ID {1} is already being loaded", obj.GetType().Name, obj.ID);
137 canLoad = false; 134 canLoad = false;
138 } 135 }
139 136
140 return canLoad; 137 return canLoad;
141 } 138 }