public static void FirstAnalyzed(String WebUri, String DirPath) { urlfinishedcount = 0; finished = false; WebSiteDownloaderOptions options = new WebSiteDownloaderOptions(); //options.DownloadUri = // new Uri(@"http://sudarshannews.com/"); //options.DestinationFolderPath = // new DirectoryInfo(@"C:\Users\SATWADHIR PAWAR\Desktop\scrap"); options.DownloadUri = new Uri(WebUri); options.DestinationFolderPath = new DirectoryInfo(DirPath); WebSiteDownloader downloader = new WebSiteDownloader(options); downloader.ProcessingUrl += new WebSiteDownloader.ProcessingUrlEventHandler( downloader_ProcessingUrl); downloader.ProcessCompleted += new WebSiteDownloader.ProcessCompletedEventHandler( downloader_ProcessCompleted); downloader.ProcessAsync(); while (true) { Thread.Sleep(100); Console.WriteLine(@"."); urlfinishedcount += 1; if (urlfinishedcount == 200) { urlfinishedcount = 0; finished = true; } lock (typeof(ScrapperDemoStart)) { if (finished) { break; } } } Console.WriteLine(@"finished."); }//End FirstAnalyze
public static bool RunTheFirstAnalyze(string url, string folderpath) { WebSiteDownloaderOptions options = new WebSiteDownloaderOptions(); options.DownloadUri = new Uri(url); options.DestinationFolderPath = new DirectoryInfo(folderpath); WebSiteDownloader downloader = new WebSiteDownloader(options); downloader.ProcessingUrl += new WebSiteDownloader.ProcessingUrlEventHandler( downloader_ProcessingUrl); downloader.ProcessCompleted += new WebSiteDownloader.ProcessCompletedEventHandler( downloader_ProcessCompleted); downloader.ProcessAsync(); while (true) { Thread.Sleep(1000); Console.WriteLine(@"."); lock (typeof(Program)) { if (finished) { break; } } } Console.WriteLine(@"finished."); return finished; }
private static void Main( string[] args ) { WebSiteDownloaderOptions options = new WebSiteDownloaderOptions(); options.DownloadUri = new Uri(@"http://www.cadfolks.com"); options.DestinationFolderPath = new DirectoryInfo(@"F:\demo"); WebSiteDownloader downloader = new WebSiteDownloader( options ); downloader.ProcessingUrl += new WebSiteDownloader.ProcessingUrlEventHandler( downloader_ProcessingUrl ); downloader.ProcessCompleted += new WebSiteDownloader.ProcessCompletedEventHandler( downloader_ProcessCompleted ); downloader.ProcessAsync(); while ( true ) { Thread.Sleep( 1000 ); Console.WriteLine( @"." ); lock ( typeof( Program ) ) { if ( finished ) { break; } } } Console.WriteLine( @"finished." ); }