From 574a8a7f514831134109bf13221027dda332187b Mon Sep 17 00:00:00 2001 From: bgermann Date: Fri, 10 Aug 2018 11:59:13 +0200 Subject: [PATCH] Use HttpClient.Download for timestamp download --- app/src/gambas3/.src/Help/MHelp.module | 13 +------------ app/src/gambas3/.src/Options/FOption.class | 12 +++--------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/app/src/gambas3/.src/Help/MHelp.module b/app/src/gambas3/.src/Help/MHelp.module index 245470cc3..3e1c72c84 100644 --- a/app/src/gambas3/.src/Help/MHelp.module +++ b/app/src/gambas3/.src/Help/MHelp.module @@ -860,7 +860,6 @@ End Public Sub GetOfflineState() As Integer - Dim hClient As HttpClient Dim sTimestamp As String Dim sDir As String Dim sDate As String @@ -868,17 +867,7 @@ Public Sub GetOfflineState() As Integer If Not Desktop.NetworkAvailable Then Return OFFLINE_NO_NETWORK Inc Application.Busy - - hClient = New HttpClient As "hClient" - hClient.Async = False - hClient.Timeout = 20 - - hClient.URL = "http://gambaswiki.org/timestamp" - hClient.Get - If hClient.Status >= 0 Then - If Lof(hClient) Then sTimestamp = Read #hClient, Lof(hClient) - End If - + sTimestamp = HttpClient.Download("http://gambaswiki.org/timestamp") Dec Application.Busy sTimestamp = Trim(sTimestamp) diff --git a/app/src/gambas3/.src/Options/FOption.class b/app/src/gambas3/.src/Options/FOption.class index eef373dd9..200981bc3 100644 --- a/app/src/gambas3/.src/Options/FOption.class +++ b/app/src/gambas3/.src/Options/FOption.class @@ -1176,7 +1176,6 @@ End Public Sub btnDownloadHelp_Click() Dim hClient As HttpClient - Dim sHeaders As New String[0] Dim sMsg As String Dim sFile As String Dim sDir As String @@ -1195,18 +1194,13 @@ Public Sub btnDownloadHelp_Click() sFile = sParentDir &/ "wiki.tar.bz2" Try Kill sFile + sTimestamp = HttpClient.Download("http://gambaswiki.org/timestamp") + hClient = New HttpClient As "hClient" hClient.Async = False hClient.Timeout = 20 - - hClient.URL = "http://gambaswiki.org/timestamp" - hClient.Get - If hClient.Status >= 0 Then - If Lof(hClient) Then sTimestamp = Read #hClient, Lof(hClient) - End If - hClient.URL = "http://gambaswiki.org/gambas-wiki.tar.bz2" - hClient.Get(sHeaders, sFile) + hClient.Get([], sFile) If Not Exist(sFile) Then sMsg = ("Unable to download documentation.")