Changed formatting and set Cookie DateTimes to MinValue instead of default value on exception

This commit is contained in:
YaiEf
2016-03-13 12:08:50 +01:00
parent f9688a0a2e
commit 150daa4ff5
+50 -45
View File
@@ -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);