Dashing.Console.Program.InnerMain C# (CSharp) Method

InnerMain() private static method

private static InnerMain ( string args ) : void
args string
return void
        private static void InnerMain(string[] args) {
            var options = new CommandLineOptions();

            if (!Parser.Default.ParseArguments(args, options)) {
                ShowHelpText(options);
                return;
            }

            isVerbose = options.Verbose;

            // weaving
            if (options.Weave) {
                if (string.IsNullOrWhiteSpace(options.WeaveDir)) {
                    throw new CatchyException("You must specify the directory to weave");
                }

                if (!options.IgnorePeVerify) {
                    TryFindIgnoreConfigSetting(options);
                }

                var task = new ExtendDomainTask {
                    LaunchDebugger = options.LaunchDebugger,
                    WeaveDir = options.WeaveDir,
                    Logger = new ConsoleLogger(options.Verbose),
                    IgnorePEVerify = options.IgnorePeVerify
                };
                if (!task.Execute()) {
                    throw new CatchyException("Weaving failed");
                }

                return;
            }

            // prevalidation
            if (string.IsNullOrWhiteSpace(options.ConfigPath)) {
                throw new CatchyException("You must specify a configuration path or a project name");
            }

            if (!File.Exists(options.ConfigPath)) {
                throw new CatchyException("Could not locate configuration file {0}", options.ConfigPath);
            }

            // dependency init
            consoleAnswerProvider = new ConsoleAnswerProvider("~" + Path.GetFileNameWithoutExtension(options.ConfigPath) + ".answers");

            // parse all of the configuration stuffs
            ConnectionStringSettings connectionStringSettings;
            DashingSettings dashingSettings;
            ReverseEngineerSettings reverseEngineerSettings;
            ParseIni(options, out connectionStringSettings, out dashingSettings, out reverseEngineerSettings);

            // postvalidation
            if (!File.Exists(dashingSettings.PathToDll)) {
                throw new CatchyException("Could not locate {0}", dashingSettings.PathToDll);
            }

            // load the configuration NOW and try to inherit its version of Dashing, Dapper, etc
            var configAssembly = Assembly.LoadFrom(dashingSettings.PathToDll);
            GC.KeepAlive(configAssembly);
            configObject = LoadConfiguration(configAssembly, dashingSettings, connectionStringSettings);

            // now decide what to do
            if (options.Script) {
                DoScript(options.Location, options.Naive, connectionStringSettings, dashingSettings, reverseEngineerSettings);
            }
            else if (options.Seed) {
                DoSeed(connectionStringSettings);
            }
            else if (options.Migration) {
                DoMigrate(options.Naive, connectionStringSettings, dashingSettings, reverseEngineerSettings);
            }
            else if (options.ReverseEngineer) {
                DoReverseEngineer(options, dashingSettings, reverseEngineerSettings, connectionStringSettings);
            }
            else {
                ShowHelpText(options);
            }
        }