Beispiel #1
0
        static void Main(string[] args)
        {
            //Regex mReg = new Regex(@"<a\s+href=""member\.php\?uid=(?<ID>\d+)""[^>]*>\s*(?<NAME>[^<>]+)\s*</a>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            //string content = System.IO.File.ReadAllText(@"e:\f_545.txt");
            //MatchCollection matches = mReg.Matches(content.ToString());
            //foreach (Match m in matches)
            //{
            //    if (!m.Success)
            //    {
            //        continue;
            //    }
            //    string uid = m.Groups["ID"].Value;
            //    string uname = m.Groups["NAME"].Value;
            //    //if (!list.ContainsKey(uid))
            //    //{
            //    //    list.Add(uid, uname);
            //    //}

            //    Console.WriteLine("ID={0},Name='{1}'", uid, uname);
            //}


            //MySqlHelper db = DbHelper.CreateMySqlHelper("host=localhost;database=liba_user;uid=root;pwd=123456;charset=utf8") as MySqlHelper;
            //using (System.Data.Common.DbDataReader reader = db.ExecuteReader("SELECT uid,uname from users order by uid asc",System.Data.CommandBehavior.CloseConnection))
            //{
            //    while (reader.Read())
            //    {
            //        //FinalUrl url = Url.CreateFinalUrl(String.Format(""), null);
            //        Console.WriteLine("UID={0},UNAME={1}",reader.GetInt64(0),reader.GetString(1));
            //    }
            //}
            //while (true)
            //{
            //    Thread.Sleep(200);
            //}

            SpiderBase spider = new LibaSpider(new LibaSetting2(), new FileBasedUrlManager(@".\liba.urls"));

            spider.Start();

            while (spider.Status == SpiderBase.SpiderRunStatus.Running)
            {
                Thread.Sleep(200);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //Regex mReg = new Regex(@"<a\s+href=""member\.php\?uid=(?<ID>\d+)""[^>]*>\s*(?<NAME>[^<>]+)\s*</a>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            //string content = System.IO.File.ReadAllText(@"e:\f_545.txt");
            //MatchCollection matches = mReg.Matches(content.ToString());
            //foreach (Match m in matches)
            //{
            //    if (!m.Success)
            //    {
            //        continue;
            //    }
            //    string uid = m.Groups["ID"].Value;
            //    string uname = m.Groups["NAME"].Value;
            //    //if (!list.ContainsKey(uid))
            //    //{
            //    //    list.Add(uid, uname);
            //    //}

            //    Console.WriteLine("ID={0},Name='{1}'", uid, uname);
            //}

            //MySqlHelper db = DbHelper.CreateMySqlHelper("host=localhost;database=liba_user;uid=root;pwd=123456;charset=utf8") as MySqlHelper;
            //using (System.Data.Common.DbDataReader reader = db.ExecuteReader("SELECT uid,uname from users order by uid asc",System.Data.CommandBehavior.CloseConnection))
            //{
            //    while (reader.Read())
            //    {
            //        //FinalUrl url = Url.CreateFinalUrl(String.Format(""), null);
            //        Console.WriteLine("UID={0},UNAME={1}",reader.GetInt64(0),reader.GetString(1));
            //    }
            //}
            //while (true)
            //{
            //    Thread.Sleep(200);
            //}

            SpiderBase spider = new LibaSpider(new LibaSetting2(), new FileBasedUrlManager(@".\liba.urls"));
            spider.Start();

            while (spider.Status == SpiderBase.SpiderRunStatus.Running)
            {
                Thread.Sleep(200);
            }
        }