internal static SerializeableCollection GetSerializeableCollection(StringDictionary col)
        {
            if (col == null)
                return null;

            var scol = new SerializeableCollection();
            foreach (String key in col.Keys)
                scol.Collection.Add(key, col[key]);

            return scol;
        }
Beispiel #2
0
        internal static SerializeableCollection GetSerializeableCollection(StringDictionary col)
        {
            if (col == null)
            {
                return(null);
            }

            var scol = new SerializeableCollection();

            foreach (String key in col.Keys)
            {
                scol.Collection.Add(key, col[key]);
            }

            return(scol);
        }
        internal static SerializeableContentType GetSerializeableContentType(ContentType ct)
        {
            if (ct == null)
            {
                return(null);
            }

            var sct = new SerializeableContentType();

            sct._boundary   = ct.Boundary;
            sct._charSet    = ct.CharSet;
            sct._mediaType  = ct.MediaType;
            sct._name       = ct.Name;
            sct._parameters = SerializeableCollection.GetSerializeableCollection(ct.Parameters);

            return(sct);
        }
        ///
        /// Creates a new serializeable mailmessage based on a MailMessage object
        ///
        public SerializeableMailMessage(MailMessage mailMessage)
        {
            IsBodyHtml = mailMessage.IsBodyHtml;
            Body       = mailMessage.Body;
            Subject    = mailMessage.Subject;
            From       = SerializeableMailAddress.GetSerializeableMailAddress(mailMessage.From);
            _to        = new List <SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.To)
            {
                _to.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _cc = new List <SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.CC)
            {
                _cc.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _bcc = new List <SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.Bcc)
            {
                _bcc.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _attachments = new List <SerializeableAttachment>();
            foreach (var attachment in mailMessage.Attachments)
            {
                _attachments.Add(SerializeableAttachment.GetSerializeableAttachment(attachment));
            }

            _bodyEncoding = mailMessage.BodyEncoding;

            _deliveryNotificationOptions = mailMessage.DeliveryNotificationOptions;
            _headers         = SerializeableCollection.GetSerializeableCollection(mailMessage.Headers);
            _priority        = mailMessage.Priority;
            ReplyTo          = mailMessage.ReplyToList.Select(SerializeableMailAddress.GetSerializeableMailAddress).ToList();
            Sender           = SerializeableMailAddress.GetSerializeableMailAddress(mailMessage.Sender);
            _subjectEncoding = mailMessage.SubjectEncoding;

            foreach (AlternateView av in mailMessage.AlternateViews)
            {
                _alternateViews.Add(SerializeableAlternateView.GetSerializeableAlternateView(av));
            }
        }
        ///
        /// Creates a new serializeable mailmessage based on a MailMessage object
        ///
        public SerializeableMailMessage(MailMessage mailMessage)
        {
            IsBodyHtml = mailMessage.IsBodyHtml;
            Body = mailMessage.Body;
            Subject = mailMessage.Subject;
            From = SerializeableMailAddress.GetSerializeableMailAddress(mailMessage.From);
            _to = new List<SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.To)
            {
                _to.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _cc = new List<SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.CC)
            {
                _cc.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _bcc = new List<SerializeableMailAddress>();
            foreach (var mailAddress in mailMessage.Bcc)
            {
                _bcc.Add(SerializeableMailAddress.GetSerializeableMailAddress(mailAddress));
            }

            _attachments = new List<SerializeableAttachment>();
            foreach (var attachment in mailMessage.Attachments)
            {
                _attachments.Add(SerializeableAttachment.GetSerializeableAttachment(attachment));
            }

            _bodyEncoding = mailMessage.BodyEncoding;

            _deliveryNotificationOptions = mailMessage.DeliveryNotificationOptions;
            _headers = SerializeableCollection.GetSerializeableCollection(mailMessage.Headers);
            _priority = mailMessage.Priority;
            ReplyTo = mailMessage.ReplyToList.Select(SerializeableMailAddress.GetSerializeableMailAddress).ToList();
            Sender = SerializeableMailAddress.GetSerializeableMailAddress(mailMessage.Sender);
            _subjectEncoding = mailMessage.SubjectEncoding;

            foreach (AlternateView av in mailMessage.AlternateViews)
                _alternateViews.Add(SerializeableAlternateView.GetSerializeableAlternateView(av));
        }
Beispiel #6
0
        internal static SerializeableContentDisposition GetSerializeableContentDisposition(ContentDisposition cd)
        {
            if (cd == null)
            {
                return(null);
            }

            var scd = new SerializeableContentDisposition();

            scd.CreationDate     = cd.CreationDate;
            scd.DispositionType  = cd.DispositionType;
            scd.FileName         = cd.FileName;
            scd.Inline           = cd.Inline;
            scd.ModificationDate = cd.ModificationDate;
            scd.Parameters       = SerializeableCollection.GetSerializeableCollection(cd.Parameters);
            scd.ReadDate         = cd.ReadDate;
            scd.Size             = cd.Size;

            return(scd);
        }