| | | 1 | | using System.Linq; |
| | | 2 | | using System.Globalization; |
| | | 3 | | |
| | | 4 | | namespace DirectSight; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Command line access to the ReportBuilder. |
| | | 8 | | /// </summary> |
| | | 9 | | public class Program |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// The main method. |
| | | 13 | | /// </summary> |
| | | 14 | | /// <param name="args">The command line arguments.</param> |
| | | 15 | | /// <returns>Return code indicating success/failure.</returns> |
| | | 16 | | public static int Main(string[] args) |
| | 2 | 17 | | { |
| | | 18 | | // Force the current thread and all future threads to default to Invariant Culture |
| | 2 | 19 | | CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; |
| | 2 | 20 | | CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; |
| | | 21 | | |
| | 2 | 22 | | args = NormalizeArgs(args); |
| | | 23 | | |
| | 2 | 24 | | var configuration = ReportConfigurationBuilder.Create(args); |
| | | 25 | | |
| | 2 | 26 | | var successfulReportGeneration = Generator.GenerateReport(configuration); |
| | | 27 | | |
| | 2 | 28 | | return successfulReportGeneration ? 0 : 1; |
| | 2 | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Normalizes the command line arguments. |
| | | 33 | | /// </summary> |
| | | 34 | | /// <param name="args">The command line arguments.</param> |
| | | 35 | | /// <returns>The normalized command line arguments.</returns> |
| | | 36 | | public static string[] NormalizeArgs(string[] args) |
| | 3 | 37 | | { |
| | 11 | 38 | | var normalizedArgs = args.Select(a => a.Replace(@"""", string.Empty).Trim()); |
| | 3 | 39 | | return [.. normalizedArgs]; |
| | 3 | 40 | | } |
| | | 41 | | } |