Exemple #1
0
 public InfixEnumerator(CommentNode root)
 {
     this.root = root;
     current   = null;
     index     = -1;
     ife       = null;
 }
Exemple #2
0
        public void AddChildComment(Journal.CommentsRow comment)
        {
            CommentNode tc = new CommentNode(comment, null);

            tc.depth = this.depth + 1;
            if (children == null)
            {
                children = new ArrayList();
            }
            children.Add(tc);
        }
Exemple #3
0
 public CommentNode Find(int ID)
 {
     if (comment != null && comment.ID == ID)
     {
         return(this);
     }
     if (children != null)
     {
         foreach (CommentNode tc in children)
         {
             CommentNode ret = tc.Find(ID);
             if (ret != null)
             {
                 return(ret);
             }
         }
     }
     return(null);
 }
Exemple #4
0
 public InfixEnumerable(CommentNode cn)
 {
     this.cn = cn;
 }
        /// <summary>
        /// Writes selected <see cref="EF.ljArchive.Common.Journal.EventsRow"/> objects and
        /// <see cref="EF.ljArchive.Common.Journal.CommentsRow"/> objects to an HTML-formatted stream.
        /// </summary>
        /// <param name="s">The <see cref="Stream"/> to be written to.</param>
        /// <param name="j">The <see cref="Journal"/> to use for writing.</param>
        /// <param name="eventIDs">An array of <see cref="EF.ljArchive.Common.Journal.EventsRow"/> ItemIDs that
        /// specify which <see cref="EF.ljArchive.Common.Journal.EventsRow"/> objects to write.</param>
        /// <param name="commentIDs">An array of <see cref="EF.ljArchive.Common.Journal.CommentsRow"/> IDs that
        /// specify which <see cref="EF.ljArchive.Common.Journal.CommentsRow"/> objects to write.</param>
        /// <param name="header">If <see langword="true"/>, write any required header for the stream format.</param>
        /// <param name="footer">If <see langword="true"/>, write any required footer for the stream format.</param>
        public void WriteJournal(System.IO.Stream s, EF.ljArchive.Common.Journal j, int[] eventIDs, int[] commentIDs, bool header, bool footer)
        {
            StreamWriter sw;
            IEnumerable  ieEvents;

            options = j.Options[0];
            PreProcessTransform();
            sw = new StreamWriter(s);
            if (header)
            {
                sw.Write(pageHeader);
            }
            if (eventIDs != null)
            {
                ieEvents = j.Events.Select("ID IN (" + IntJoin(eventIDs) + ")");
            }
            else
            {
                ieEvents = j.Events;
            }
            foreach (Journal.EventsRow er in ieEvents)
            {
                WriteEvent(sw, er, j.UserPics, j.Moods);
                string rowFilter = "JItemID = " + er.ID.ToString();
                if (commentIDs != null)
                {
                    rowFilter += " AND ID IN(" + IntJoin(commentIDs) + ")";
                }
                DataRow[]   drs = j.Comments.Select(rowFilter);
                CommentNode cn  = new CommentNode(null, null);
                if (drs.Length > 0 && !AllDeleted(drs))
                {
                    sw.Write(commentsHeader);
                    foreach (Journal.CommentsRow cr in drs)
                    {
                        if (cr.ParentID == 0)
                        {
                            cn.AddChildComment(cr);
                        }
                        else
                        {
                            CommentNode cnParent = cn.Find(cr.ParentID);
                            if (cnParent != null)
                            {
                                cnParent.AddChildComment(cr);
                            }
                        }
                    }
                    foreach (CommentNode tcEnum in cn.GetInfixEnumerator())
                    {
                        if (tcEnum.Comment.State != "D")
                        {
                            WriteComment(sw, tcEnum.Comment, j.Users, (tcEnum.Depth - 1) * 25);
                        }
                    }
                    sw.Write(commentsFooter);
                }
            }
            if (footer)
            {
                sw.Write(pageFooter);
            }
            sw.Flush();
        }