/// <summary> /// Gets all body parts of a multipart message, including prologue and epilogue /// </summary> /// <returns></returns> public virtual IEnumerable <MimePart> GetAllParts() { if (!this.IsMultiPart) { throw new MimeException(MimeError.NotMultipart); } return(MimeParser.ReadBodyParts(m_body.SourceText, this.ParsedContentType.Boundary)); }
internal override void AppendSourceText(StringSegment segment) { if (!this.SourceText.IsNull) { // // Header already has text. We need to unfold the new text in... // StringSegment unfoldedLine = MimeParser.SkipWhitespace(segment); if (unfoldedLine.IsEmpty) { throw new MimeException(MimeError.InvalidHeader); } base.AppendText(unfoldedLine.ToString()); } base.AppendSourceText(segment); }
/// <summary> /// Splits a header string <paramref name="headerText"/> into header name and value. /// </summary> /// <param name="headerText">The header line</param> /// <returns>A pair where the key is the header name, and the value the header value.</returns> public override KeyValuePair <string, string> SplitHeader(string headerText) { return(MimeParser.ReadNameValue(headerText)); }
/// <summary> /// Deserializes and parses a header block supplied as <paramref name="messageText"/>. /// </summary> /// <param name="messageText">The header block.</param> /// <returns>The deserialized and parsed <see cref="Header"/> enumeration</returns> public override IEnumerable <Header> DeserializeHeaders(StringSegment messageText) { return(MimeParser.ReadHeaders(messageText)); }
/// <summary> /// Deserializes and parses <paramref name="messageText"/> /// </summary> /// <typeparam name="T">The entity type to which to deserialize.</typeparam> /// <param name="messageText">The <see cref="StringSegment"/> representing the source text</param> /// <returns>The deserialized and parsed entity</returns> public override T Deserialize <T>(StringSegment messageText) { return(MimeParser.Read <T>(messageText)); }