Example #1
0
        static void Main(string[] args)
        {
            List <string> errorMessages = new List <string>();
            bool          helpShown     = false;

            try
            {
                if (!ParseCommandLineArgs(args, errorMessages, ref helpShown))
                {
                    PrintErrorMessages(errorMessages);

                    // Don't need to show the help since if ParseCommandLineArgs returns false the help has already been shown
                    return;
                }

                Generator gen = new Generator(options);

                bool validOptions = gen.ValidateOptions(errorMessages);

                PrintErrorMessages(errorMessages);

                if (validOptions)
                {
                    gen.Run();
                }
            }
            catch (Exception ex)
            {
                PrintErrorMessages(errorMessages);
                Console.Error.WriteLine(ex.Message);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            List <string> errorMessages = new List <string>();
            bool          helpShown     = false;

            if (!ParseCommandLineArgs(args, errorMessages, ref helpShown))
            {
                PrintErrorMessages(errorMessages);

                // Don't need to show the help since if ParseCommandLineArgs returns false the help has already been shown
                return;
            }

            Generator gen = new Generator(options);

            bool validOptions = gen.ValidateOptions(errorMessages);

            PrintErrorMessages(errorMessages);

            if (errorMessages.Any() || !validOptions)
            {
                Environment.Exit(1);
            }

            gen.Run();
        }