private void DoBeginSearch() { ProxySearchFeedback feedback = new ProxySearchFeedback(); using (TaskItem taskItem = Context.Get<ITaskManager>().Create(Properties.Resources.SearchInitialization)) { Engine.Application application = new ProxySearchEngineApplicationFactory().Create(taskItem, feedback); Task task = application.SearchAsync(Context.Get<CancellationTokenSource>()); } }
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, Context.Get <IRatingManager>(), proxyProvider, Context.Get <ITaskManager>()); application.ProxyAlive += feedback.OnAliveProxy; application.OnError += Context.Get <IErrorFeedback>().SetException; return(application); }
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; }