From 5235074d14e1a887841e0b57f0258a1d9d0b4112 Mon Sep 17 00:00:00 2001 From: heebijeebi Date: Tue, 13 Dec 2016 17:18:39 +0100 Subject: [PATCH] Adding Mirror compatibility to Updater --- LatestVersion.ini | 3 ++- project/FuncUpdatecheck.au3 | 1 + project/PatcherCPL.au3 | 2 ++ project/Updater.au3 | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/LatestVersion.ini b/LatestVersion.ini index 6715aff..173fae0 100644 --- a/LatestVersion.ini +++ b/LatestVersion.ini @@ -1,3 +1,4 @@ [Updater] MainApp=16.01.07 -URL=https://github.com/heebijeebi/WinTango-Patcher/releases/download/v16.01.07/WinTango-Patcher-16.01.07-offline.exe +URL=Zippyshare +URL2=https://github.com/heebijeebi/WinTango-Patcher/releases/download/v16.01.07/WinTango-Patcher-16.01.07-offline.exe diff --git a/project/FuncUpdatecheck.au3 b/project/FuncUpdatecheck.au3 index 793457b..96f7e8e 100644 --- a/project/FuncUpdatecheck.au3 +++ b/project/FuncUpdatecheck.au3 @@ -32,6 +32,7 @@ Func _CheckForUpdate() EndIf $sVerLatest[1] = IniRead($sDest, "Updater", "URL", "") ;URL for Installer + $sVerLatest[2] = IniRead($sDest, "Updater", "URL2", "") ;URL for Installer (Mirror) FileDelete($sDest) ;Delete the Infofile diff --git a/project/PatcherCPL.au3 b/project/PatcherCPL.au3 index bef4b51..5ae9442 100644 --- a/project/PatcherCPL.au3 +++ b/project/PatcherCPL.au3 @@ -107,8 +107,10 @@ While 1 GUICtrlSetState($btnUpdate, $GUI_HIDE) ;Download Latest Version... $sUrl = $AppVersionLatest[1] + $sUrlMirror = $AppVersionLatest[2] $sDest = @TempDir & "\" & StringReplace($AppName, " ", "-") & "-LATEST.exe" _DownloadLatestVersion($sUrl, $sDest) + If not FileExists($sDest) Then _DownloadLatestVersion($sUrlMirror, $sDest) ;retry with mirror ;...and install it _RunDownload($sDest) Exit diff --git a/project/Updater.au3 b/project/Updater.au3 index ccaba2b..b8c9527 100644 --- a/project/Updater.au3 +++ b/project/Updater.au3 @@ -65,8 +65,10 @@ EndIf GUICtrlSetData($lblCurrent, $string_msgDownloading) $sUrl = $AppVersionLatest[1] +$sUrlMirror = $AppVersionLatest[2] $sDest = @TempDir & "\" & StringReplace($AppName, " ", "-") & "-LATEST.exe" _DownloadLatestVersion($sUrl, $sDest) +If not FileExists($sDest) Then _DownloadLatestVersion($sUrlMirror, $sDest) ;retry with mirror GUICtrlSetData($lblOverall, $string_msgDownloadDone) Sleep(2000)