C# Класс MimeKit.MimePart

A leaf-node MIME part that contains content such as the message body text or an attachment.
A leaf-node MIME part that contains content such as the message body text or an attachment.
Наследование: MimeKit.MimeEntity
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Accept ( MimeKit.MimeVisitor visitor ) : void

Dispatches to the specific visit method for this MIME entity.

This default implementation for MimeKit.MimePart nodes calls MimeKit.MimeVisitor.VisitMimePart. Override this method to call into a more specific method on a derived visitor class of the MimeKit.MimeVisitor class. However, it should still support unknown visitors by calling MimeKit.MimeVisitor.VisitMimePart.

ComputeContentMd5 ( ) : string

Computes the MD5 checksum of the content.

Computes the MD5 checksum of the MIME content in its canonical format and then base64-encodes the result.

GetBestEncoding ( EncodingConstraint constraint, CancellationToken cancellationToken = default(CancellationToken) ) : ContentEncoding

Calculates the most efficient content encoding given the specified constraint.

If no ContentObject is set, ContentEncoding.SevenBit will be returned.

GetBestEncoding ( EncodingConstraint constraint, int maxLineLength, CancellationToken cancellationToken = default(CancellationToken) ) : ContentEncoding

Calculates the most efficient content encoding given the specified constraint.

If no ContentObject is set, ContentEncoding.SevenBit will be returned.

MimePart ( ) : System

Initializes a new instance of the MimeKit.MimePart class with the default Content-Type of application/octet-stream.

Creates a new MimePart with a Content-Type of application/octet-stream.

MimePart ( MimeKit.ContentType contentType ) : System

Initializes a new instance of the MimeKit.MimePart class with the specified content type.

Creates a new MimePart with the specified Content-Type value.

MimePart ( MimeKit.MimeEntityConstructorArgs args ) : System

Initializes a new instance of the MimeKit.MimePart class based on the MimeEntityConstructorArgs.

This constructor is used by MimeKit.MimeParser.

MimePart ( string contentType ) : System

Initializes a new instance of the MimeKit.MimePart class with the specified content type.

Creates a new MimePart with the specified Content-Type value.

MimePart ( string mediaType, string mediaSubtype ) : System

Initializes a new instance of the MimeKit.MimePart class with the specified media type and subtype.

Creates a new MimePart with the specified media type and subtype.

Prepare ( EncodingConstraint constraint, int maxLineLength = 78 ) : void

Prepare the MIME entity for transport using the specified encoding constraints.

Prepares the MIME entity for transport using the specified encoding constraints.

VerifyContentMd5 ( ) : bool

Verifies the Content-Md5 value against an independently computed md5sum.

Computes the MD5 checksum of the MIME content and compares it with the value in the Content-MD5 header, returning true if and only if the values match.

WriteTo ( MimeKit.FormatOptions options, Stream stream, bool contentOnly, CancellationToken cancellationToken = default(CancellationToken) ) : void

Writes the MimeKit.MimePart to the specified output stream.

Writes the MIME part to the output stream.

Защищенные методы

Метод Описание
OnHeadersChanged ( HeaderListChangedAction action, Header header ) : void

Called when the headers change in some way.

Updates the ContentTransferEncoding, ContentDuration, and ContentMd5 properties if the corresponding headers have changed.

Приватные методы

Метод Описание
IsNullOrWhiteSpace ( string value ) : bool
NeedsEncoding ( ContentEncoding encoding ) : bool

Описание методов

Accept() публичный Метод

Dispatches to the specific visit method for this MIME entity.
This default implementation for MimeKit.MimePart nodes calls MimeKit.MimeVisitor.VisitMimePart. Override this method to call into a more specific method on a derived visitor class of the MimeKit.MimeVisitor class. However, it should still support unknown visitors by calling MimeKit.MimeVisitor.VisitMimePart.
/// is null. ///
public Accept ( MimeKit.MimeVisitor visitor ) : void
visitor MimeKit.MimeVisitor The visitor.
Результат void

ComputeContentMd5() публичный Метод

Computes the MD5 checksum of the content.
Computes the MD5 checksum of the MIME content in its canonical format and then base64-encodes the result.
/// The is null. ///
public ComputeContentMd5 ( ) : string
Результат string

GetBestEncoding() публичный Метод

