百思不得其解啊,故障为更新的过程中偶尔会让程序自动退出.
偶尔又正常.出错几率不是很大.
Func UPDATE($BD, $FWQ, $NAME)
TrayTip("<" & $NAME & ">", "请稍等,正在检查更新...", 2, 1)
$DOWNLOAD = $FWQ
$SIZE = InetGetSize($FWQ)
If @error Then
$ASK = MsgBox(20, "询问", "与更新服务器连接错误!" & @CRLF & "是否执行本地<" & $NAME & ">?")
If $ASK = 6 Then
Return
ElseIf $ASK = 7 Then
Run(FileGetShortName(@ScriptFullPath))
Exit
EndIf
Else
If FileGetSize($BD) <> InetGetSize($FWQ) Then
MsgBox(64, "提示", "运行<" & $NAME & ">需要下载资源!" & @CRLF & "点确定开始下载!", 10)
InetGet($DOWNLOAD, $BD, 1, 1)
While @InetGetActive
$SIZE = InetGetSize($DOWNLOAD)
$PER = @InetGetBytesRead / $SIZE * 100
$RES = StringLeft($PER, 4) ;计算百分值
$DOWNED = @InetGetBytesRead / 1024 / 1024
$DOWNRES = StringLeft($DOWNED, 3)
$DOWNNEED = $SIZE / 1024 / 1024
$DOWNALL = StringLeft($DOWNNEED, 3)
ToolTip("总大小/已下载:" & $DOWNALL & "MB/" & $DOWNRES & "MB", @DesktopHeight / 2, 0, "[" & $RES & "%已完成] - 正在下载" & $NAME, 1)
Sleep(1000)
WEnd
ToolTip("", @DesktopHeight / 2, 0, "", 1)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Ymnetwork", $NAME, "REG_SZ", @YEAR & @MON & @MDAY)
MsgBox(64, "恭喜您", "<" & $NAME & ">更新成功!" & @CRLF & "--------------------------------" & @CRLF & "作者:L4EVER QQ:425145" & @CRLF & "EMAIL:L4EVER@QQ.COM", "5")
RunWait($BD)
Else
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Ymnetwork", $NAME, "REG_SZ", @YEAR & @MON & @MDAY)
EndIf
EndIf
EndFunc ;==>UPDATE |