MailKit.Net.Imap.ImapLiteral.ImapLiteral C# (CSharp) Method

ImapLiteral() public method

Initializes a new instance of the MailKit.Net.Imap.ImapLiteral class.
Creates a new MailKit.Net.Imap.ImapLiteral.
public ImapLiteral ( MimeKit.FormatOptions options, object literal, Action action = null ) : System
options MimeKit.FormatOptions The formatting options.
literal object The literal.
action Action The progress update action.
return System
		public ImapLiteral (FormatOptions options, object literal, Action<int> action = null)
		{
			format = options.Clone ();
			format.NewLineFormat = NewLineFormat.Dos;

			update = action;

			if (literal is MimeMessage) {
				Type = ImapLiteralType.MimeMessage;
			} else if (literal is Stream) {
				Type = ImapLiteralType.Stream;
			} else if (literal is string) {
				literal = Encoding.UTF8.GetBytes ((string) literal);
				Type = ImapLiteralType.String;
			} else if (literal is byte[]) {
				Type = ImapLiteralType.String;
			} else {
				throw new ArgumentException ("Unknown literal type");
			}

			Literal = literal;
		}