1 Star 0 Fork 88

清风 / weixinHttpApi

forked from codeman35 / weixinHttpApi 
Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
MainForm_Cookie.cs 2.96 KB
Copy Edit Web IDE Raw Blame History
codeman35 authored 2016-01-08 10:23 . no commit message
using FluorineFx.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
namespace WeiXinZhuaFaWang
{
public partial class MainForm : Form
{
string GetCookieKey(List<Cookie> list, string key)
{
return (from o in list where o.Name == key select o).First<Cookie>().Value;
}
static Dictionary<string,string> GetAllCookiesA(CookieContainer cc)
{
Dictionary<string, string> lstCookies = new Dictionary<string, string>();
Hashtable table = (Hashtable)cc.GetType().InvokeMember("m_domainTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, cc, new object[] { });
StringBuilder sb = new StringBuilder();
foreach (object pathList in table.Values)
{
SortedList lstCookieCol = (SortedList)pathList.GetType().InvokeMember("m_list", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, pathList, new object[] { });
foreach (CookieCollection colCookies in lstCookieCol.Values)
foreach (Cookie c in colCookies)
{
lstCookies.Add(c.Name, c.Value);
sb.AppendLine(c.Domain + ":" + c.Name + "____" + c.Value + "\r\n");
}
}
return lstCookies;
}
static List<Cookie> GetAllCookies(CookieContainer cc)
{
List<Cookie> lstCookies = new List<Cookie>();
Hashtable table = (Hashtable)cc.GetType().InvokeMember("m_domainTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, cc, new object[] { });
StringBuilder sb = new StringBuilder();
foreach (object pathList in table.Values)
{
SortedList lstCookieCol = (SortedList)pathList.GetType().InvokeMember("m_list", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, pathList, new object[] { });
foreach (CookieCollection colCookies in lstCookieCol.Values)
foreach (Cookie c in colCookies)
{
lstCookies.Add(c);
sb.AppendLine(c.Domain + ":" + c.Name + "____" + c.Value + "\r\n");
}
}
return lstCookies;
}
}
}

Comment ( 0 )

Sign in for post a comment

C#
1
https://gitee.com/tamny/weixinHttpApi.git
git@gitee.com:tamny/weixinHttpApi.git
tamny
weixinHttpApi
weixinHttpApi
master

Search