public override Document Parse(string file, Document document) { SetIndexes(); using (var parser = new HeaderBodyParser(file, CommentMark)) { foreach (var line in parser.Lines()) { ReadLine(document, line); } } return(document); }
public static bool CheckFileFormat(string file) { if (Path.GetExtension(file).ToLower() != ".txt") { return(false); } using (var parser = new HeaderBodyParser(file, String.Empty)) { var header = parser.Lines().Where(l => l.StartsWith("[header]") || l.StartsWith("[body]")); if (header.Count() > 0) { return(false); } } return(true); }