예제 #1
0
        internal static IDataEnricher CreateKnowledgebase(Configuration config, ILogger logger)
        {
            var muteErrors = new DowngradeErrorLogger(logger.ForContext <NreKnowledgebase.FileSource>());
            var source     = new NreKnowledgebase.FileSource(new Dictionary <KnowedgebaseSubjects, string>()
            {
                { KnowedgebaseSubjects.Stations, config.StationsKnowledgebaseFile },
                { KnowedgebaseSubjects.Tocs, config.TocsKnowledgebaseFile }
            }, muteErrors);

            return(new KnowledgebaseLoader(new Knowledgebase(source, muteErrors), logger));
        }
예제 #2
0
        internal static async Task <IDataEnricher> CreateDarwinLoader(Configuration config, ILogger logger)
        {
            var muteErrors = new DowngradeErrorLogger(logger.ForContext <DarwinClient.FileSource>());
            var source     = new DarwinClient.FileSource(
                new DirectoryInfo(Configuration.DataDirectory), muteErrors);
            var darwin = new TimetableDownloader(source, muteErrors);

            var darwinLoader = new DarwinLoader(darwin, logger, config.DarwinDate);

            if (await darwinLoader.Initilise(CancellationToken.None).ConfigureAwait(false))
            {
                return(darwinLoader);
            }

            return(new NopLoader());
        }