4 using System.Xml.Serialization;
5 using DirectOutput.General.Generic;
7 namespace DirectOutput.FX
14 public class EffectList : NamedItemList<IEffect>, IXmlSerializable
17 #region IXmlSerializable implementation
23 public void WriteXml(XmlWriter writer)
26 XmlSerializerNamespaces Namespaces =
new XmlSerializerNamespaces();
27 Namespaces.Add(
string.Empty,
string.Empty);
30 XmlSerializer serializer =
new XmlSerializer(E.GetType());
31 serializer.Serialize(writer, E, Namespaces);
41 public void ReadXml(XmlReader reader)
43 if (reader.IsEmptyElement)
45 reader.ReadStartElement();
49 General.TypeList Types =
new General.TypeList(AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(p => typeof(
IEffect).IsAssignableFrom(p) && !p.IsAbstract));
53 while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
55 Type T = Types[reader.LocalName];
58 XmlSerializer serializer =
new XmlSerializer(T);
60 if (!Contains(E.
Name))
71 reader.ReadEndElement();
78 public System.Xml.Schema.XmlSchema
GetSchema() {
return (null); }
86 foreach (
IEffect Effect
in this)
96 public void Init(Table.Table Table)
98 foreach (
IEffect Effect
in this)