示例#1
0
 public FileParserReportGenerator(TaleConfiguration configuration)
 {
     _configuration = configuration;
     if (string.IsNullOrEmpty(_configuration.InputFileName))
     {
         throw new ArgumentNullException(nameof(_configuration.InputFileName));
     }
     searchPhrase = _configuration.SearchKeyWord;
 }
示例#2
0
        private static void RegisterServices()
        {
            var            services       = new ServiceCollection();
            var            taleConfig     = new TaleConfiguration();
            IConfiguration talefiguration = new ConfigurationBuilder()
                                            .AddJsonFile("talesettings.json", optional: true, reloadOnChange: true)
                                            .AddEnvironmentVariables()
                                            .Build();

            talefiguration.Bind(TaleConfiguration.Position, taleConfig);
            services.AddSingleton(taleConfig);
            services.AddSingleton <IFileParseReportGenerator, FileParserReportGenerator>();
            services.AddSingleton <FileParserConsole>();

            _serviceProvider = services.BuildServiceProvider(true);
        }
示例#3
0
 public FileParserConsole(IFileParseReportGenerator fileParseReportGenerator, TaleConfiguration configuration)
 {
     _fileParseReportGenerator = fileParseReportGenerator;
     _configuration            = configuration;
 }