/// <summary> /// Writes out one line and comments, if any. /// </summary> /// <param name="cell"> The table cell to use. </param> /// <param name="line"> Current line. </param> /// <param name="comments"> Comments. </param> /// <param name="commentIndex"> [In/Out] Current index into comments array. </param> private IEnumerable<Control> EncodeLineTextAndComments( ILineEncoder encoder, string prefix, LineAndComments line) { StringBuilder lineHtml = new StringBuilder(encoder.EncodeLine(line.LineText, int.MaxValue, TabValue)); StringBuilder commentsHtml = new StringBuilder(); if (line.Comments != null) { foreach (var comment in line.Comments) AddCommentToCell(commentsHtml, comment, prefix); } return new Control[2] { new Literal() { Text = "<pre class=\"Code\">" + lineHtml.ToString() + "</pre>" }, new Literal() { Text = commentsHtml.ToString() } }; }
/// <summary> /// Creates a DiffFileInfo for a file being compared. /// </summary> /// <param name="file">The file stream.</param> /// <param name="encoder">The line encoder.</param> /// <param name="id">The file ID within the database.</param> /// <param name="baseOrDiff">What role the file plays within the comparison.</param> public DiffFileInfo( StreamCombiner file, ILineEncoder encoder, int id, BaseOrDiff baseOrDiff) { File = file; Encoder = encoder; Id = id; ScriptId = baseOrDiff.ToString().ToLowerCultureInvariant() + "_" + Id.ToString(CultureInfo.InvariantCulture) + "_"; //CurLineNum = 0; //NextCommentIndex = 0; BaseOrDiff = baseOrDiff; }
/// <summary> /// Writes out one line and comments, if any. /// </summary> /// <param name="cell"> The table cell to use. </param> /// <param name="line"> Current line. </param> /// <param name="comments"> Comments. </param> /// <param name="commentIndex"> [In/Out] Current index into comments array. </param> private IEnumerable<Control> EncodeLineTextAndComments( ILineEncoder encoder, string prefix, int lineNumber, string lineText, AbstractedComment[] comments, ref int commentIndex) { StringBuilder lineHtml = new StringBuilder(encoder.EncodeLine(lineText, int.MaxValue, TabValue)); StringBuilder commentsHtml = new StringBuilder(); while (commentIndex < comments.Length && comments[commentIndex].Line == lineNumber) { AddCommentToCell(commentsHtml, comments[commentIndex], prefix); ++commentIndex; } return new Control[2] { new Literal() { Text = "<pre class=\"Code\">" + lineHtml.ToString() + "</pre>" }, new Literal() { Text = commentsHtml.ToString() } }; }