private static Post CreateFromDocument(Document doc, Analyzer analyzer, Highlighter hl) { Post p = new Post(); p.Id = Int32.Parse(doc.GetField("postid").StringValue()); p.UserName = doc.GetField("username").StringValue(); p.CreatedBy = doc.GetField("createdby").StringValue(); p.ModifiedBy = doc.GetField("modifiedby").StringValue(); p.Title = doc.GetField("title").StringValue(); p.CategoryId = Int32.Parse(doc.GetField("categoryid").StringValue()); p.CreatedBy = doc.GetField("author").StringValue(); p.Published = DateTools.StringToDate(doc.GetField("date").StringValue()); p.CreatedOn = DateTools.StringToDate(doc.GetField("createddate").StringValue()); p.ModifiedOn = DateTools.StringToDate(doc.GetField("modifieddate").StringValue()); p.Name = doc.GetField("name").StringValue(); p.PostBody = (analyzer == null || hl == null) ? doc.GetField("rawbody").StringValue() : BestMatch(doc.GetField("body").StringValue(), "body", analyzer, hl); p.ExtendedBody = "<!--hidden-->"; p.CommentCount = Int32.Parse(doc.GetField("commentcount").StringValue()); p.PendingCommentCount = Int32.Parse(doc.GetField("pendingcommentcount").StringValue()); p.ImageUrl = doc.GetField("image").StringValue(); p.PropertyKeys = doc.GetField("propertykeys").StringValue(); p.PropertyValues = doc.GetField("propertyvalues").StringValue(); string[] sa = doc.GetValues("tag"); if (sa != null) { p.TagList = string.Join(",", sa); } p.DeserializeCustomFields(); return(p); }
private Post CreatePostFromDocument(Document doc, Highlighter hl) { var post = new Post { Id = Int32.Parse(doc.GetField("postid").StringValue), UserName = doc.GetField("username").StringValue, CreatedBy = doc.GetField("author").StringValue, //CreatedBy = doc.GetField("createdby").StringValue, ModifiedBy = doc.GetField("modifiedby").StringValue, Title = doc.GetField("title").StringValue, CategoryId = Int32.Parse(doc.GetField("categoryid").StringValue), Published = DateTools.StringToDate(doc.GetField("date").StringValue), CreatedOn = DateTools.StringToDate(doc.GetField("createddate").StringValue), ModifiedOn = DateTools.StringToDate(doc.GetField("modifieddate").StringValue), Name = doc.GetField("name").StringValue, PostBody = (_analyzer == null || hl == null) ? doc.GetField("rawbody").StringValue : BestMatch(doc.GetField("body").StringValue, "body", _analyzer, hl), ExtendedBody = "<!--hidden-->", CommentCount = Int32.Parse(doc.GetField("commentcount").StringValue), PendingCommentCount = Int32.Parse(doc.GetField("pendingcommentcount").StringValue), ImageUrl = doc.GetField("image").StringValue, PropertyKeys = doc.GetField("propertykeys").StringValue, PropertyValues = doc.GetField("propertyvalues").StringValue, }; var sa = doc.GetValues("tag"); if (sa != null) { post.TagList = string.Join(",", sa); } post.DeserializeCustomFields(); return(post); }