예제 #1
0
        /// <summary>
        /// 共享文件夹本地与远程同步删除检查线程
        /// </summary>
        /// <param name="startip">起始ip</param>
        /// <param name="endip">结束ip</param>
        /// <returns></returns>
        private static int ShareDelStart(string startip, string endip)
        {
            ShareCrawl sc = new ShareCrawl();

            sc.startip = startip;
            sc.endip   = endip;
            log.Info("启动共享文件夹本地与远程同步删除检查线程" + startip);
            Thread tr = new Thread(sc.CheckExist); //启动子线程

            tr.Start();
            while (true)
            {
                if (!sc.flag)
                {
                    if (sc.QShareDel.Count != 0)               //若有删除
                    {
                        qsDel.Enqueue(sc.QShareDel.Dequeue()); //取出加入删除队列
                    }
                    else
                    {
                        lxsfin.Add(startip);    //完全爬完就加入结束列表并结束线程
                        log.Info("共享文件夹本地与远程同步删除检查线程结束" + startip);
                        return(1);
                    }
                }
                else
                {
                    if (sc.QShareDel.Count != 0)               //若有删除
                    {
                        qsDel.Enqueue(sc.QShareDel.Dequeue()); //取出加入删除队列
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 启动共享文件夹本地数据库同步检查线程
        /// </summary>
        /// <returns></returns>
        private static int ShareCheckStart()
        {
            ShareCrawl sc = new ShareCrawl();

            log.Info("启动共享文件夹本地数据库同步检查线程");
            Thread tr = new Thread(sc.Check); //启动子线程

            tr.Start();
            while (true)
            {
                if (!sc.flag)                    //若未结束
                {
                    if (sc.QShareChk.Count != 0) //取出加入检查队列
                    {
                        qsChk.Enqueue(sc.QShareChk.Dequeue());
                    }
                    else
                    {
                        log.Info("共享文件夹本地数据库同步检查线程结束");
                        return(1);
                    }
                }
                else
                {
                    if (sc.QShareChk.Count != 0)    //取出加入检查队列
                    {
                        qsChk.Enqueue(sc.QShareChk.Dequeue());
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 启动web爬虫线程
        /// </summary>
        /// <param name="startip">起始ip</param>
        /// <param name="endip">结束ip</param>
        /// <returns></returns>
        private static int ShareCrawlStart(string startip, string endip)
        {
            ShareCrawl sc = new ShareCrawl();

            sc.startip = startip;
            sc.endip   = endip;
            log.Info("启动共享文件夹爬虫的线程" + startip);
            Thread tr = new Thread(sc.StartCrawl);   //启动子线程

            tr.Start();
            while (true)
            {
                if (!sc.flag)                                                  //监控是否爬虫完成
                {
                    if (sc.QShareAdd.Count != 0 || sc.QShareUpdate.Count != 0) //若有新增或更新
                    {
                        if (sc.QShareAdd.Count != 0)
                        {
                            qsAdd.Enqueue(sc.QShareAdd.Dequeue());  //取出加入新增队列
                        }
                        else
                        {
                            qsUpd.Enqueue(sc.QShareUpdate.Dequeue()); //取出加入更新队列
                        }
                    }
                    else
                    {
                        lxsfin.Add(startip);    //完全爬完就加入结束列表并结束线程
                        log.Info("共享文件夹爬虫的线程结束" + startip);
                        return(1);
                    }
                }
                else
                {
                    if (sc.QShareAdd.Count != 0 || sc.QShareUpdate.Count != 0)  //若有新增或更新
                    {
                        if (sc.QShareAdd.Count != 0)
                        {
                            qsAdd.Enqueue(sc.QShareAdd.Dequeue());  //取出加入新增队列
                        }
                        else
                        {
                            qsUpd.Enqueue(sc.QShareUpdate.Dequeue()); //取出加入更新队列
                        }
                    }
                }
            }
        }