@@ -59,6 +59,7 @@ Public Class Update_Gui
59
59
Return Resp.ContentLength
60
60
End Using
61
61
End Function
62
+
62
63
Public Sub VerifyUpdate()
63
64
LogFile.LogTracing( "Verify Update" , LogLvl.LOG_DEBUG, Me )
64
65
If WinNUT_Params.Arr_Reg_Key.Item( "VerifyUpdate" ) Or Me .ManualUpdate Then
@@ -73,10 +74,16 @@ Public Class Update_Gui
73
74
End Select
74
75
Dim Today As Date = Now
75
76
Dim Diff As Integer = 1
76
- If WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) <> "" Then
77
- Dim LastVerif As Date = Convert.ToDateTime(WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ))
78
- Diff = DateDiff(DelayVerif, LastVerif, Today, FirstDayOfWeek.Monday, FirstWeekOfYear.Jan1)
77
+ Dim lastCheckDate = WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" )
78
+
79
+ If lastCheckDate <> "" Then
80
+ Try
81
+ Diff = DateDiff(DelayVerif, Convert.ToDateTime(lastCheckDate), Today)
82
+ Catch ex As FormatException
83
+ LogFile.LogTracing( "Format exception when parsing last check date: " + lastCheckDate, LogLvl.LOG_ERROR, Me )
84
+ End Try
79
85
End If
86
+
80
87
If Diff >= 1 Or ManualUpdate Then
81
88
Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
82
89
WebC.Headers.Add(Net.HttpRequestHeader.Accept, "application/json" )
@@ -137,7 +144,9 @@ Public Class Update_Gui
137
144
Catch excep As Exception
138
145
LogFile.LogTracing(excep.Message, LogLvl.LOG_ERROR, Me )
139
146
End Try
140
- WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) = Now.ToString
147
+
148
+ ' Use the 's' format to get a standard datetime for error-free parsing in the future.
149
+ WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) = Date .Now.ToString( "s" )
141
150
WinNUT_Params.Save_Params()
142
151
Me .UpdateInfoRetrieved = True
143
152
Me .Show()
0 commit comments