static void Main(string[] args) { var url = "http://proxysearcher.sourceforge.net/Proxy%20List.php?type=http&filtered=true&limit=1000"; ISearchEngine searchEngine = new ParallelSearchEngine(new UrlListSearchEngine(url), new GoogleSearchEngine(40, "http proxy list", null)); IProxyChecker checker = new ProxyCheckerByUrl<HttpProxyDetailsProvider>("http://wikipedia.org/", 0.9, 100); IHttpDownloaderContainer httpDownloaderContainer = new HttpDownloaderContainer<HttpClientHandler, ProgressMessageHandler>(); Application application = new Application(searchEngine, checker, httpDownloaderContainer); application.ProxyAlive += application_ProxyAlive; application.OnError += exception => Console.WriteLine(exception.Message); application.SearchAsync().GetAwaiter().GetResult(); }
public Application Create(TaskItem task, ProxySearchFeedback feedback) { Context.Set(new CancellationTokenSource()); Context.Set<IHttpDownloaderContainer>(HttpDownloaderContainer); task.UpdateDetails(Resources.ReadingConfigurationOfSelectedSearch); IDetectable searchEngineDetectable = DetectableManager.CreateDetectableInstance<ISearchEngine>(Settings.SelectedTabSettings.SearchEngineDetectableType); IDetectable proxyCheckerDetectable = DetectableManager.CreateDetectableInstance<IProxyChecker>(Settings.SelectedTabSettings.ProxyCheckerDetectableType); IDetectable geoIPDetectable = DetectableManager.CreateDetectableInstance<IGeoIP>(Settings.GeoIPDetectableType); ISearchEngine searchEngine = DetectableManager.CreateImplementationInstance<ISearchEngine>(searchEngineDetectable, Settings.SelectedTabSettings.SearchEngineSettings, searchEngineDetectable.InterfaceSettings); feedback.ExportAllowed = !(searchEngine is FolderSearchEngine); task.UpdateDetails(Resources.PreparingProxyProvider); IProxyProvider proxyProvider = new ProxyProvider(Context.Get<IBlackList>(), new ParseMethodsProvider(Settings.ParseDetails)); task.UpdateDetails(Resources.PreparingProxyChecker); IProxyChecker proxyChecker = DetectableManager.CreateImplementationInstance<IProxyChecker>(proxyCheckerDetectable, Settings.SelectedTabSettings.ProxyCheckerSettings, proxyCheckerDetectable.InterfaceSettings); task.UpdateDetails(Resources.PreparingGeoIpService); IGeoIP geoIP = DetectableManager.CreateImplementationInstance<IGeoIP>(geoIPDetectable, Settings.GeoIPSettings, geoIPDetectable.InterfaceSettings); task.UpdateDetails(Resources.PreparingApplication); Application application = new Application(searchEngine, proxyChecker, HttpDownloaderContainer, geoIP, proxyProvider, Context.Get<ITaskManager>()); application.ProxyAlive += feedback.OnAliveProxy; application.OnError += Context.Get<IErrorFeedback>().SetException; return application; }