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);
            }
        }
        virtual public void Serialize(Stream stream, Encoding encoding)
        {
            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)
            {
                string value = m_dataType.Name;
                                
                if (serializer is IParameterSerializable)
                {
                    IParameterSerializable paramSerializer = (IParameterSerializable)serializer;
                    List<string> Parameters = paramSerializer.Parameters;
                    if (Parameters.Count > 0)
                        value += ";" + string.Join(";", Parameters.ToArray());
                }

                value += ":";
                value += serializer.SerializeToString();
                value += "\r\n";

                ISerializable clSerializer = new ContentLineSerializer(value);
                if (clSerializer != null)
                    clSerializer.Serialize(stream, encoding);
            }
        }
        virtual public void Serialize(Stream stream, Encoding encoding)
        {
            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)
            {
                if (m_dataType is EncodableDataType)
                {
                    serializer = new EncodableDataTypeSerializer(m_dataType as EncodableDataType);
                }
                else
                {
                    serializer = new FieldSerializer(m_dataType);
                }
            }

            if (serializer != null)
            {
                string value = m_dataType.Name;

                if (serializer is IParameterSerializable)
                {
                    IParameterSerializable paramSerializer = (IParameterSerializable)serializer;
                    List <Parameter>       Parameters      = paramSerializer.Parameters;
                    if (Parameters.Count > 0)
                    {
                        List <string> values = new List <string>();
                        foreach (Parameter p in Parameters)
                        {
                            ParameterSerializer pSerializer = new ParameterSerializer(p);
                            values.Add(pSerializer.SerializeToString());
                        }

                        value += ";" + string.Join(";", values.ToArray());
                    }
                }

                value += ":";
                value += serializer.SerializeToString();
                value += "\r\n";

                ISerializable clSerializer = new ContentLineSerializer(value);
                if (clSerializer != null)
                {
                    clSerializer.Serialize(stream, encoding);
                }
            }
        }
示例#4
0
        public override string SerializeToString()
        {
            string value = string.Empty;
            ISerializable serializer = null;
            if (m_Trigger.ValueType() == typeof(Date_Time))            
                serializer = new Date_TimeSerializer(m_Trigger.DateTime);                
            else
                serializer = new FieldSerializer(m_Trigger.Duration);

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

            return value;
        }        
        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;
        }
示例#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);
        }