1.21;http://www.baidu.com;v1.2版

新版newshuadan升級專用


private Boolean login() {
            getUserInfo();
            string username = this.tbxloginid.Text.Trim();
            string password = this.tbxpwd.Text.Trim();

            if (list != null)
            {
                if (list[0] == "nologin")
                {
                    return false;
                }
                else {
                    if (list[0] == username && list[1] == password)
                    {
                        return true;
                    }
                    else {
                        return false;
                    }
                }
            }
            else {
                return false;
            }
        }

        private List<string> getUserInfo() {
            

            try
            {
                string url = "http://blog.csdn.net/xiaokailele/article/details/48521517";
                string content = getInfo.GetStrHtml(url, false);
                if (content != null)
                {

                    string[] str = getInfo.gettd(content, "//span[@class='link_title']")[0].InnerText.Split(';');
                    list.Add(str[0].Replace("\r\n","").Trim());
                    list.Add(str[1].Replace("\r\n", "").Trim());
                }
            }
            catch (Exception ex) { }

            return list;
        }

然後winform程序調用

if (login())
                {
                    Form1 frm1 = new Form1();
                    frm1.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("用戶口令錯誤");
                }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章