Ejemplo n.º 1
0
 private void GetOneUrlandnagative()
 {
     try
     {
         //保存文件
         string       name     = ListCItyUrl.SingleOrDefault(a => a.Value == GetUrl()).Key;
         List <House> housList = CItyhouseList.Where(a => a.IsSearch == false).OrderBy(a => a.ID).ToList();
         ShowLoadddingMsg(housList.Count + "/" + CItyhouseList.Count);
         if (housList.Count > 0)
         {
             House hous = housList[0];
             if (hous.urll.Length > 0)
             {
                 this.Browser.Navigate(hous.urll);
                 hous.IsSearch = true;
             }
         }
     }
     catch (Exception ex)
     {
         Log.logger(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 2
0
        void Browser_DocumentCompleted_xiangxi(object sender, EventArgs e)
        {
            GeckoWebBrowser br = sender as GeckoWebBrowser;

            if (br.Url.ToString() == "about:blank")
            {
                GetOneUrlandnagative(); return;
            }
            System.GC.Collect();
            try
            {
                ShowClickMsg("开始加载每个楼盘的数据 " + br.Url.ToString());

                foreach (Skybound.Gecko.GeckoElement a in br.Document.Links)
                {
                    if (
                        a.Parent != null &&
                        a.Parent.TagName != null &&
                        a.Parent.TagName.ToLower() == "li" &&
                        a.Parent.Parent != null &&
                        a.Parent.Parent.TagName != null &&
                        a.Parent.Parent.TagName.ToLower() == "ul" &&
                        a.Parent.Parent.Parent != null &&
                        a.Parent.Parent.Parent.ClassName != null &&
                        a.Parent.Parent.Parent.ClassName == "blockLA" &&
                        a.Parent.Parent.Parent.Parent != null &&
                        a.Parent.Parent.Parent.Parent.ClassName != null &&
                        a.Parent.Parent.Parent.Parent.ClassName == "l"
                        &&
                        a.Parent.Parent.Parent.Parent.Parent != null &&
                        a.Parent.Parent.Parent.Parent.Parent.ClassName != null &&
                        a.Parent.Parent.Parent.Parent.Parent.ClassName == "area"
                        &&
                        a.Parent.Parent.Parent.Parent.Parent.Id == "contentB"
                        )
                    {
                        House house = CItyhouseList.Where(item => item.urll == br.Url.ToString()).ToList()[0];
                        if (house != null)
                        {
                            house.IsSearch = true;
                        }
                        else
                        {
                            GetOneUrlandnagative(); return;
                        }
                        if (house != null)
                        {
                            Skybound.Gecko.GeckoElement divinfoo = (Skybound.Gecko.GeckoElement)a.Parent.Parent.Parent.Parent.Parent;

                            Skybound.Gecko.GeckoNode divclass111 = (Skybound.Gecko.GeckoNode)divinfoo.ChildNodes[1];
                            Skybound.Gecko.GeckoNode divblockaaa = (Skybound.Gecko.GeckoNode)divclass111.ChildNodes[1];
                            Skybound.Gecko.GeckoNode ulll1       = (Skybound.Gecko.GeckoNode)divblockaaa.ChildNodes[1];
                            house.updateTime = ((Skybound.Gecko.GeckoNode)ulll1.ChildNodes[1]).ChildNodes[1].TextContent;
                            house.AlongArea  = ((Skybound.Gecko.GeckoNode)ulll1.ChildNodes[5]).TextContent.Replace("所属片区:", "");

                            Skybound.Gecko.GeckoNode divblockBBBB = (Skybound.Gecko.GeckoNode)divclass111.ChildNodes[3];
                            Skybound.Gecko.GeckoNode ulllBBBB     = (Skybound.Gecko.GeckoNode)divblockBBBB.ChildNodes[1];
                            house.Jiaotong   = ((Skybound.Gecko.GeckoNode)ulllBBBB.ChildNodes[1]).TextContent.Replace("周围交通:", "");
                            house.opentime   = ((Skybound.Gecko.GeckoNode)ulllBBBB.ChildNodes[3]).TextContent.Replace("开盘时间:", "");
                            house.LiveIntime = ((Skybound.Gecko.GeckoNode)ulllBBBB.ChildNodes[5]).TextContent.Replace("入住时间:", "");
                        }



                        string name = ListCItyUrl.SingleOrDefault(item => item.Value == GetUrl()).Key;
                        Log.Datalogger(house.ID + "," + GetRightString(house.Name.Replace(",", "、")) + "," + GetRightString(house.HouseType.Replace(",", "、")) + "," + house.Price + "," + GetRightString(house.Danwei) + "," + GetRightString(house.phones.Replace(",", "、")) + "," + GetRightString(house.AlongArea.Replace(",", "、")) + "," +
                                       house.address.Replace(",", "、").Replace("查看地图", "") + "," + GetRightString(house.Kaifangshang.Replace(",", "、")) + "," + GetRightString(house.Jiaotong.Replace(",", "、")) + "," +
                                       GetRightString(house.opentime.Replace(",", "、")) + "," + GetRightString(house.LiveIntime.Replace(",", "、")) + "," + GetRightString(house.updateTime.Replace(",", "、")) + "," + GetRightString(house.wuyeleixing.Replace(",", "、")), name);
                        break;
                    }
                }
                GetOneUrlandnagative();
            }
            catch (Exception ex)
            {
                Log.logger(ex.Message + ex.StackTrace);
                GetOneUrlandnagative();
            }
        }