- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Text;
- using System.Net;
- using System.Net.Sockets;
- using System.Threading;
- /*
- ' 迅龙中文分类搜索引擎 v0.6
- '
- ' LGPL 许可发行
- '
- ' 宁夏大学 张冬 康彩 zd4004@163.com
- '
- ' 官网 http://blog.163.com/zd4004/
- */
- namespace XunLong.ConsoleSpiderOne
- {
- /// <summary>
- /// 单机本地蜘蛛
- /// </summary>
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine(" >------------------------------------------<");
- Console.WriteLine(" >------------------------------------------<");
- Console.WriteLine(" > 列表中文搜索引擎_组件v0.3 <");
- Console.WriteLine(" > 蜘蛛 <");
- Console.WriteLine(" >------------------------------------------<");
- Console.WriteLine(" >------------------------------------------<");
- string k_c_path = args[0];
- Console.WriteLine("--》加载配置文件: " + k_c_path);
- XunLong.CongifData.Config.InitConfigData(k_c_path);
- //URL 路径
- string pathi = "";
- //索引的路径
- string indexPath = "";
- string StartTime = DateTime.Now.ToString();
- Console.WriteLine(" ");
- Console.WriteLine("迅龙中文分类搜索引擎 蜘蛛 2006.8");
- Console.WriteLine("启动时间 " + StartTime);
- ClassSpiderMain n = new ClassSpiderMain();
- //开始蜘蛛
- n.StartMain( k_c_path);
- // n.initNEEDURL(XunLong.CongifData.Config.modelSource);
- n.IsRun = true;
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("输入 X 退出。。。");
- Console.WriteLine("");
- // 开启一个线程 运行
- Thread T1 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T1.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T2 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T2.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T3 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T3.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T4 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T4.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T5 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T5.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T6 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T6.Start();
- System.Threading.Thread.Sleep(1000);
- // 开启一个线程 运行
- Thread T7 = new Thread(new ThreadStart(n.ZhiZhuRun));
- T7.Start();
- System.Threading.Thread.Sleep(1000);
- Thread T8 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T8.Start();
- // System.Threading.Thread.Sleep(1000);
- Thread T9 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T9.Start();
- // System.Threading.Thread.Sleep(1000);
- Thread T10 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T10.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T11 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T11.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T12 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T12.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T13 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T13.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T14 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T14.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T15 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T15.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T16 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T16.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T17 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T17.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T18 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T18.Start();
- //// System.Threading.Thread.Sleep(1000);
- // Thread T19 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T19.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T20 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T20.Start();
- // System.Threading.Thread.Sleep(1000);
- // Thread T21 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T21.Start();
- // System.Threading.Thread.Sleep(1000);
- //// Thread T22 = new Thread(new ThreadStart(n.ZhiZhuRun));
- // T22.Start();
- // System.Threading.Thread.Sleep(1000);
- //等待一个输入
- while (true)
- {
- Console.ReadKey();
- Console.WriteLine("停止蜘蛛");
- // Console.ReadKey();
- // if ((a == "x") | (a == "X"))
- //{
- n.IsRun = false;
- T1.Abort();
- T2.Abort();
- T3.Abort();
- T4.Abort();
- T5.Abort();
- T6.Abort();
- T7.Abort();
- T8.Abort();
- T9.Abort();
- T10.Abort();
- // T11.Abort();
- // T12.Abort();
- // T13.Abort();
- // T14.Abort();
- // T15.Abort();
- // T16.Abort();
- // T17.Abort();
- // T18.Abort();
- // T19.Abort();
- // T20.Abort();
- // T21.Abort();
- // T22.Abort();
- Console.WriteLine("");
- Console.WriteLine("停止蜘蛛");
- //蜘蛛停止
- n.StopSpider();
- string EndTime = DateTime.Now.ToString();
- Console.WriteLine("");
- Console.WriteLine("启动时间 " + StartTime + " 结束时间 " + EndTime + " 此次总共下载 " + n.Num.ToString());
- Console.WriteLine("");
- Console.WriteLine("任意键关闭。。。");
- //显示统计信息
- Console.ReadKey();
- return;
- // }
- }
- }
- }
- }