Пример #1
0
 /// <summary>
 /// Create a Task to load and run based on the path
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 private void TaskBody(string path)
 {
     try
     {
         // Create the template and attempt to get the report for it
         // If anything goes wrong, we'll catch it below and push the Exception to the command line output
         Model.InfoPathTemplate template = Model.InfoPathTemplate.CreateTemplate(path);
         string output = OutputTemplate(template);
         // write to Console if no output file given
         if (Output == null)
         {
             Console.Write(output);
         }
         else
         {
             lock (_writeLock)
             {
                 StreamWriter writer = new StreamWriter(Output);
                 writer.Write(output);
                 writer.Flush();
             }
         }
     }
     catch (Exception e)
     {
         Console.Error.WriteLine("Error processing " + path + ": " + e.Message);
     }
     finally
     {
         _processed.Enqueue(path);
     }
 }
Пример #2
0
        protected override string OutputTemplate(Model.InfoPathTemplate template)
        {
            StringBuilder sb = new StringBuilder();

            //Skip reporting on InfoPath 2003 forms that don't have a name.
            if (string.IsNullOrEmpty(template.InfoPathManifest.Name))
            {
                return(sb.ToString());
            }

            sb.Append(template.InfoPathManifest.Name).Append("\r\n");
            foreach (Model.Feature.InfoPathFeature feature in template.Features)
            {
                sb.Append(feature.ToString());
                sb.Append("\r\n");
            }
            return(sb.ToString());
        }
Пример #3
0
 /// <summary>
 /// A string representation of the report for a single template.
 /// Deriving classes will collate template.Features in a way that makes sense for the type of report
 /// </summary>
 /// <param name="template"></param>
 /// <returns></returns>
 protected abstract string OutputTemplate(Model.InfoPathTemplate template);