Created
September 9, 2012 16:18
-
-
Save torstenfeld/3685383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Func _UpdateCheck(ByRef $lResultArray, $lNoUpdateMessage) ; checks for new versions of tool and ini files | |
Local $lTempArray, $lVar, $Var2, $lForceUpdate, $lIndex | |
Local $lUpdateItemsArray | |
Local $lCaseToCheckFor = "tool" | |
Local $lInetReadResult = InetRead($gUpdateInformation, 7) | |
If @error Then | |
_WriteDebug('ERR ;_UpdateCheck;Could not read "' & $gUpdateInformation & '"') | |
Return SetError(1, 0, 0) | |
EndIf | |
_WriteDebug('INFO;_UpdateCheck;"' & $gUpdateInformation & '" was read successfully') | |
$lUpdateItemsArray = StringSplit(BinaryToString($lInetReadResult), @CRLF, 2) | |
For $i = 0 To UBound($lUpdateItemsArray) - 1 | |
If $lUpdateItemsArray[$i] = "" Then ContinueLoop | |
$lTempArray = StringSplit($lUpdateItemsArray[$i], "=", 2) | |
_Array2DAdd($lResultArray, $lTempArray[0] & "|" & $lTempArray[1]) | |
_WriteDebug('INFO;_UpdateCheck;Online version of "' & $lTempArray[0] & '" is "' & $lTempArray[1] & '"') | |
Next | |
_ArrayDelete($lResultArray, 0) | |
For $i = 0 To UBound($lResultArray) - 1 | |
Switch $lResultArray[$i][0] | |
Case "tool" | |
If _VersionCompare($lResultArray[$i][1], $gToolVersion) = 1 And @Compiled Then | |
_WriteDebug('INFO;_UpdateCheck;A newer version of VDF Checker is available: ' & $lResultArray[$i][1] & "/" & $gToolVersion) | |
#region --- CodeWizard generated code Start --- | |
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question, Timeout=15 ss | |
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer | |
$iMsgBoxAnswer = MsgBox(35, "New version available", "A new version (" & $lResultArray[$i][1] & ") of " & $gMsgBoxTitle & " is available. " & @CRLF & "Do you want to update automatically?", 15) | |
Select | |
Case $iMsgBoxAnswer = 6 ;Yes | |
_WriteDebug("INFO;_UpdateCheck;User chose to update tool automatically") | |
_UpdateTool($gToolDownload) | |
Case $iMsgBoxAnswer = 7 ;No | |
_WriteDebug("WARN;_UpdateCheck;User decided not to update the tool") | |
ContinueLoop | |
Case $iMsgBoxAnswer = 2 ;Cancel | |
_WriteDebug("ERR ;_UpdateCheck;User cancelled update of tool") | |
Exit (4) | |
Case $iMsgBoxAnswer = -1 ;Timeout | |
_WriteDebug("ERR ;_UpdateCheck;Update msgbox ran in timeout") | |
ContinueLoop | |
EndSelect | |
#endregion --- CodeWizard generated code Start --- | |
EndIf | |
EndSwitch | |
Next | |
EndFunc ;==>_UpdateCheck |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment