String IMarkupFormatter.Comment(IComment comment) { return String.Concat( IntendBefore(comment.PreviousSibling), HtmlMarkupFormatter.Instance.Comment(comment), NewLineAfter(comment.NextSibling)); }
public static void ParseComments(IComment message, List<string> comments, TokenReader tr) { message.Comments = ""; foreach (string s in comments) { if (s.StartsWith(":")) { try { string line = s.Substring(1); //Remove comments after "//" int cpos = line.IndexOf("//"); if (cpos >= 0) line = line.Substring(0, cpos); string[] parts = line.Split('='); if (parts.Length > 2) throw new ProtoFormatException("Bad option format, at most one '=', " + s, tr); string key = parts[0].Trim().ToLowerInvariant(); if (parts.Length == 1) { //Parse flag if (message is ProtoMessage) ParseMessageFlags((ProtoMessage)message, key); else if (message is Field) ParseFieldFlags((Field)message, key); else throw new NotImplementedException(); continue; } else { string value = (parts.Length == 2) ? parts[1].Trim() : null; if (message is ProtoMessage) ParseMessageOption((ProtoMessage)message, key, value); else if (message is Field) ParseFieldOption((Field)message, key, value); else throw new NotImplementedException(); continue; } } catch (Exception e) { throw new ProtoFormatException(e.Message, e, tr); } } else { message.Comments += s + "\n"; } } message.Comments = message.Comments.Trim(new char[] { '\n' }).Replace("\n", "\r\n"); comments.Clear(); }
public static string Render(IComment comment) { using (var writer = new StringWriter()) { Render(comment, writer); return writer.ToString(); } }
public AdminController(std s, Postings p, Filings f, Contactus c, Commenting com) { studnt = s; post = p; comment = com; file = f; cont = c; }
public MockPost() { _postsTable = GetMockPosts(); _commentRepository = new MockComment(); _tagRepository = new MockTag(); _categoryRepository = new MockCategory(); _userRepository = new MockUser(); }
public Post(IUser userRepository, ICategory categoryRepository, ITag tagRepository, IComment commentRepository) { _postsTable = context.GetTable<PostEntity>(); _commentRepository = commentRepository; _tagRepository = tagRepository; _categoryRepository = categoryRepository; _userRepository = userRepository; }
/// <summary> /// Gets the comment response. /// </summary> /// <param name="comment">The comment.</param> /// <param name="includeSensitiveInformation">if set to <c>true</c> [include sensitive information].</param> /// <returns></returns> public static CommentResponse GetCommentResponse(IComment comment, bool includeSensitiveInformation = false) { var commentResponseObject = CommentsUtilitiesReflector.Reflect("GetCommentResponse", comment, includeSensitiveInformation); var commentResponse = commentResponseObject as CommentResponse; return commentResponse; }
public CommentController(IPost postRepository, IComment commentsRepository, ISettings settingsRepository, ICacheService cacheService, IError errorLogger) : base(settingsRepository) { _postRepository = postRepository; _cacheService = cacheService; _commentsRepository = commentsRepository; _errorLogger = errorLogger; }
// // GET: /Account/ public AccountController(IUnitOfWork uow, IAccount accountService, ICountry countryService, IProvince provinceService, ICity cityService, IComment commentService) { _accountService = accountService; _countryService = countryService; _provinceService = provinceService; _cityService = cityService; _commentService = commentService; _uow = uow; }
public CommentProcessorPipeline(IComment commentRepository, ISettings settingsRepository, IAkismetService akismetService, IError error, CommentEntity commentEntity, RequestData requestData) { _commentRepository = commentRepository; _settingsRepository = settingsRepository; _akismetService = akismetService; _error = error; _commentEntity = commentEntity; _requestData = requestData; }
private void CheckForSingleComments(string lineCheck, IComment comment) { var result = whiteSpaceHelper.CheckWhiteSpaceAroundCharacter(lineCheck, "'"); // var result = this.whiteSpaceHelper.NeedWarningForSingleWhiteSpaceAfterKeyword(lineCheck, "//"); if(result == true) { comment.AddCodeMarker(WarningId, this, AddSpaceAfterSingleComment, comment); } }
public static IHtmlString Comment(this ApiServices context, IComment comment) { if (comment != null) { var writer = new HtmlTextWriter(new StringWriter()); CommentRenderer.Render(comment, new CommentRendererContext(writer, context)); return MvcHtmlString.Create(writer.InnerWriter.ToString()); } return MvcHtmlString.Create(string.Empty); }
public static Comment FromComment(IComment comment) { Comment t = new Comment { UserName = comment.UserName, Text = comment.Text, CreatedOn = comment.CreatedOn, }; return t; }
public string Format(IComment comment) { foreach (var step in Formatters) { if (step.Criteria(comment) == true) return step.Action(comment); } return null; }
public CommentAdminController(IPost postRepository, IComment commentRepository, ISettings settingsRepository) : base(settingsRepository) { _postRepository = postRepository; _commentRepository = commentRepository; ExpectedMasterName = string.Empty; _itemsPerPage = settingsRepository.ManageItemsPerPage; IsAdminController = true; }
public static CommentEntity CommentEntity(IComment comment) { return new CommentEntity() { Id = comment.Id, Description = comment.Description, CreatedOn = comment.CreatedOn, Reminder = comment.Reminder, Author = UserEntity(comment.Author), Task = TaskEntity(comment.Task) }; }
public AdminController(IPost postRepository, IComment commentRepository, ICategory categoryRepository, ITag tagRepository, ISettings settingsRepository, IPathMapper pathMapper, IUser userRepository) : base(settingsRepository) { _postRepository = postRepository; _commentRepository = commentRepository; _categoryRepository = categoryRepository; _tagRepository = tagRepository; _pathMapper = pathMapper; _userRepository = userRepository; ExpectedMasterName = string.Empty; IsAdminController = true; }
public UserAdminController(IPost postRepository, IComment commentRepository, ICategory categoryRepository, ITag tagRepository, IUser userRepository, ISettings settingsRepository) : base(settingsRepository) { _postRepository = postRepository; _commentRepository = commentRepository; _categoryRepository = categoryRepository; _tagRepository = tagRepository; _userRepository = userRepository; ExpectedMasterName = string.Empty; _itemsPerPage = settingsRepository.ManageItemsPerPage; IsAdminController = true; }
public static WorkLogItem ExtractWorkLogItem(IComment comment) { var hours = int.Parse(HoursRegEx.Match(comment.Body).Value); var minutes = int.Parse(MinutesRegEx.Match(comment.Body).Value); var day = int.Parse(DayRegEx.Match(comment.Body).Value); var month = int.Parse(MonthRegEx.Match(comment.Body).Value); var year = int.Parse(YearRegEx.Match(comment.Body).Value); return new WorkLogItem { Date = new DateTime(year, month, day), Time = new TimeSpan(0, hours, minutes, 0), Creator = comment.Author }; }
private static void Render(IComment node, TextWriter writer) { if (node is Summary) { RenderSummary((Summary)node, writer); } else if (node is InlineText) { RenderText((InlineText)node, writer); } else if (node is ParameterReference) { RenderParameterReference((ParameterReference)node, writer); } else { throw new NotSupportedException(); } }
public long AddComment(IComment comment) { if (!string.IsNullOrEmpty(comment.CommentText)) { var review = new comments { text = comment.CommentText, entity_id = comment.MaterialId, parent_id = comment.ParentId, proto_name = comment.ProtoName, account_id = comment.AuthorId, create_date = DateTime.Now }; Insert(review); UpdateNestedSets(review.entity_id, review.proto_name, review.parent_id, review.level, review.left_key); return review.id; } return 0; }
public void Add(IComment item) { _comment.Add(item); OnCommentAdded(new CommentEventArgs(item)); }
private string FormatGeneralContainer(IComment comment) { return FormatChildren(comment.Children); }
/// <summary> /// Submits a comment to Akismet that should have been /// flagged as SPAM, but was not flagged by Akismet. /// </summary> /// <param name="comment"> /// </param> public void SubmitSpam(IComment comment) { this.SubmitComment(comment, this.submitSpamUrl); }
public void AddComment(IComment comment) { this.Comments.Add(comment); }
/// <summary> /// Checks the comment and returns true if it is spam, otherwise false. /// </summary> /// <param name="comment"> /// </param> /// <returns> /// The check comment for spam. /// </returns> /// <exception cref="InvalidResponseException"> /// Akismet returned an empty response /// </exception> public bool CheckCommentForSpam(IComment comment) { CodeContracts.ArgumentNotNull(comment, "comment"); string result = this.SubmitComment(comment, this.submitCheckUrl); if (result.IsNotSet()) { throw new InvalidResponseException("Akismet returned an empty response"); } if (result != "true" && result != "false") { throw new InvalidResponseException( string.Format( CultureInfo.InvariantCulture, "Received the response '{0}' from Akismet. Probably a bad API key.", result)); } return bool.Parse(result); }
/// <summary> /// Cell comment Finder. /// Returns cell comment for the specified sheet, row and column. /// </summary> /// <param name="sheet">The sheet.</param> /// <param name="row">The row.</param> /// <param name="column">The column.</param> /// <returns>cell comment or /// <c>null</c> /// if not found</returns> public static HSSFComment FindCellComment(InternalSheet sheet, int row, int column) { HSSFComment comment = null; Dictionary<int, TextObjectRecord> noteTxo = new Dictionary<int, TextObjectRecord>(); //map shapeId and TextObjectRecord int i = 0; for (IEnumerator it = sheet.Records.GetEnumerator(); it.MoveNext(); ) { RecordBase rec = (RecordBase)it.Current; if (rec is NoteRecord) { NoteRecord note = (NoteRecord)rec; if (note.Row == row && note.Column == column) { if (i < noteTxo.Count) { TextObjectRecord txo = (TextObjectRecord)noteTxo[note.ShapeId]; comment = new HSSFComment(note, txo); comment.Row = note.Row; comment.Column = note.Column; comment.Author = note.Author; comment.Visible = (note.Flags == NoteRecord.NOTE_VISIBLE); comment.String = txo.Str; break; } } } else if (rec is ObjRecord) { ObjRecord obj = (ObjRecord)rec; SubRecord sub = obj.SubRecords[0]; if (sub is CommonObjectDataSubRecord) { CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)sub; if (cmo.ObjectType == CommonObjectType.COMMENT) { //Find the nearest TextObjectRecord which holds comment's text and map it to its shapeId while (it.MoveNext()) { rec = (Record)it.Current; if (rec is TextObjectRecord) { noteTxo.Add(cmo.ObjectId, (TextObjectRecord)rec); break; } } } } } } return comment; }
/// <summary> /// Removes the comment for this cell, if /// there is one. /// </summary> /// <remarks>WARNING - some versions of excel will loose /// all comments after performing this action!</remarks> public void RemoveCellComment() { HSSFComment comment = FindCellComment(sheet.Sheet, record.Row, record.Column); this.comment = null; if (comment == null) { // Nothing to do return; } // Zap the underlying NoteRecord IList sheetRecords = sheet.Sheet.Records; sheetRecords.Remove(comment.NoteRecord); // If we have a TextObjectRecord, is should // be proceeed by: // MSODRAWING with container // OBJ // MSODRAWING with EscherTextboxRecord if (comment.TextObjectRecord != null) { TextObjectRecord txo = comment.TextObjectRecord; int txoAt = sheetRecords.IndexOf(txo); if (sheetRecords[txoAt - 3] is DrawingRecord && sheetRecords[txoAt - 2] is ObjRecord && sheetRecords[txoAt - 1] is DrawingRecord) { // Zap these, in reverse order sheetRecords.RemoveAt(txoAt - 1); sheetRecords.RemoveAt(txoAt - 2); sheetRecords.RemoveAt(txoAt - 3); } else { throw new InvalidOperationException("Found the wrong records before the TextObjectRecord, can't Remove comment"); } // Now Remove the text record sheetRecords.Remove(txo); } }
/// <summary> /// Returns the comments in a format suitable for display /// </summary> /// <param name="comment"></param> /// <returns></returns> public string Format(IComment comment) { return Formatter.Format(comment); }
public bool Remove(IComment item) { var suc = _comment.Remove(item); OnCommentRemoved(new CommentEventArgs(item)); return suc; }