//transform a JsonComment object to a Comment object private Comment JsonCommentToComment(JsonComment oJsonComment) { Comment comment = new Comment(); comment.comment_id = oJsonComment.id; comment.content = oJsonComment.text; comment.created_at = PubHelper.ParseDateTime(oJsonComment.created_at); comment.idstr = oJsonComment.idstr; if (oJsonComment.mid != null && oJsonComment.mid.Trim() != "") { comment.mid = Convert.ToInt64(oJsonComment.mid); } if (oJsonComment.source != null) { comment.source_url = oJsonComment.source.Substring(9, oJsonComment.source.IndexOf("rel") - 11); comment.source_name = oJsonComment.source.Substring(oJsonComment.source.IndexOf('>') + 1, oJsonComment.source.IndexOf("</") - oJsonComment.source.IndexOf('>') - 1); } if (oJsonComment.status != null) { comment.status_id = oJsonComment.status.id; } comment.user = oJsonComment.user; if (oJsonComment.reply_comment != null) { comment.reply_comment = JsonCommentToComment(oJsonComment.reply_comment); } return(comment); }
//transform a JsonComment object to a Comment object private Comment JsonCommentToComment(JsonComment oJsonComment) { Comment comment = new Comment(); comment.comment_id = oJsonComment.id; comment.content = oJsonComment.text; comment.created_at = PubHelper.ParseDateTime(oJsonComment.created_at); comment.idstr = oJsonComment.idstr; if(oJsonComment.mid!=null && oJsonComment.mid.Trim()!="") comment.mid = Convert.ToInt64(oJsonComment.mid); if (oJsonComment.source != null) { comment.source_url = oJsonComment.source.Substring(9, oJsonComment.source.IndexOf("rel") - 11); comment.source_name = oJsonComment.source.Substring(oJsonComment.source.IndexOf('>') + 1, oJsonComment.source.IndexOf("</") - oJsonComment.source.IndexOf('>') - 1); } if(oJsonComment.status!=null) comment.status_id = oJsonComment.status.id; comment.user = oJsonComment.user; if(oJsonComment.reply_comment!=null) comment.reply_comment = JsonCommentToComment(oJsonComment.reply_comment); return comment; }