コード例 #1
0
 protected AttachmentBase(Stream contentStream, ContentType contentType)
 {
     if (contentStream == null || contentType == null)
         throw new ArgumentNullException();
     this._contentStream = contentStream;
     this._contentType = contentType;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 bool Equals(ContentType other)
 {
     return other != null && ToString() == other.ToString();
 }
コード例 #4
0
 public Attachment(string fileName, ContentType contentType)
     : base(fileName, contentType)
 {
     InitName(fileName);
 }
コード例 #5
0
 public Attachment(Stream contentStream, ContentType contentType)
     : base(contentStream, contentType)
 {
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 public AlternateView(Stream contentStream, ContentType contentType)
     : base(contentStream, contentType)
 {
 }
コード例 #8
0
 public AlternateView(string fileName, ContentType contentType)
     : base(fileName, contentType)
 {
     if (fileName == null)
         throw new ArgumentNullException();
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 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;
 }