2 using System.Collections.Generic;
6 using System.Xml.Serialization;
15 #region IXmlSerializable implementation
16 public void WriteXml(XmlWriter writer)
24 XmlSerializerNamespaces Namespaces =
new XmlSerializerNamespaces();
25 Namespaces.Add(
string.Empty,
string.Empty);
26 foreach (
Shape T
in this)
28 XmlSerializer serializer =
new XmlSerializer(T.GetType());
29 serializer.Serialize(writer, T, Namespaces);
41 if (reader.IsEmptyElement)
43 reader.ReadStartElement();
46 General.TypeList Types =
new General.TypeList(AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(p => typeof(
Shape).IsAssignableFrom(p) && !p.IsAbstract));
50 while (reader.NodeType !=
System.Xml.XmlNodeType.EndElement)
52 Type T = Types[reader.LocalName];
56 XmlSerializer serializer =
new XmlSerializer(T);
57 Shape Shape = (Shape)serializer.Deserialize(reader);
58 if (!Contains(Shape.
Name))
65 Log.
Warning(
"ShapeDefinition type {0} not found during deserialization of cabinet data.".Build(reader.LocalName));
71 reader.ReadEndElement();
void ReadXml(XmlReader reader)
Deserializes the ShapeDefinition objects in the XmlReader The ShapeDefinition objects are deserialize...
static void Warning(string Message)
Writes a warning message to the log.
A simple logger used to record important events and exceptions.
System.Xml.Schema.XmlSchema GetSchema()
Method is required by the IXmlSerializable interface
A list of uniquely named items which can be referenced by their name.
The namespace DirectOutput.General contains classes for general use.
string Name
Name of the named item. Triggers BeforeNameChange before a new Name is set. Triggers AfterNameChang...