Exemplo n.º 1
0
 private void ProcessDocument(string docBlock, IEnumerable <DocumentSettings> settings)
 {
     try
     {
         foreach (var set in settings)
         {
             if (set.DocumentTypePatterns.All(c => Regex.Match(docBlock, c).Success))
             {
                 var document = ReportDocumentParser.Parse(docBlock, set);
                 if (document != null)
                 {
                     Documents.Add(document);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.LogError(e, "Document processing error");
         throw;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///   Parse input string into document
        /// </summary>
        /// <param name="textBlock">String block to be parsed</param>
        /// <param name="configuration">Instance of document settings configuration</param>
        /// <returns></returns>
        public static IReportDocument Parse(string textBlock, DocumentSettings configuration)
        {
            var parser = new ReportDocumentParser(new Logger <ReportDocumentParser>(new LoggerFactory()), textBlock, configuration);

            return(parser.ParseDocument());
        }