/// <summary> /// 检查网络 /// </summary> /// <param name="builder"></param> /// <returns></returns> public static DownloadAgentBuilder UseDefaultInternetDetector(this DownloadAgentBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Services.AddSingleton <IInternetDetector, DefaultInternetDetector>(); return(builder); }
/// <summary> /// /// </summary> /// <param name="builder"></param> /// <returns></returns> public static DownloadAgentBuilder UseFileLocker(this DownloadAgentBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Services.AddSingleton <ILockerFactory, FileLockerFactory>(); return(builder); }
public static DownloadAgentBuilder UseDefaultAdslRedialer(this DownloadAgentBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Services.AddSingleton <IAdslRedialer, DefaultAdslRedialer>(); return(builder); }
/// <summary> /// 注入事件下载代理器 /// </summary> /// <param name="services">注入服务</param> /// <param name="configure">相关配置委托事件</param> /// <returns></returns> public static IServiceCollection AddDownloadAgent(this IServiceCollection services, Action <DownloadAgentBuilder> configure = null) { services.AddSingleton <IHostedService, DefaultDownloadAgent>(); //services.AddSingleton<NetworkCenter>(); services.AddSingleton <DownloadAgentOptions>(); DownloadAgentBuilder spiderAgentBuilder = new DownloadAgentBuilder(services); configure?.Invoke(spiderAgentBuilder); return(services); }