コード例 #1
0
 internal AttachmentBase(Stream contentStream, string name, string mediaType)
 {
     this.part = new System.Net.Mime.MimePart();
     this.part.SetContent(contentStream, name, mediaType);
 }
コード例 #2
0
 protected AttachmentBase(string fileName, string mediaType)
 {
     this.part = new System.Net.Mime.MimePart();
     this.SetContentFromFile(fileName, mediaType);
 }
コード例 #3
0
 protected AttachmentBase(Stream contentStream, string mediaType)
 {
     this.part = new System.Net.Mime.MimePart();
     this.part.SetContent(contentStream, null, mediaType);
 }
コード例 #4
0
 protected AttachmentBase(Stream contentStream, System.Net.Mime.ContentType contentType)
 {
     this.part = new System.Net.Mime.MimePart();
     this.part.SetContent(contentStream, contentType);
 }
コード例 #5
0
 internal AttachmentBase()
 {
     this.part = new System.Net.Mime.MimePart();
 }
コード例 #6
0
 private bool GetPart(string boundary, byte[] buffer, long offset, out MimePart part)
 {
     int num;
     string str;
     part = new MimePart();
     part.Header = "";
     part.HdList = new List<string>();
     part.BodyOffset = offset;
     part.BodyLength = 0;
     part.LastPart = false;
     part.NextOffset = offset;
     bool flag = false;
     bool flag2 = false;
     while ((num = this.MemReadToLine(buffer, part.NextOffset)) > 0)
     {
         str = Encoding.ASCII.GetString(buffer, (int) part.NextOffset, num);
         part.NextOffset += num;
         if (str.StartsWith("--") && (str.IndexOf(boundary) >= 0))
         {
             break;
         }
     }
     while ((num = this.MemReadToLine(buffer, part.NextOffset)) > 0)
     {
         str = Encoding.ASCII.GetString(buffer, (int) part.NextOffset, num);
         if (str.StartsWith("--") && (str.IndexOf(boundary) >= 0))
         {
             flag2 = true;
             part.LastPart = str.EndsWith("--");
             return flag2;
         }
         if (!flag)
         {
             if (str == "\r\n")
             {
                 flag = true;
                 part.BodyOffset = part.NextOffset + num;
             }
             else
             {
                 part.Header = part.Header + str;
                 if (str.StartsWith(" ") || str.StartsWith("\t"))
                 {
                     List<string> list;
                     int num2;
                     part.HdList[part.HdList.Count - 1] = part.HdList[part.HdList.Count - 1].TrimEnd(new char[0]);
                     (list = part.HdList)[num2 = part.HdList.Count - 1] = list[num2] + str.TrimStart(new char[0]);
                 }
                 else
                 {
                     part.HdList.Add(str);
                 }
             }
         }
         else
         {
             part.BodyLength += num;
         }
         part.NextOffset += num;
     }
     return flag2;
 }