Exemplo n.º 1
0
        public static List<Comment> GetComments(Story story)
        {
            List<Comment> comments = new List<Comment>();
            string url = string.Format(Globals.Base + "stories/{0}/comments?count={1}&appkey={2}", story.Id, Globals.Count, Globals.AppKey);
            XmlTextReader reader = Parser.CreateWebRequest(url);
            Comment newComment = new Comment();

            while (reader.Read())
            {
                List<string> attribs = new List<string>();
                if (reader.HasAttributes)
                {
                    for (int i = 0; i < reader.AttributeCount; i++)
                    {
                        attribs.Add(reader.GetAttribute(i).ToString());
                    }
                }

                if (reader.LocalName == "comment")
                {
                    newComment.Text = reader.ReadString();
                    newComment.Date = attribs[0];
                    newComment.Id = attribs[1];
                    newComment.Up = attribs[3];
                    newComment.Down = attribs[4];
                    newComment.Replies = attribs[5];
                    newComment.User = attribs[6];

                    comments.Add(newComment);
                    newComment = new Comment();
                }
            }
            return comments;
        }
Exemplo n.º 2
0
 public bool Contains(Comment c)
 {
     return cContains(c);
 }
Exemplo n.º 3
0
 private bool cContains(Comment c)
 {
     return alComments.Contains(c) ? true : false;
 }
Exemplo n.º 4
0
 public void Add(Comment c)
 {
     alComments.Add(c);
 }