Пример #1
0
        public void headers_are_case_insensitive()
        {
            var part = new MimePart(new ArraySegment<byte>()) {
                {"Content-Type", "text/plain" }
            };

            Verify.That(() => part["Content-Type"] == part["content-type"]);
        }
Пример #2
0
        MimePart ReadPart(byte[] bytes, List<BodyReader.LineSegment> lines, int bodyStartPosition, int bodyLength)
        {
            var part = new MimePart(new ArraySegment<byte>(bytes, bodyStartPosition, bodyLength));

            for(var i = 0; i != lines.Count; ++i) {
                var segment = lines[i];
                var line = Encoding.GetString(bytes, segment.Start, segment.Count);
                var header = ParseHeader(line);
                part.Add(header.Key, header.Value);
            }

            return part;
        }
Пример #3
0
 void OnPartReady(MimePart part)
 {
     var x = PartReady;
     if(x == null)
         return;
     x(this, new MimeBodyPartDataEventArgs { Part = part });
 }