1 Star 0 Fork 101

天才书生/weixinHttpApi

forked from codeman35/weixinHttpApi 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
MainForm_Cookie.cs 2.96 KB
一键复制 编辑 原始数据 按行查看 历史
codeman35 提交于 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;
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/booksir/weixinHttpApi.git
git@gitee.com:booksir/weixinHttpApi.git
booksir
weixinHttpApi
weixinHttpApi
master

搜索帮助