Esempio n. 1
0
        void Run()
        {
            if (TryParse(out var argument))
            {
                new Generator(argument).Generate();
                return;
            }

#if DEBUG
            argument =
                new AppArgument()
            {
                ProviderType     = DbProviderType.MySql,
                ConnectionString =
                    new MySql.Data.MySqlClient.MySqlConnectionStringBuilder()
                {
                    Server   = "localhost",
                    Database = "florida",
                    UserID   = "root",
                    Password = "******",
                }.ToString(),
                OutputDirectoryPath = "Entities",
                Namespace           = "VainZero.Florida",
            };
            new Generator(argument).Generate();
#endif
        }
Esempio n. 2
0
        bool TryParse(out AppArgument argument)
        {
            var parser = new Parser(s =>
            {
                s.ParsingCulture            = CultureInfo.InvariantCulture;
                s.CaseInsensitiveEnumValues = true;
                s.HelpWriter          = writer;
                s.MaximumDisplayWidth = width;
            });

            var resultBase = parser.ParseArguments <AppArgument>(args);

            switch (resultBase.Tag)
            {
            case ParserResultType.Parsed:
            {
                var result = (Parsed <AppArgument>)resultBase;
                argument = result.Value;
                return(true);
            }

            default:
            {
                var result = (NotParsed <AppArgument>)resultBase;
                writer.WriteLine(HelpText.AutoBuild(result, width));
                argument = default(AppArgument);
                return(false);
            }
            }
        }
Esempio n. 3
0
 public Generator(AppArgument argument)
 {
     Argument = argument;
 }