public static AgentBuilder UseVpsInternetDetector(this AgentBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Services.AddSingleton <IInternetDetector, VpsInternetDetector>();

            return(builder);
        }
        public static AgentBuilder UseDefaultAdslRedialer(this AgentBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Services.AddSingleton <IAdslRedialer, DefaultAdslRedialer>();

            return(builder);
        }
        public static AgentBuilder UseFileLocker(this AgentBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Services.AddSingleton <ILockerFactory, FileLockerFactory>();

            return(builder);
        }
Esempio n. 4
0
        public static IServiceCollection AddLocalDownloaderAgent(this IServiceCollection services,
                                                                 Action <AgentBuilder> configure = null)
        {
            services.AddSingleton <IDownloaderAllocator, DownloaderAllocator>();
            services.AddSingleton <IDownloaderAgent, LocalDownloaderAgent>();
            services.AddSingleton <NetworkCenter>();
            services.AddScoped <IDownloaderAgentOptions, DownloaderAgentOptions>();

            AgentBuilder spiderAgentBuilder = new AgentBuilder(services);

            configure?.Invoke(spiderAgentBuilder);

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

            builder.Services.AddSingleton <IDownloaderAllocator, DownloaderAllocator>();
            builder.Services.AddSingleton <IDownloaderAgent, LocalDownloaderAgent>();
            builder.Services.AddSingleton <NetworkCenter>();
            builder.Services.AddScoped <IDownloaderAgentOptions, DownloaderAgentOptions>();

            AgentBuilder spiderAgentBuilder = new AgentBuilder(builder.Services);

            configure?.Invoke(spiderAgentBuilder);

            return(builder);
        }
 public static AgentBuilder UseMemoryDownloaderAgentStore(this AgentBuilder builder)
 {
     Check.NotNull(builder, nameof(builder));
     builder.Services.AddSingleton <IDownloaderAgentStore, LocalDownloaderAgentStore>();
     return(builder);
 }