Пример #1
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            //选择账号登录
            string          savaPath = System.IO.Directory.GetCurrentDirectory() + @"\账号库\";
            string          user     = savaPath + this.metroComboBox1.Text;
            BinaryFormatter bf       = new BinaryFormatter();

            using (FileStream fs = new FileStream(user, FileMode.Open))
            {
                CookieContainer myCookieContainer = (CookieContainer)bf.Deserialize(fs); //反序列Cookie数据
                BiliHelper.Data.BiliCookie = myCookieContainer;                          //设置为全局Cookie
            }
            ToolsPage ToolsPageFrm = new ToolsPage();

            ToolsPageFrm.Show();
        }
Пример #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            string  host        = "https://passport.bilibili.com/qrcode/getLoginInfo";
            string  postData    = "oauthKey=" + oauthKey + "&gourl=https://passport.bilibili.com/account/security";
            JObject scanEndText = JObject.Parse(BiliHelper.BiliPostRequest(host, postData, out CookieContainer myCookieContainer));

            //判断扫码是否成功
            if (scanEndText["status"].ToString() == "True")
            {
                MessageBox.Show("扫码成功");
                BiliHelper.Data.BiliCookie = myCookieContainer;

                //进入工具主页
                ToolsPage toolsPageFrm = new ToolsPage();
                toolsPageFrm.Show();
                this.Hide();
                this.timer1.Stop();
            }
        }