/// <summary> /// 启动删除线程 /// </summary> /// <param name="path">config路径</param> public void Delete(string path) { log.Info("启动删除线程"); //从config中载入各个节点信息 _xo.ShowShareXml(path, out lxs); lxscount = lxs.Count; _xo.ShowFtpXml(path, out lxf); lxfcount = lxf.Count; foreach (var item in lxs) { //建立委托 ShareCrawlDelegate myDelegate = new ShareCrawlDelegate(ShareDelStart); //启动共享文件夹本地与远程同步删除检查线程 myDelegate.BeginInvoke(item.StartIP, item.EndIP, new AsyncCallback(ShareDelCompleted), null); } foreach (var item in lxf) { //建立委托 FtpCrawlDelegate myDelegate = new FtpCrawlDelegate(FtpDelStart); //启动Ftp本地与远程同步删除检查线程 myDelegate.BeginInvoke(item.Link, item.UserName, item.UserPassword, new AsyncCallback(FtpDelCompleted), null); } }
private delegate int ShareMethodCaller(string startIP, string endIP); //定义个代理 #region 爬虫 /// <summary> /// 启动所有爬虫的线程 /// </summary> /// <param name="path">config路径</param> public void Build(string path) { log.Info("启动所有控制爬虫的线程"); //从config中载入各个节点信息 _xo.ShowShareXml(path, out lxs); lxscount = lxs.Count; _xo.ShowFtpXml(path, out lxf); lxfcount = lxf.Count; _xo.ShowWebXml(path, out lxw); lxwcount = lxw.Count; //如果共享文件夹有内容 if (lxs.Count != 0) { foreach (var item in lxs) { //建立委托 ShareCrawlDelegate myDelegate = new ShareCrawlDelegate(ShareCrawlStart); //启动共享文件夹网段爬虫线程 myDelegate.BeginInvoke(item.StartIP, item.EndIP, new AsyncCallback(ShareCrawlCompleted), null); } } //如果Ftp有内容 if (lxf.Count != 0) { foreach (var item in lxf) { //建立委托 FtpCrawlDelegate myDelegate = new FtpCrawlDelegate(FtpCrawlStart); //启动Ftp网段爬虫线程 myDelegate.BeginInvoke(item.Link, item.UserName, item.UserPassword, new AsyncCallback(FtpCrawlCompleted), null); } } //如果Web爬虫有内容 if (lxw.Count != 0) { foreach (var item in lxw) { //建立委托 WebCrawlDelegate myDelegate = new WebCrawlDelegate(WebCrawlStart); //启动Web网段爬虫线程 myDelegate.BeginInvoke(item.Link, new AsyncCallback(WebCrawlCompleted), null); } } }