コード例 #1
0
        private async Task UpdateAsync(ReportName name, Func <string, IVisitor> getVisitor)
        {
            _logger.LogInformation("Updating report {Name}.", name);

            using (_logger.Indent())
            {
                var cursorProvider = new CursorFactory(
                    cursorSuffix: $"report.{name}",
                    defaultCursorValue: _defaultCursorValue,
                    logger: _logger);

                var csvPath = Path.Combine(_config.DataDirectory, "reports", $"{name}.csv");

                var downloader = new Downloader(
                    _httpClient,
                    _config,
                    cursorProvider,
                    getVisitor(csvPath),
                    _logger);

                await downloader.DownloadAsync();
            }
        }
コード例 #2
0
        public static async Task ExecuteAsync(
            HttpClient httpClient,
            string serviceIndexUrl,
            string dataDir,
            DownloadDepth depth,
            JsonFormatting jsonFormatting,
            int?maxPages,
            int?maxCommits,
            bool formatPaths,
            int parallelDownloads,
            IDepthLogger logger)
        {
            var cursorProvider = new CursorFactory(
                cursorSuffix: $"download.{depth}",
                defaultCursorValue: DateTimeOffset.MinValue,
                logger: logger);

            var downloader = new Downloader(
                httpClient,
                new DownloaderConfiguration
            {
                ServiceIndexUrl   = serviceIndexUrl,
                DataDirectory     = dataDir,
                Depth             = depth,
                JsonFormatting    = jsonFormatting,
                MaxPages          = maxPages,
                MaxCommits        = maxCommits,
                SaveToDisk        = true,
                FormatPaths       = formatPaths,
                ParallelDownloads = parallelDownloads,
            },
                cursorProvider,
                NullVisitor.Instance,
                logger);

            await downloader.DownloadAsync();
        }