예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //GridView1.DataSource = bll.GetScrollMatchList();
            //GridView1.DataBind();
            WebClient web       = WebClientBLL.getWebClient();
            string    s         = web.DownloadString("http://data.nowscore.com/detail/403052.html");
            Lexer     lexer     = new Lexer(s);
            Parser    parser    = new Parser(lexer);
            INode     tableNode = parser.Parse(new TagNameFilter("HTML"))[0].Children.ExtractAllNodesThatMatch(new TagNameFilter("BODY"))[0].Children[0];
            TableTag  tt        = tableNode as TableTag;

            Response.Write(tt.GetRow(0).Columns[0].Children[0].Children[0].ToPlainTextString());
            Response.Write(tt.GetRow(0).Columns[1].Children[0].Children[0].ToPlainTextString());
            Response.Write(tt.GetRow(0).Columns[2].Children[0].Children[0].ToPlainTextString());

            //ITag divNode = bodyNodes.ExtractAllNodesThatMatch(new TagNameFilter("FORM"))[0].Children.ExtractAllNodesThatMatch(new TagNameFilter("DIV"))[0] as ITag;
            //if (divNode.Attributes["ID"].Equals("PageBody"))
            //{
            //    NodeList dataDivList = divNode.Children.SearchFor(typeof(Winista.Text.HtmlParser.Tags.Div));

            //}
        }
    }
예제 #2
0
 private void ProcessXmlFile()
 {
     if (Request["path"] != null)
     {
         try
         {
             Response.ContentType     = "text/xml";
             Response.Buffer          = true; //完成整个响应后再发送
             Response.ContentEncoding = Encoding.UTF8;
             WebClient web = WebClientBLL.getWebClient();
             Response.Write(web.DownloadString(WebClientBLL.root + Request.QueryString["path"] + "?" + Request.QueryString["_t"]));
         }
         catch (Exception)
         {
         }
         Response.End();
     }
 }
예제 #3
0
    private DataTable FillOddsHistory(string[] odds)
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("odds_w", typeof(float));
        dt.Columns.Add("odds_d", typeof(float));
        dt.Columns.Add("odds_l", typeof(float));
        dt.Columns.Add("per_w", typeof(float));
        dt.Columns.Add("per_d", typeof(float));
        dt.Columns.Add("per_l", typeof(float));
        dt.Columns.Add("time", typeof(DateTime));
        WebClient web = WebClientBLL.getWebClient();
        string    s   = web.DownloadString("http://live.nowodds.com/1x2/OddsHistory.aspx?id=" + odds[1]);

        Parser parser = Parser.CreateParser(s, "utf-8");

        NodeList nodeList = parser.ExtractAllNodesThatMatch(new TagNameFilter("TR"));

        for (int i = 1; i < nodeList.Count; i++)
        {
            DataRow dr  = dt.NewRow();
            decimal w   = Convert.ToDecimal(nodeList[i].Children[0].ToPlainTextString());
            decimal d   = Convert.ToDecimal(nodeList[i].Children[1].ToPlainTextString());
            decimal l   = Convert.ToDecimal(nodeList[i].Children[2].ToPlainTextString());
            decimal ret = 1 / (1 / w + 1 / d + 1 / l);
            dr["odds_w"] = nodeList[i].Children[0].ToPlainTextString();
            dr["odds_d"] = nodeList[i].Children[1].ToPlainTextString();
            dr["odds_l"] = nodeList[i].Children[2].ToPlainTextString();
            dr["per_w"]  = 1 / w * ret;
            dr["per_d"]  = 1 / d * ret;
            dr["per_l"]  = 1 / l * ret;
            string[] t = nodeList[i].Children[3].ToPlainTextString().Replace("showtime(", "").Replace(")", "").Split(',');
            dr["time"] = new DateTime(int.Parse(t[0]), int.Parse(t[1].Split('-')[0]), int.Parse(t[2]), int.Parse(t[3]), int.Parse(t[4]), int.Parse(t[5])).AddHours(8);
            dt.Rows.Add(dr);
        }
        return(dt);
    }
예제 #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     WebClient web = WebClientBLL.getWebClient();
     string    s   = web.DownloadString(string.Format(HistoryDataURL, ""));
 }