/// <summary> /// 获取所有 Cookie /// </summary> /// <param name="connId"></param> /// <param name="lpCookies"></param> /// <param name="pdwCount"></param> /// <returns></returns> public List <TCookie> GetAllCookies(IntPtr connId) { var list = new List <TCookie>(); try { uint count = 0; IntPtr arrPtr = IntPtr.Zero; HttpSdk.HP_HttpAgent_GetAllCookies(pAgent, connId, arrPtr, ref count); if (count > 0) { var ptrArr = new THeaderForIntPtr[count]; arrPtr = Marshal.UnsafeAddrOfPinnedArrayElement(ptrArr, 0); if (HttpSdk.HP_HttpAgent_GetAllCookies(pAgent, connId, arrPtr, ref count)) { foreach (var item in ptrArr) { list.Add(new TCookie() { Name = Common.PtrToAnsiString(item.Name), Value = Common.PtrToAnsiString(item.Value) }); } } } } catch (Exception) { } return(list); }