mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
Changed formatting and set Cookie DateTimes to MinValue instead of default value on exception
This commit is contained in:
@@ -21,54 +21,59 @@ namespace CefSharp
|
||||
cookie->Secure = cefCookie.secure == 1;
|
||||
cookie->HttpOnly = cefCookie.httponly == 1;
|
||||
|
||||
try {
|
||||
if (cefCookie.has_expires)
|
||||
{
|
||||
cookie->Expires = DateTime(
|
||||
cefCookie.expires.year,
|
||||
cefCookie.expires.month,
|
||||
cefCookie.expires.day_of_month,
|
||||
cefCookie.expires.hour,
|
||||
cefCookie.expires.minute,
|
||||
cefCookie.expires.second,
|
||||
cefCookie.expires.millisecond
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception^ ex){
|
||||
// ignore invalid date as we have no way to represent it
|
||||
}
|
||||
try
|
||||
{
|
||||
if (cefCookie.has_expires)
|
||||
{
|
||||
cookie->Expires = DateTime(
|
||||
cefCookie.expires.year,
|
||||
cefCookie.expires.month,
|
||||
cefCookie.expires.day_of_month,
|
||||
cefCookie.expires.hour,
|
||||
cefCookie.expires.minute,
|
||||
cefCookie.expires.second,
|
||||
cefCookie.expires.millisecond
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
cookie->Expires = DateTime::MinValue;
|
||||
}
|
||||
|
||||
//TODO: There is a method in TypeUtils that's in BrowserSubProcess that convers CefTime, need to make it accessible.
|
||||
try {
|
||||
cookie->Creation = DateTime(
|
||||
cefCookie.creation.year,
|
||||
cefCookie.creation.month,
|
||||
cefCookie.creation.day_of_month,
|
||||
cefCookie.creation.hour,
|
||||
cefCookie.creation.minute,
|
||||
cefCookie.creation.second,
|
||||
cefCookie.creation.millisecond
|
||||
);
|
||||
}
|
||||
catch (Exception^ ex){
|
||||
// ignore invalid date as we have no way to represent it
|
||||
}
|
||||
try
|
||||
{
|
||||
cookie->Creation = DateTime(
|
||||
cefCookie.creation.year,
|
||||
cefCookie.creation.month,
|
||||
cefCookie.creation.day_of_month,
|
||||
cefCookie.creation.hour,
|
||||
cefCookie.creation.minute,
|
||||
cefCookie.creation.second,
|
||||
cefCookie.creation.millisecond
|
||||
);
|
||||
}
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
cookie->Creation = DateTime::MinValue;
|
||||
}
|
||||
|
||||
try {
|
||||
cookie->LastAccess = DateTime(
|
||||
cefCookie.last_access.year,
|
||||
cefCookie.last_access.month,
|
||||
cefCookie.last_access.day_of_month,
|
||||
cefCookie.last_access.hour,
|
||||
cefCookie.last_access.minute,
|
||||
cefCookie.last_access.second,
|
||||
cefCookie.last_access.millisecond
|
||||
);
|
||||
}
|
||||
catch (Exception^ ex){
|
||||
// ignore invalid date as we have no way to represent it
|
||||
}
|
||||
try {
|
||||
cookie->LastAccess = DateTime(
|
||||
cefCookie.last_access.year,
|
||||
cefCookie.last_access.month,
|
||||
cefCookie.last_access.day_of_month,
|
||||
cefCookie.last_access.hour,
|
||||
cefCookie.last_access.minute,
|
||||
cefCookie.last_access.second,
|
||||
cefCookie.last_access.millisecond
|
||||
);
|
||||
}
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
cookie->LastAccess = DateTime::MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
return _visitor->Visit(cookie, count, total, deleteCookie);
|
||||
|
||||
Reference in New Issue
Block a user