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

FetchView() public method

Fetches a single view from the requested message.
public FetchView ( 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 FetchView(ViewInfo info)
        {
            var text = FetchEntityText(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};
        }