WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
ColorList.cs
Go to the documentation of this file.
1 using System.Xml;
2 using System.Xml.Serialization;
5 
6 namespace DirectOutput.General.Color
7 {
8 
12  public class ColorList : NamedItemList<RGBAColorNamed>, IXmlSerializable
13  {
14 
15  #region IXmlSerializable implementation
16  public void WriteXml(XmlWriter writer)
21  {
22 
23  XmlSerializerNamespaces Namespaces = new XmlSerializerNamespaces();
24  Namespaces.Add(string.Empty, string.Empty);
25  foreach (RGBAColorNamed C in this)
26  {
27  XmlSerializer serializer = new XmlSerializer(typeof(RGBAColorNamed));
28  serializer.Serialize(writer, C, Namespaces);
29  }
30  }
31 
32 
37  public void ReadXml(XmlReader reader)
38  {
39  if (reader.IsEmptyElement)
40  {
41  reader.ReadStartElement();
42  return;
43  }
44 
45  reader.Read();
46 
47  while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
48  {
49  if (reader.LocalName == typeof(RGBAColorNamed).Name)
50  {
51 
52  XmlSerializer serializer = new XmlSerializer(typeof(RGBAColorNamed));
53  RGBAColorNamed C = (RGBAColorNamed)serializer.Deserialize(reader);
54  if (!Contains(C.Name))
55  {
56  Add(C);
57  }
58  }
59  else
60  {
61  reader.Skip();
62  }
63  }
64  reader.ReadEndElement();
65  }
66 
67 
72  public System.Xml.Schema.XmlSchema GetSchema() { return (null); }
73  #endregion
74 
75 
76  }
77 }
The namespace DirectOutput.Cab.Toys contains all toy related classes.
void ReadXml(XmlReader reader)
Deserializes the Color objects in the XmlReader. ReadXml is part of the IXmlSerializable interface...
Definition: ColorList.cs:37
string Name
Name of the Named item. Triggers BeforeNameChange before a new Name is set. Triggers AfterNameChang...
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
Definition: Cab.cs:16
List for Color objects
Definition: ColorList.cs:12
Namespace for objects dealing with layers
System.Xml.Schema.XmlSchema GetSchema()
Method is required by the IXmlSerializable interface
Definition: ColorList.cs:72
A list of uniquely named items which can be referenced by their name.
The namespace DirectOutput.General contains classes for general use.
This class stores information on colors used for toys (e.g. RGBLed).