Index: DamEngine/trunk/src/Deltares.DamEngine.ConsoleRun/Program.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.ConsoleRun/Program.cs (.../Program.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.ConsoleRun/Program.cs (.../Program.cs) (revision 4052) @@ -25,43 +25,42 @@ using CommandLine; using Deltares.DamEngine.Interface; -namespace Deltares.DamEngine.ConsoleRun +namespace Deltares.DamEngine.ConsoleRun; + +internal class Program { - internal class Program + static void Main(string[] args) { - static void Main(string[] args) + var commandLineArguments = new CommandOptions(); + ICommandLineParser parser = new CommandLineParser(); + bool success = parser.ParseArguments(args, commandLineArguments); + try { - var commandLineArguments = new CommandOptions(); - ICommandLineParser parser = new CommandLineParser(); - bool success = parser.ParseArguments(args, commandLineArguments); - try + if (success) { - if (success) + string inputXml = File.ReadAllText(commandLineArguments.InputFileName); + var damEngineInterface = new EngineInterface(inputXml); + string validationMessages = damEngineInterface.Validate(); + if (string.IsNullOrEmpty(validationMessages)) { - string inputXml = File.ReadAllText(commandLineArguments.InputFileName); - var damEngineInterface = new EngineInterface(inputXml); - string validationMessages = damEngineInterface.Validate(); - if (string.IsNullOrEmpty(validationMessages)) - { - // only if validation is ok, then - string outputXml = damEngineInterface.Run(); - File.WriteAllText(commandLineArguments.OutputFileName, outputXml, encoding: Encoding.Unicode); - } - else - { - File.WriteAllText(commandLineArguments.OutputFileName, validationMessages, encoding: Encoding.Unicode); - } + // only if validation is ok, then + string outputXml = damEngineInterface.Run(); + File.WriteAllText(commandLineArguments.OutputFileName, outputXml, encoding: Encoding.Unicode); } else { - Console.WriteLine(); - Console.WriteLine(commandLineArguments.GetUsage()); + File.WriteAllText(commandLineArguments.OutputFileName, validationMessages, encoding: Encoding.Unicode); } } - catch (Exception e) + else { - Console.WriteLine("Exception: {0}", e.Message); + Console.WriteLine(); + Console.WriteLine(commandLineArguments.GetUsage()); } } + catch (Exception e) + { + Console.WriteLine("Exception: {0}", e.Message); + } } } \ No newline at end of file