public PageService(IImageAnalysisService imageAnalysisService, IMasterPageRepository masterPageRepository, IPageRepository pageRepository, IPageValidator pageValidator, IStorageService storageService) { _imageAnalysisService = imageAnalysisService; _masterPageRepository = masterPageRepository; _pageRepository = pageRepository; _pageValidator = pageValidator; _storageService = storageService; }
/// <summary> /// Constructor sets dependent components. /// </summary> /// <param name="elementService">For element interactions.</param> /// <param name="imageAnalysisService">Used to retrieve image properties from uploaded files and resize images.</param> /// <param name="masterPageRepository">Master page repository.</param> /// <param name="masterPageService">Master page service.</param> /// <param name="pageRepository">Page repository.</param> /// <param name="pageValidator">Page validator.</param> /// <param name="unitOfWorkFactory">Unit of work factory.</param> /// <param name="uploadService">For the management of uploads.</param> public PageService(IElementService elementService, IImageAnalysisService imageAnalysisService, IMasterPageRepository masterPageRepository, IMasterPageService masterPageService, IPageRepository pageRepository, IPageValidator pageValidator, IUnitOfWorkFactory unitOfWorkFactory, IUploadService uploadService) { _elementService = elementService; _imageAnalysisService = imageAnalysisService; _masterPageRepository = masterPageRepository; _masterPageService = masterPageService; _pageRepository = pageRepository; _pageValidator = pageValidator; _unitOfWorkFactory = unitOfWorkFactory; _uploadService = uploadService; }
public Devourer(List<DevourTarget> initialTargets, IProxyProvider proxies, IPageValidator validator = null) { if (initialTargets == null || initialTargets.Count == 0 /*|| reader == null */ || proxies == null) throw new ArgumentException("Bad arguments"); PreventSimilarTargetDownload = false; CookieOptions = CookieOptions.Empty; _proxies = proxies; _validator = validator; _successTargets = new List<Uri>(); _faultTargets = new List<DevourTarget>(); _allTargets = new HashSet<string>(); InitializeStartTargets(initialTargets); SubscribeProxyProvider(); }
public Devourer(List <DevourTarget> initialTargets, IProxyProvider proxies, IPageValidator validator = null) { if (initialTargets == null || initialTargets.Count == 0 /*|| reader == null */ || proxies == null) { throw new ArgumentException("Bad arguments"); } PreventSimilarTargetDownload = false; CookieOptions = CookieOptions.Empty; _proxies = proxies; _validator = validator; _successTargets = new List <Uri>(); _faultTargets = new List <DevourTarget>(); _allTargets = new HashSet <string>(); InitializeStartTargets(initialTargets); SubscribeProxyProvider(); }
private bool TryCheckDownloadSpeed(RatedProxy proxy, Uri uri, IPageValidator validator, ref double siteRate, ref double downloadSpeed) { Stopwatch timer = new Stopwatch(); for (int i = 0; i < 3; i++) { DownloaderObj obj = new DownloaderObj(uri, null, true, proxy, CookieOptions.Empty, 1); timer.Restart(); Downloader.DownloadSync(obj); timer.Stop(); string data = obj.DataStr; if (data != null) { if (validator.Validate(data)) { siteRate = (1 - i / 3d); int leng = Encoding.UTF8.GetBytes(data).Length; downloadSpeed = Encoding.UTF8.GetBytes(data).Length / (double)timer.ElapsedMilliseconds; //KB-sec return(true); } } } return(false); }
//RequestParams _params; public Devourer(DevourTarget initialTarget, IProxyProvider proxies, IPageValidator validator = null) : this(new List<DevourTarget>(new DevourTarget[] { initialTarget }), proxies, validator) { }
internal void RegisterPageValidator(IPageValidator pageValidator) { this.pageValidators.Add(pageValidator); }
private bool TryCheckDownloadSpeed(RatedProxy proxy, Uri uri, IPageValidator validator, ref double siteRate, ref double downloadSpeed) { Stopwatch timer = new Stopwatch(); for (int i = 0; i < 3; i++) { DownloaderObj obj = new DownloaderObj(uri, null, true, proxy, CookieOptions.Empty, 1); timer.Restart(); Downloader.DownloadSync(obj); timer.Stop(); string data = obj.DataStr; if (data != null) { if (validator.Validate(data)) { siteRate = (1 - i / 3d); int leng = Encoding.UTF8.GetBytes(data).Length; downloadSpeed = Encoding.UTF8.GetBytes(data).Length / (double)timer.ElapsedMilliseconds; //KB-sec return true; } } } return false; }
ConcurrentQueue <DevourTarget> _targets; /* KEY -- faultCount, VALUE -- targetUri */ //RequestParams _params; public Devourer(DevourTarget initialTarget, IProxyProvider proxies, IPageValidator validator = null) : this(new List <DevourTarget>(new DevourTarget[] { initialTarget }), proxies, validator) { }
public AuthorModel(IAuthorRepository repository, IDateValidator dateValidator, IPageValidator pageValidator) { _repository = repository; _dateValidator = dateValidator; _pageValidator = pageValidator; }