Beispiel #1
0
        public static IServiceCollection AddDownloadCenter(this IServiceCollection services,
                                                           Action <DownloadCenterBuilder> configure = null)
        {
            services.AddSingleton <IDownloadCenter, DownloadCenter>();

            DownloadCenterBuilder downloadCenterBuilder = new DownloadCenterBuilder(services);

            configure?.Invoke(downloadCenterBuilder);

            return(services);
        }
        public static DotnetSpiderBuilder AddDownloaderCenter(this DotnetSpiderBuilder builder,
                                                              Action <DownloadCenterBuilder> configure = null)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Services.AddSingleton <IDownloadCenter, LocalDownloadCenter>();

            DownloadCenterBuilder downloadCenterBuilder = new DownloadCenterBuilder(builder.Services);

            configure?.Invoke(downloadCenterBuilder);

            return(builder);
        }
 public static DownloadCenterBuilder UseMemoryDownloaderAgentStore(this DownloadCenterBuilder builder)
 {
     Check.NotNull(builder, nameof(builder));
     builder.Services.AddSingleton <IDownloaderAgentStore, LocalDownloaderAgentStore>();
     return(builder);
 }
Beispiel #4
0
 public static DownloadCenterBuilder UseMySqlDownloaderAgentStore(this DownloadCenterBuilder builder)
 {
     builder.Services.AddSingleton <IDownloaderAgentStore, MySqlDownloaderAgentStore>();
     return(builder);
 }