public static void Main(System.String[] args) { if (args.Length != 1 || args[0].ToUpper().Equals("-?".ToUpper()) || args[0].ToUpper().Equals("-h".ToUpper()) || args[0].ToUpper().Equals("-help".ToUpper())) { System.Console.Out.WriteLine("USAGE:"); System.Console.Out.WriteLine(" ParseTester <source>"); System.Console.Out.WriteLine(); System.Console.Out.WriteLine(" <source> must be either a file containing HL7 messages or a directory containing such files"); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Notes:"); System.Console.Out.WriteLine(" - Messages can be XML or ER7 encoded. "); System.Console.Out.WriteLine(" - If there are multiple messages in a file they must be delimited by blank lines"); System.Console.Out.WriteLine(" - C and C++ style comments are skipped"); } else { try { System.Console.Out.WriteLine("Testing ... "); System.IO.FileInfo source = new System.IO.FileInfo(args[0]); NuGenParseTester tester = new NuGenParseTester(); NuGenHL7Exception[] exceptions = tester.testAll(source); if (exceptions.Length > 0) { System.Console.Out.WriteLine("Parsing problems with tested messages: "); } for (int i = 0; i < exceptions.Length; i++) { System.Console.Out.WriteLine("PROBLEM #" + (i + 1)); System.Console.Out.WriteLine(exceptions[i].Message); } } catch (System.IO.IOException e) { System.Console.Out.WriteLine("Testing failed to complete because of a problem reading source file(s) ... \r\n"); SupportClass.WriteStackTrace(e, Console.Error); } } }
public static void Main(System.String[] args) { if (args.Length != 1 || args[0].ToUpper().Equals("-?".ToUpper()) || args[0].ToUpper().Equals("-h".ToUpper()) || args[0].ToUpper().Equals("-help".ToUpper())) { System.Console.Out.WriteLine("USAGE:"); System.Console.Out.WriteLine(" ParseTester <source>"); System.Console.Out.WriteLine(); System.Console.Out.WriteLine(" <source> must be either a file containing HL7 messages or a directory containing such files"); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Notes:"); System.Console.Out.WriteLine(" - Messages can be XML or ER7 encoded. "); System.Console.Out.WriteLine(" - If there are multiple messages in a file they must be delimited by blank lines"); System.Console.Out.WriteLine(" - C and C++ style comments are skipped"); } else { try { System.Console.Out.WriteLine("Testing ... "); System.IO.FileInfo source = new System.IO.FileInfo(args[0]); NuGenParseTester tester = new NuGenParseTester(); NuGenHL7Exception[] exceptions = tester.testAll(source); if (exceptions.Length > 0) System.Console.Out.WriteLine("Parsing problems with tested messages: "); for (int i = 0; i < exceptions.Length; i++) { System.Console.Out.WriteLine("PROBLEM #" + (i + 1)); System.Console.Out.WriteLine(exceptions[i].Message); } } catch (System.IO.IOException e) { System.Console.Out.WriteLine("Testing failed to complete because of a problem reading source file(s) ... \r\n"); SupportClass.WriteStackTrace(e, Console.Error); } } }