Calculates the most efficient content encoding given the specified constraint.
If no ContentObject is set, ContentEncoding.SevenBit will be returned.
/// is not a valid value. /// /// The operation was canceled via the cancellation token. /// /// An I/O error occurred. ///
public GetBestEncoding ( EncodingConstraint constraint, CancellationToken cancellationToken = default(CancellationToken) ) : ContentEncoding
constraint EncodingConstraint The encoding constraint.
cancellationToken System.Threading.CancellationToken A cancellation token.
Результат ContentEncoding

GetBestEncoding() публичный Метод

Calculates the most efficient content encoding given the specified constraint.
If no ContentObject is set, ContentEncoding.SevenBit will be returned.
/// is not between 72 and 998 (inclusive). /// -or- /// is not a valid value. /// /// The operation was canceled via the cancellation token. /// /// An I/O error occurred. ///
public GetBestEncoding ( EncodingConstraint constraint, int maxLineLength, CancellationToken cancellationToken = default(CancellationToken) ) : ContentEncoding
constraint EncodingConstraint The encoding constraint.
maxLineLength int The maximum allowable length for a line (not counting the CRLF). Must be between 72 and 998 (inclusive).
cancellationToken System.Threading.CancellationToken A cancellation token.
Результат ContentEncoding

MimePart() публичный Метод

Initializes a new instance of the MimeKit.MimePart class with the default Content-Type of application/octet-stream.
Creates a new MimePart with a Content-Type of application/octet-stream.
public MimePart ( ) : System
Результат System

MimePart() публичный Метод

Initializes a new instance of the MimeKit.MimePart class with the specified content type.
Creates a new MimePart with the specified Content-Type value.
/// is null. ///
public MimePart ( MimeKit.ContentType contentType ) : System
contentType MimeKit.ContentType The content type.
Результат System

MimePart() публичный Метод

Initializes a new instance of the MimeKit.MimePart class based on the MimeEntityConstructorArgs.
This constructor is used by MimeKit.MimeParser.
/// is null. ///
public MimePart ( MimeKit.MimeEntityConstructorArgs args ) : System
args MimeKit.MimeEntityConstructorArgs Information used by the constructor.
Результат System

MimePart() публичный Метод

Initializes a new instance of the MimeKit.MimePart class with the specified content type.
Creates a new MimePart with the specified Content-Type value.
/// is null. /// /// could not be parsed. ///
public MimePart ( string contentType ) : System
contentType string The content type.
Результат System

MimePart() публичный Метод

Initializes a new instance of the MimeKit.MimePart class with the specified media type and subtype.
Creates a new MimePart with the specified media type and subtype.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// contains more than one or /// . /// -or- /// contains one or more arguments of an unknown type. ///
public MimePart ( string mediaType, string mediaSubtype ) : System
mediaType string The media type.
mediaSubtype string The media subtype.
Результат System

OnHeadersChanged() защищенный Метод

Called when the headers change in some way.
Updates the ContentTransferEncoding, ContentDuration, and ContentMd5 properties if the corresponding headers have changed.
protected OnHeadersChanged ( HeaderListChangedAction action, Header header ) : void
action HeaderListChangedAction The type of change.
header Header The header being added, changed or removed.
Результат void

Prepare() публичный Метод

Prepare the MIME entity for transport using the specified encoding constraints.
Prepares the MIME entity for transport using the specified encoding constraints.
/// is not between 60 and 998 (inclusive). /// -or- /// is not a valid value. ///
public Prepare ( EncodingConstraint constraint, int maxLineLength = 78 ) : void
constraint EncodingConstraint The encoding constraint.
maxLineLength int The maximum number of octets allowed per line (not counting the CRLF). Must be between 60 and 998 (inclusive).
Результат void

VerifyContentMd5() публичный Метод

Verifies the Content-Md5 value against an independently computed md5sum.
Computes the MD5 checksum of the MIME content and compares it with the value in the Content-MD5 header, returning true if and only if the values match.
public VerifyContentMd5 ( ) : bool
Результат bool

WriteTo() публичный Метод

Writes the MimeKit.MimePart to the specified output stream.
Writes the MIME part to the output stream.
/// is null. /// -or- /// is null. /// /// The operation was canceled via the cancellation token. /// /// An I/O error occurred. ///
public WriteTo ( MimeKit.FormatOptions options, Stream stream, bool contentOnly, CancellationToken cancellationToken = default(CancellationToken) ) : void
options MimeKit.FormatOptions The formatting options.
stream Stream The output stream.
contentOnly bool true if only the content should be written; otherwise, false.
cancellationToken System.Threading.CancellationToken A cancellation token.
Результат void