/// <summary> /// Edit the lines of text in the editorconfig file /// </summary> /// /// <param name="editAction"> /// Action that modifies the lines of text in the file /// </param> /// /// <remarks> /// After <paramref name="editAction"/> is performed, the file is re-parsed and state updated /// </remarks> /// /// <exception cref="TextFileParseException"> /// After <paramref name="editAction"/> was performed, the lines of text were no longer in valid editorconfig /// format /// </exception> /// public void Edit(Action <IList <string> > editAction) { Guard.NotNull(editAction, nameof(editAction)); var linesOfText = LinesOfText.ToList(); editAction(linesOfText); Parse(linesOfText); }
public Message CreateNews(string headline, IList <string> lines) { var h = new Headline(headline); var news = new News(h); foreach (var s in lines) { var group = new News.LinesOfTextGroup { Text = new Text(s) }; news.AddGroup(group); } if (lines.Count == 0) { var noLines = new LinesOfText(0); news.SetField(noLines, true); } return(news); }