/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="options"></param>
 public ViewCreatorHelper(ViewCreatorHelperOptions options)
 {
     mOptions = options;
 }
        // Ignore Spelling: Conf

        private static int Main(string[] args)
        {
            var asmName = typeof(Program).GetTypeInfo().Assembly.GetName();
            var exeName = Path.GetFileName(Assembly.GetExecutingAssembly().Location);       // Alternatively: System.AppDomain.CurrentDomain.FriendlyName
            var version = ViewCreatorHelperOptions.GetAppVersion();

            var parser = new CommandLineParser <ViewCreatorHelperOptions>(asmName.Name, version)
            {
                ProgramInfo = "This program processes a SQL DDL file with CREATE VIEW commands and " +
                              "renames the column and table names referenced by the views to use " +
                              "new names defined in the mapping files.",

                ContactInfo = "Program written by Matthew Monroe for the Department of Energy (PNNL, Richland, WA)" +
                              Environment.NewLine + Environment.NewLine +
                              "E-mail: [email protected] or [email protected]" + Environment.NewLine +
                              "Website: https://github.com/PNNL-Comp-Mass-Spec/ or https://panomics.pnnl.gov/ or https://www.pnnl.gov/integrative-omics",

                UsageExamples =
                {
                    exeName + " DBName_unsure.sql /M:DBName_ColumnNameMap.txt"
                }
            };

            parser.AddParamFileKey("Conf");

            var result  = parser.ParseArgs(args);
            var options = result.ParsedResults;

            try
            {
                if (!result.Success)
                {
                    if (parser.CreateParamFileProvided)
                    {
                        return(0);
                    }

                    // Delay for 1500 msec in case the user double clicked this file from within Windows Explorer (or started the program via a shortcut)
                    Thread.Sleep(1500);
                    return(-1);
                }

                if (!options.ValidateArgs(out var errorMessage))
                {
                    parser.PrintHelp();

                    Console.WriteLine();
                    ConsoleMsgUtils.ShowWarning("Validation error:");
                    ConsoleMsgUtils.ShowWarning(errorMessage);

                    Thread.Sleep(1500);
                    return(-1);
                }

                options.OutputSetOptions();
            }
            catch (Exception e)
            {
                Console.WriteLine();
                Console.Write($"Error running {exeName}");
                Console.WriteLine(e.Message);
                Console.WriteLine($"See help with {exeName} --help");
                return(-1);
            }

            try
            {
                var processor = new ViewCreatorHelper(options);

                processor.ErrorEvent   += Processor_ErrorEvent;
                processor.StatusEvent  += Processor_StatusEvent;
                processor.WarningEvent += Processor_WarningEvent;

                var success = processor.ProcessInputFile();

                if (success)
                {
                    Console.WriteLine();
                    Console.WriteLine("Processing complete");
                    Thread.Sleep(1500);
                    return(0);
                }

                ConsoleMsgUtils.ShowWarning("Processing error");
                Thread.Sleep(2000);
                return(-1);
            }
            catch (Exception ex)
            {
                ConsoleMsgUtils.ShowError("Error occurred in Program->Main", ex);
                Thread.Sleep(2000);
                return(-1);
            }
        }