コード例 #1
0
        /// <summary>
        /// Returns a configured ServiceCollection.
        /// </summary>
        public ServiceCollection Create()
        {
            ValidateConfigurations();

            var services = new ServiceCollection();

            services.AddLogging(_loggingConfig);

            var dataPath = new DataDirectoryPath(_rootDataPath);

            var throttle = new WebRequestThrottle(
                _webRequestConfig.ThrottleMilliseconds,
                _webRequestConfig.RandomizedThrottle);

            var programOptions = _programOptions ?? new ProgramOptions();

            services
            .AddScoped(sp => dataPath)
            .AddScoped(sp => _webRequestConfig)
            .AddScoped(sp => throttle)
            .AddScoped <LatestWeekValue>()
            .AddScoped <AvailableWeeksValue>()
            .AddScoped <ProgramOptions>(sp => programOptions)
            .AddScoped <IDatabaseProvider>(sp =>
            {
                var logger = sp.GetRequiredService <IAppLogger>();
                return(_dbProviderFactory(logger));
            })
            .AddScoped <IWebRequestClient, WebRequestClient>()
            .AddCoreDataSources()
            .AddAsyncLazyCache();

            return(services);
        }
コード例 #2
0
        public NtStatus GetFileInformation(Path path, out FileInformation fileInfo, IDokanFileInfo info)
        {
            fileInfo = default;
            return(path switch
            {
                // Dirs
                RootPath p => GetFileInformation(p, out fileInfo),
                DatabasePath p => GetFileInformation(p, out fileInfo),
                CollectionPath p => GetFileInformation(p, out fileInfo),
                DataDirectoryPath p => GetFileInformation(p, out fileInfo),
                QueryDirectoryPath p => GetFileInformation(p, out fileInfo),
                QueryEmptyDirectoryPath p => GetFileInformation(p, out fileInfo),

                // Files
                StatsPath p => GetFileInformation(p, out fileInfo),
                IndexesPath p => GetFileInformation(p, out fileInfo),
                CurrentOpPath p => GetFileInformation(p, out fileInfo),
                ServerStatusPath p => GetFileInformation(p, out fileInfo),
                BuildInfoPath p => GetFileInformation(p, out fileInfo),
                HostInfoPath p => GetFileInformation(p, out fileInfo),
                ListCommandsPath p => GetFileInformation(p, out fileInfo),
                DataDocumentPath p => GetFileInformation(p, out fileInfo),
                QueryDocumentPath p => GetFileInformation(p, out fileInfo),
                QueryAllDocumentsPath p => GetFileInformation(p, out fileInfo),

                var p => LogFailure(p)
            });
コード例 #3
0
 protected CoreDataSource(
     IAppLogger logger,
     IAsyncMapper <string, TVersionedModel, TKey> toVersionedMapper,
     IAsyncMapper <TVersionedModel, TCoreData, TKey> toCoreMapper,
     ProgramOptions programOptions,
     DataDirectoryPath dataPath,
     IWebRequestClient webClient)
 {
     _logger            = logger;
     _toVersionedMapper = toVersionedMapper;
     _toCoreMapper      = toCoreMapper;
     _programOptions    = programOptions;
     DataPath           = dataPath;
     _webClient         = webClient;
 }
コード例 #4
0
        public NtStatus FindFilesWithPattern(Path path, string?searchPattern, out IList <FileInformation> files,
                                             IDokanFileInfo info)
        {
            files = Array.Empty <FileInformation>();
            return(path switch
            {
                RootPath p => FindFilesWithPattern(p, searchPattern, out files),
                DatabasePath p => FindFilesWithPattern(p, searchPattern, out files),
                CollectionPath p => FindFilesWithPattern(p, searchPattern, out files),
                DataDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),
                QueryDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),
                QueryEmptyDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),

                var p => LogFailure(path)
            });
コード例 #5
0
 public WeekMatchupSource(
     IAppLogger logger,
     IToVersionedMapper toVersionedMapper,
     IToCoreMapper toCoreMapper,
     ProgramOptions programOptions,
     DataDirectoryPath dataPath,
     IWebRequestClient webClient)
     : base(
         logger,
         toVersionedMapper,
         toCoreMapper,
         programOptions,
         dataPath,
         webClient)
 {
 }
コード例 #6
0
ファイル: PlayerAddSource.cs プロジェクト: zaawilli/FFDB
 public PlayerAddSource(
     IRosterCache rosterCache,
     IAppLogger logger,
     IToVersionedMapper toVersionedMapper,
     IToCoreMapper toCoreMapper,
     ProgramOptions programOptions,
     DataDirectoryPath dataPath,
     IWebRequestClient webClient)
     : base(
         logger,
         toVersionedMapper,
         toCoreMapper,
         programOptions,
         dataPath,
         webClient)
 {
     _rosterCache = rosterCache;
 }