Пример #1
0
        public static TransferEncoding Cast(this System.Net.Mime.TransferEncoding encoding)
        {
            switch (encoding)
            {
            case System.Net.Mime.TransferEncoding.Base64: return(TransferEncoding.Base64);

            case System.Net.Mime.TransferEncoding.QuotedPrintable: return(TransferEncoding.QuotedPrintable);

            case System.Net.Mime.TransferEncoding.SevenBit: return(TransferEncoding.SevenBit);

            case System.Net.Mime.TransferEncoding.Unknown: return(TransferEncoding.None);

            default: throw new InvalidOperationException();
            }
        }
Пример #2
0
        public SerializeableAttachment(Attachment attachment)
        {
            ContentId          = attachment.ContentId;
            ContentDisposition = new SerializeableContentDisposition(attachment.ContentDisposition);
            ContentType        = new SerializeableContentType(attachment.ContentType);
            Name             = attachment.Name;
            TransferEncoding = attachment.TransferEncoding;
            NameEncoding     = attachment.NameEncoding;

            if (attachment.ContentStream != null)
            {
                byte[] bytes = new byte[attachment.ContentStream.Length];
                attachment.ContentStream.Read(bytes, 0, bytes.Length);

                ContentStream = new MemoryStream(bytes);
            }
        }
Пример #3
0
        /// <summary>
        /// Get the transfer encoding string value.
        /// </summary>
        /// <param name="transferEncoding">The transfer encoding.</param>
        /// <returns>The transfer encoding string.</returns>
        public static string GetTransferEncoding(System.Net.Mime.TransferEncoding transferEncoding)
        {
            switch (transferEncoding)
            {
            case System.Net.Mime.TransferEncoding.Base64:
                return("base64");

            case System.Net.Mime.TransferEncoding.QuotedPrintable:
                return("quoted-printable");

            case System.Net.Mime.TransferEncoding.SevenBit:
                return("7bit");

            case System.Net.Mime.TransferEncoding.Unknown:
            default:
                return("unknown");
            }
        }