当前位置: 首页>>代码示例>>C#>>正文


C# Entity.Deserialize方法代码示例

本文整理汇总了C#中System.Entity.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Deserialize方法的具体用法?C# Entity.Deserialize怎么用?C# Entity.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Entity的用法示例。


在下文中一共展示了Entity.Deserialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadResponse

        internal override void ReadResponse(Pop3ResponseReader reader)
        {
            TakeSnapshot(reader);

            if (IsNegative) {
                return;
            }

            using (var writer = new StringWriter()) {
                while (true) {
                    reader.ReadNextLine();
                    if (reader.IsCompleted) {
                        break;
                    }

                    writer.WriteLine(reader.CurrentLine.StartsWith("..")
                     ? reader.CurrentLine.Substring(1)
                     : reader.CurrentLine);
                }

                var text = writer.ToString();
                var index = text.IndexOf(Strings.CrLf + Strings.CrLf);

                var entity = new Entity();
                entity.Deserialize(text.Substring(0, index));

                _headerFields.AddRange(entity.Headers);
                Lines = text.Substring(index).Trim();
            }
        }
开发者ID:pravse,项目名称:CommSample,代码行数:30,代码来源:TopPop3Response.cs

示例2: FromMime

 public static Message FromMime(string text)
 {
     var entity = new Entity();
     entity.Deserialize(text);
     return entity.ToMessage();
 }
开发者ID:pravse,项目名称:CommSample,代码行数:6,代码来源:Message.cs

示例3: FetchMessageByUid

        /// <summary>
        /// Fetches a single message from the selected mailbox identified by its unique identifier.
        /// </summary>
        /// <param name="uid">The uid of the requested message.</param>
        /// <returns>The requested message.</returns>
        public Message FetchMessageByUid(int uid)
        {
            var query = Messages
                .Where(x => x.Uid == uid)
                .Select(x => new MessageContainer {
                                     Uid = x.Uid,
                                     SequenceNumber = x.SequenceNumber,
                                     Text = (string) x.Parts(string.Empty)
                                 });
            var container = query.ToList().FirstOrDefault();
            if (container != null) {
                var entity = new Entity();
                entity.Deserialize(container.Text);

                var message = entity.ToMessage();
                message.Uid = container.Uid;
                message.SequenceNumber = container.SequenceNumber;
                return message;
            }

            return null;
        }
开发者ID:MichielDeMey,项目名称:Kolibrie-Mail,代码行数:27,代码来源:ImapClient.cs

示例4: FetchNestedMessage

 /// <summary>
 /// Fetches a single nested message from the requested message.
 /// </summary>
 /// <param name="info">The associated info object, this token can be obtained from the messages body structure.</param>
 /// <returns>The requested nested message.</returns>
 public Message FetchNestedMessage(MessageInfo info)
 {
     var text = FetchEntityText(info);
     if (string.IsNullOrEmpty(text)) {
         return null;
     }
     var entity = new Entity();
     entity.Deserialize(text);
     return entity.ToMessage();
 }
开发者ID:MichielDeMey,项目名称:Kolibrie-Mail,代码行数:15,代码来源:ImapClient.cs

示例5: ParseEntity

        private static View ParseEntity(Message message, Entity current, Entity last, View related = null)
        {
            if (current.IsMessage()) {
                var e = new Entity();
                e.Deserialize(current.Text);
                var nested = e.ToMessage();
                message.NestedMessages.Add(nested);
                return null;
            }

            if (related != null) {
                var attachment = current.ToRelated();
                related.RelatedAttachments.Add(attachment);
                return related;
            }

            if (current.IsAttachment()) {
                var attachment = current.ToAttachment();
                message.Attachments.Add(attachment);
                return null;
            }

            if (current.IsView() || !current.HasContentType) {
                var view = current.ToView();
                message.Views.Add(view);
                if (last != null && last.IsMultipartRelated) {
                    return view;
                }
                return null;
            }

            foreach (var child in current.Children) {
                // we need to pass the related view to the next sibling
                related = ParseEntity(message, child, current, related);
            }

            return null;
        }
开发者ID:pravse,项目名称:CommSample,代码行数:38,代码来源:EntityExtensions.cs


注:本文中的System.Entity.Deserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。