Пример #1
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
//如果是DEBUG模式则显示调试按钮,切记编译时切换为Release
#if DEBUG
            btnDebug.Visible = true;
#endif
            try
            {
                Myhelp.getHtml("http://appimg2.qq.com/card/index_v3.html");
            }
            catch (Exception)
            {
                MessageBox.Show("未连接网络或者其它什么原因,反正不关我的事\r再见!!!!!!!!!!!!!!!!!!!!", "出错辣!");
                Environment.Exit(0);
            }
            webLoign.ScriptErrorsSuppressed         = true;                                                                                 //屏蔽脚本错误
            webLoign.IsWebBrowserContextMenuEnabled = false;                                                                                //禁用右键菜单
            webLoign.Navigate("http://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=1600000084&s_url=http://appimg2.qq.com/card/index_v3.html"); //跳转到登录页面
        }//载入窗口载入登录网站
Пример #2
0
        private void Load_Card()
        {
            this.FormBorderStyle = FormBorderStyle.None;
            this.Size            = new Size(327, 93);
            Rectangle rect = Screen.GetWorkingArea(this);     //获取显示器的分辨率

            this.Location     = new Point(rect.Width / 2 - this.Width / 2, rect.Height / 2 - this.Height / 2);
            lblState.Location = new Point(0, 0);
            #region 卡片信息处理
            string CARD_IFFO = Myhelp.getHtml("http://appimg2.qq.com/card/mk/card_info_v3.js");                                                           //有网时
            string CARD_MINI = Myhelp.postHtml("http://card.show.qq.com/cgi-bin/card_mini_get?g_tk=" + Mydata.Gtk, "uin=" + Mydata.Iuin, Mydata.Cookies); //已收集的套卡

            Regex           regStr = new Regex("id=\"(.*)\" num=\"(.*)\"", RegexOptions.IgnoreCase);                                                      //已收集套卡信息的正则
            MatchCollection mats   = regStr.Matches(CARD_MINI);


            regStr = new Regex(@"(\d{2,4}),'(.*|[\(].*[\)])',(\d),(\d{10}),.*\[(.*)\],(.),.*\d{10},(\d{1,10}),", RegexOptions.IgnoreCase); //套卡信息的正则
            MatchCollection mat = regStr.Matches(CARD_IFFO);
            for (int i = 0; i < mat.Count; i++)
            {
                int      id      = Convert.ToInt32(mat[i].Groups[1].ToString()); //--------------------
                string   name    = mat[i].Groups[2].ToString();
                int      diff    = Convert.ToInt32(mat[i].Groups[3].ToString());
                int      time    = Convert.ToInt32(mat[i].Groups[4].ToString()); //  各种的数据
                string   cards   = mat[i].Groups[5].ToString();
                int      type    = Convert.ToInt32(mat[i].Groups[6].ToString());
                int      offtime = Convert.ToInt32(mat[i].Groups[7].ToString());//----------------------
                MyMethod mmd     = delegate()
                {
                    #region 加载套卡 必须优化,代码乱的要死
                    bool xxx = false;
                    switch (type)
                    {
                    case 0:
                    case 2:
                        #region
                        xxx = false;
                        for (int x = 0; x < mats.Count; x++)
                        {
                            if (id == Convert.ToInt32(mats[x].Groups[1].ToString()))
                            {
                                xxx = true;
                                break;
                            }
                        }
                        if (xxx)
                        {
                            tvFX.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                            tvFX.Nodes[diff.ToString()].Nodes[0].BackColor        = Color.FromArgb(128, 255, 128);
                        }
                        else
                        {
                            tvFX.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                        }

                        #endregion
                        break;

                    case 1:
                    case 5:
                        #region
                        xxx = false;
                        for (int x = 0; x < mats.Count; x++)
                        {
                            if (id == Convert.ToInt32(mats[x].Groups[1].ToString()))
                            {
                                xxx = true;
                                break;
                            }
                        }
                        if (xxx)
                        {
                            tvXJ.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                            tvXJ.Nodes[diff.ToString()].Nodes[0].BackColor        = Color.FromArgb(128, 255, 128);
                        }
                        else
                        {
                            tvXJ.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                        }

                        #endregion
                        break;

                    case 9:
                        #region
                        xxx = false;
                        for (int x = 0; x < mats.Count; x++)
                        {
                            if (id == Convert.ToInt32(mats[x].Groups[1].ToString()))
                            {
                                xxx = true;
                                break;
                            }
                        }
                        if (xxx)
                        {
                            tvSK.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                            tvSK.Nodes[diff.ToString()].Nodes[0].BackColor        = Color.FromArgb(128, 255, 128);
                        }
                        else
                        {
                            tvSK.Nodes[diff.ToString()].Nodes.Insert(0, name).Tag = id;       //添加子节点的同时添加它的数据(ID)
                        }

                        #endregion
                        break;

                    default:
                        break;
                    }
                    #endregion
                };
                Invoke(mmd);
                _themeDic.Add(id, new ThemeTemplet(id, name, diff, time, cards, type, offtime)); //将信息存入该字典中
                //ds.Tables["Theme"].Rows.Add(new object[] { id, name });
            }
            regStr = new Regex(@"\[(.*),(.*),'(.*)',(\d{2,4}),", RegexOptions.IgnoreCase);//卡片信息的正则
            mat    = regStr.Matches(CARD_IFFO);
            for (int i = 0; i < mat.Count; i++)
            {
                int    id      = Convert.ToInt32(mat[i].Groups[1].ToString());
                int    themeid = Convert.ToInt32(mat[i].Groups[2].ToString());
                string name    = mat[i].Groups[3].ToString();
                int    price   = Convert.ToInt32(mat[i].Groups[4].ToString());
                _cardDic.Add(id, new CardTemplet(id, themeid, name, price));
            }


            tssState.BackColor = Color.FromArgb(128, 255, 128);
            tssState.Text      = "卡片信息加载完毕!!!";
            lblState.Visible   = false;
            #endregion
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.Size            = new Size(440, 408);
            cbTop.Left           = 366;
            this.Location        = new Point(rect.Width / 2 - this.Width / 2, rect.Height / 2 - this.Height / 2);
            lblHide.Enabled      = true;
            btnTst.Enabled       = true;
            Console.Beep();
            Debug.WriteLine(groupBox1.Location.Y);
        }//获取和载入卡片