Exemplo n.º 1
0
        virtual public string SerializeToString()
        {
            Type          type       = m_dataType.GetType();
            ISerializable serializer = null;

            Type serializerType = Type.GetType(GetType().Namespace + "." + type.Name + "Serializer", false, true);

            if (serializerType != null)
            {
                serializer = (ISerializable)Activator.CreateInstance(serializerType, new object[] { m_dataType });
            }

            if (serializer == null)
            {
                serializer = new FieldSerializer(m_dataType);
            }

            if (serializer != null)
            {
                return(serializer.SerializeToString());
            }
            else
            {
                return(string.Empty);
            }
        }
Exemplo n.º 2
0
        virtual public void Serialize(XmlTextWriter xtw)
        {
            Type type = m_dataType.GetType();
            IXCalSerializable serializer = null;

            Type serializerType = Type.GetType(GetType().Namespace + "." + type.Name + "Serializer", false, true);
            if (serializerType != null)
                serializer = (IXCalSerializable)Activator.CreateInstance(serializerType, new object[] { m_dataType });

            if (serializer == null)
                serializer = new FieldSerializer(m_dataType);

            if (serializer != null)
            {
                xtw.WriteStartElement(m_dataType.Name.ToLower());                

                if (serializer is IParameterSerializable)
                {
                    IParameterSerializable paramSerializer = (IParameterSerializable)serializer;
                    List<Parameter> Parameters = paramSerializer.Parameters;
                    foreach (Parameter param in paramSerializer.Parameters)
                    {                        
                        xtw.WriteAttributeString(param.Name.ToLower(), string.Join(",", param.Values.ToArray()));
                    }
                }

                // Determine if we should serialize the data of this serializer
                // as CDATA instead of a standard string.
                if (serializer.GetType().GetCustomAttributes(typeof(CDataAttribute), true).Length > 0)
                    xtw.WriteCData(serializer.SerializeToString());
                else xtw.WriteString(serializer.SerializeToString());
                
                xtw.WriteEndElement();                
            }
        }
Exemplo n.º 3
0
        public override string SerializeToString()
        {
            string value = string.Empty;
            ISerializable serializer = null;
            if (m_Trigger.ValueType() == typeof(iCalDateTime))            
                serializer = new iCalDateTimeSerializer(m_Trigger.DateTime);                
            else
                serializer = new FieldSerializer(m_Trigger.Duration);

            if (serializer != null)
                value += serializer.SerializeToString();

            return value;
        }        
Exemplo n.º 4
0
        virtual public string SerializeToString()
        {
            Type type = m_dataType.GetType();
            ISerializable serializer = null;

            Type serializerType = Type.GetType(GetType().Namespace + "." + type.Name + "Serializer", false, true);
            if (serializerType != null)
                serializer = (ISerializable)Activator.CreateInstance(serializerType, new object[] { m_dataType });

            if (serializer == null)
                serializer = new FieldSerializer(m_dataType);

            if (serializer != null)
                return serializer.SerializeToString();
            else return string.Empty;
        }
Exemplo n.º 5
0
        virtual public void Serialize(XmlTextWriter xtw)
        {
            Type type = m_dataType.GetType();
            IXCalSerializable serializer = null;

            Type serializerType = Type.GetType(GetType().Namespace + "." + type.Name + "Serializer", false, true);

            if (serializerType != null)
            {
                serializer = (IXCalSerializable)Activator.CreateInstance(serializerType, new object[] { m_dataType });
            }

            if (serializer == null)
            {
                serializer = new FieldSerializer(m_dataType);
            }

            if (serializer != null)
            {
                xtw.WriteStartElement(m_dataType.Name.ToLower());

                if (serializer is IParameterSerializable)
                {
                    IParameterSerializable paramSerializer = (IParameterSerializable)serializer;
                    List <Parameter>       Parameters      = paramSerializer.Parameters;
                    foreach (Parameter param in paramSerializer.Parameters)
                    {
                        xtw.WriteAttributeString(param.Name.ToLower(), string.Join(",", param.Values.ToArray()));
                    }
                }

                // Determine if we should serialize the data of this serializer
                // as CDATA instead of a standard string.
                if (serializer.GetType().GetCustomAttributes(typeof(CDataAttribute), true).Length > 0)
                {
                    xtw.WriteCData(serializer.SerializeToString());
                }
                else
                {
                    xtw.WriteString(serializer.SerializeToString());
                }

                xtw.WriteEndElement();
            }
        }
Exemplo n.º 6
0
        public override string SerializeToString()
        {
            string        value      = string.Empty;
            ISerializable serializer = null;

            if (m_Trigger.ValueType() == typeof(iCalDateTime))
            {
                serializer = new iCalDateTimeSerializer(m_Trigger.DateTime);
            }
            else
            {
                serializer = new FieldSerializer(m_Trigger.Duration);
            }

            if (serializer != null)
            {
                value += serializer.SerializeToString();
            }

            return(value);
        }