Beispiel #1
0
            public int Packets_Receive(string openid, string sign, string SID, string sn)
            {
                int    number;
                string url  = "https://h5.ele.me/restapi/marketing/promotion/weixin/" + openid;
                string data = "{\"method\":\"phone\",\"group_sn\":\"" + sn + "\",\"sign\":\"" + sign + "\"}";

                data   = HttpPost(url, data, "SID=" + SID);
                number = text.TextOccurrences(data, "sns_username");
                Console.WriteLine("当前已经领取" + number);
                return(number);
            }
Beispiel #2
0
        private void Form1_DragDrop(object sender, DragEventArgs e)
        {
            string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

            if (path.Substring(path.Length - 4) == ".txt")
            {
                GetText  text  = new GetText();
                string   data  = text.GetTxt(path);
                int      line  = text.TextOccurrences(data, Environment.NewLine);
                string[] data2 = text.DivisionText(data, Environment.NewLine);
                for (int i = 0; i < line; i++)
                {
                    try
                    {
                        ListViewItem listView = new ListViewItem();
                        string[]     data3    = text.DivisionText(data2[i], "----");
                        int          ID       = listView1.Items.Count + 1;
                        listView.Text = ID.ToString();
                        listView.SubItems.Add(data3[0]);
                        listView.SubItems.Add(data3[1]);
                        listView.SubItems.Add(data3[2]);
                        listView1.Items.Add(listView);
                        //    Console.WriteLine(data3[1]);
                    }
                    catch {
                        MessageBox.Show("请拖入程序保存的cookie文件!");
                        break;
                    }
                }
            }


            else
            {
                MessageBox.Show("请拖入.txt文本");
            }
        }
Beispiel #3
0
        /////   <summary>
        /////   获取响应cookies
        /////   </summary>
        /////  <param name="res">已经发送完的httpwebrespone</param>
        ////    <param name="oldcookie">旧的cookies</param>
        ///// <returns>文本型</returns>
        public string GetCookies(HttpWebResponse res, string oldcookie)
        {
            if (res.Headers.Get("Set-Cookie") == null)
            {
                return(oldcookie);
            }
            Dictionary <string, string> a = new Dictionary <string, string>();
            string temp = string.Empty;

            string[] cookie = res.Headers.Get("Set-Cookie").Split(',');
            if (oldcookie == null)
            {
                oldcookie = "";
            }
            oldcookie = oldcookie.Trim();

            for (int i = 0; i < cookie.Length; i++)
            {
                if (GetText.TextOccurrences(cookie[i], "=") == 0)
                {
                    temp += temp + "," + cookie[i];
                }
                else
                {
                    temp = temp + cookie[i] + ";";

                    /**      try
                     *    {
                     *        if (GetText.TextOccurrences(cookie[i + 1], "=") == 0)   //思路不清晰不写了
                     *        {
                     *            temp = temp + cookie[i];
                     *        }
                     *        else {
                     *            temp = temp + cookie[i] + ";";
                     *        }
                     *    }
                     *    catch (Exception)
                     *    {
                     *
                     *        continue;
                     *    }*/
                }
            }
            temp   = temp + oldcookie;
            cookie = temp.Split(';');
            temp   = string.Empty;

            foreach (var item in cookie)
            {
                string[] b = item.Split('=');
                if (b.Length == 2)
                {
                    try
                    {
                        a.Add(b[0], b[1]);
                    }
                    catch (Exception)
                    {
                        a[b[0]] = b[1];
                    }
                }
            }
            foreach (var item in a)
            {
                temp = temp + item.Key + "=" + item.Value + ";";
            }
            return(temp);
        }