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"]); }
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; }
void OnPartReady(MimePart part) { var x = PartReady; if(x == null) return; x(this, new MimeBodyPartDataEventArgs { Part = part }); }