mirror of
https://gitee.com/lxwcode/weixinHttpApi.git
synced 2025-12-06 10:18:57 +08:00
67 lines
3.0 KiB
C#
67 lines
3.0 KiB
C#
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;
|
|
}
|
|
}
|
|
} |