4 using System.Xml.Serialization;
16 #region IXmlSerializable implementation
17 public void WriteXml(XmlWriter writer)
25 XmlSerializerNamespaces Namespaces =
new XmlSerializerNamespaces();
26 Namespaces.Add(
string.Empty,
string.Empty);
29 XmlSerializer serializer =
new XmlSerializer(OC.GetType());
30 serializer.Serialize(writer, OC, Namespaces);
42 if (reader.IsEmptyElement)
44 reader.ReadStartElement();
48 General.TypeList Types =
new General.TypeList(AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(p => typeof(
IOutputController).IsAssignableFrom(p) && !p.IsAbstract));
52 while (reader.NodeType !=
System.Xml.XmlNodeType.EndElement)
54 if (reader.NodeType == XmlNodeType.Element)
56 Type T = Types[reader.LocalName];
59 XmlSerializer serializer =
new XmlSerializer(T);
61 if (!Contains(O.
Name))
68 Log.
Warning(
"Output controller type {0} not found during deserialization of data.".Build(reader.LocalName));
79 reader.ReadEndElement();
98 Log.
Debug(
"Initializing output controllers");
103 Log.
Debug(
"Output controllers initialized");
111 Log.
Debug(
"Finishing output controllers");
116 Log.
Debug(
"Output controllers finished");
The Cabinet object describes the parts of a pinball cabinet (toys, outputcontrollers, outputs and more).
new string Name
Name of the IOutputController. This property is fully implemented in the abstract OutputControllerBas...
void Init(Cabinet Cabinet)
Initializes all IOutputController objects in the list.
void Init(Cabinet Cabinet)
Must initialize the IOutputController. Is called after the objects have been instanciated.
static void Warning(string Message)
Writes a warning message to the log.
A simple logger used to record important events and exceptions.
void Finish()
Finishes all IOutputController objects in the list.
static void Debug(string Message="")
Writes the specified debug message to the log file.
List of IOutputController objects
System.Xml.Schema.XmlSchema GetSchema()
Method is required by the IXmlSerializable interface.
void Finish()
Must finish the IOutputController and do all necessary cleanup task. Must turn off the physical outpu...
Common interface for all outputcontrollers. Only classes implementing this interface can be used as o...
void Update()
Updates all IOutputController objects in the list.
A list of uniquely named items which can be referenced by their name.
The namespace DirectOutput.General contains classes for general use.
void Update()
Must update resp. thrigger the update of the physical outputs of the IOutputController.
void ReadXml(XmlReader reader)
Deserializes the IOutputController objects in the XmlReader. The IOutputController objects are deser...