protected AttachmentBase(Stream contentStream, ContentType contentType)
 {
     if (contentStream == null || contentType == null)
         throw new ArgumentNullException();
     this._contentStream = contentStream;
     this._contentType = contentType;
 }
 protected AttachmentBase(string fileName, ContentType contentType)
 {
     if (fileName == null)
         throw new ArgumentNullException();
     _contentStream = FileSystem.Current.GetFileFromPathAsync(fileName).Result.OpenAsync(FileAccess.Read).Result;
     this._contentType = contentType;
 }
 bool Equals(ContentType other)
 {
     return other != null && ToString() == other.ToString();
 }
 public Attachment(string fileName, ContentType contentType)
     : base(fileName, contentType)
 {
     InitName(fileName);
 }
 public Attachment(Stream contentStream, ContentType contentType)
     : base(contentStream, contentType)
 {
 }
 public static Attachment CreateAttachmentFromString(string content, ContentType contentType)
 {
     if (content == null)
         throw new ArgumentNullException("content");
     MemoryStream ms = new MemoryStream();
     StreamWriter sw = new StreamWriter(ms);
     sw.Write(content);
     sw.Flush();
     ms.Position = 0;
     Attachment a = new Attachment(ms, contentType);
     a.TransferEncoding = TransferEncoding.QuotedPrintable;
     return a;
 }
 public AlternateView(Stream contentStream, ContentType contentType)
     : base(contentStream, contentType)
 {
 }
 public AlternateView(string fileName, ContentType contentType)
     : base(fileName, contentType)
 {
     if (fileName == null)
         throw new ArgumentNullException();
 }
 public static AlternateView CreateAlternateViewFromString(string content, Encoding encoding, string mediaType)
 {
     if (content == null)
         throw new ArgumentNullException("content");
     if (encoding == null)
         encoding = Encoding.UTF8;
     var ms = new MemoryStream(encoding.GetBytes(content));
     var ct = new ContentType();
     ct.MediaType = mediaType;
     ct.CharSet = encoding.WebName;
     var av = new AlternateView(ms, ct) {TransferEncoding = TransferEncoding.QuotedPrintable};
     return av;
 }
 public static AlternateView CreateAlternateViewFromString(string content, ContentType contentType)
 {
     if (content == null)
         throw new ArgumentNullException("content");
     Encoding enc = contentType.CharSet != null ? Encoding.GetEncoding(contentType.CharSet) : Encoding.UTF8;
     MemoryStream ms = new MemoryStream(enc.GetBytes(content));
     AlternateView av = new AlternateView(ms, contentType);
     av.TransferEncoding = TransferEncoding.QuotedPrintable;
     return av;
 }