Exemplo n.º 1
0
        static void Main(string[] args)
        {
            /*args = new string[] {"-configdir", @"C:\\Git\\Blog.GrenitausConsulting\\WebApi\\Blog.GrenitausConsulting.Core.Web.Api\\AppData",
             *  "-outputdir", @"C:\\Git\\Blog.GrenitausConsulting\\WebClient\\src", "-blogurl", "http://localhost:4200" };*/
            string path = Directory.GetCurrentDirectory();

            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(path);

            builder.Build();

            try
            {
                var serviceCollection = new ServiceCollection();
                ConfigureServices(serviceCollection);
                _logger = serviceCollection.BuildServiceProvider().GetService <ILogger <Program> >();
                _commandLineArgumentParseService      = serviceCollection.BuildServiceProvider().GetService <ICommandLineArgumentParseService>();
                _commandLineArgumentValidationService = serviceCollection.BuildServiceProvider().GetService <ICommandLineArgumentValidationService>();
                new Startup().Configure(args, _commandLineArgumentParseService, _commandLineArgumentValidationService);
            }
            catch (Exception ex)
            {
                _logger.LogInformation(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void Configure(string[] args, ICommandLineArgumentParseService commandLineArgumentParseService, ICommandLineArgumentValidationService commandLineArgumentValidationService)
        {
            _commandLineArgumentParseService      = commandLineArgumentParseService;
            _commandLineArgumentValidationService = commandLineArgumentValidationService;

            var commandLineArguments = BuildCommandLineArguments(args);

            if (!_commandLineArgumentValidationService.IsValid(commandLineArguments))
            {
                throw new Exception(_commandLineArgumentValidationService.Errors[0].Description);
            }

            ICLIService cliService = new CLIService(commandLineArguments);

            cliService.CLILogMessageProcessStatusChanged += Program.CLILogMessageHandler;
            cliService.Generate();
            cliService.CLILogMessageProcessStatusChanged -= Program.CLILogMessageHandler;
        }