Crystalbyte.Equinox.Imap.ImapClient.FetchView2 C# (CSharp) Method

FetchView2() public method

Fetches a single view from the requested message.
public FetchView2 ( Crystalbyte.Equinox.Imap.ViewInfo info ) : View
info Crystalbyte.Equinox.Imap.ViewInfo The associated info object, this token can be obtained from the messages body structure.
return View
        public View FetchView2(ViewInfo info)
        {
            var text = FetchEntityBody(info);
            if (string.IsNullOrEmpty(text))
            {
                return null;
            }
            var paramDictionary = ((IDictionary<string, string>)info.Parameters);
            var hasValidCharset = paramDictionary.ContainsKey("charset");
            var charset = hasValidCharset ? paramDictionary["charset"] : Charsets.Utf8;
            var decoded = TransferEncoder.Decode(text, info.ContentTransferEncoding, charset);

            return new View { MediaType = info.MediaType, Text = decoded };
        }