Example #1
0
        // TODO: Consider using the CustomDataRefs in the Library, so we don't have to relay on GetType-reflection any more.

        #region Single CustomData <-> XmlWriter/Reader
        public static void Serialize(ICustomData value, XmlWriter writer, IDictionary <Guid, Guid> signalMappings, IDictionary <Guid, Guid> busMappings)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (signalMappings == null)
            {
                throw new ArgumentNullException("signalMappings");
            }
            if (busMappings == null)
            {
                throw new ArgumentNullException("busMappings");
            }

            writer.WriteStartElement("CustomData");
            writer.WriteAttributeString("type", TypeToDescription(value.GetType()));
            value.Serialize(writer, signalMappings, busMappings);
            writer.WriteEndElement();
        }