1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-14 19:49:33 +00:00

Add Option _ExplicitArray to sources

This commit is contained in:
Samuel Gomes 2022-10-16 20:28:00 +05:30
parent 2719b4801a
commit 72368e2ca2
7 changed files with 103 additions and 92 deletions

View file

@ -1,4 +1,5 @@
Option _Explicit
Option _ExplicitArray
$ExeIcon:'.\resources\InForm.ico'
@ -5352,3 +5353,4 @@ Function OutsideQuotes%% (text$, position As Long)
End Function
'$include:'InForm.ui'

View file

@ -1,4 +1,5 @@
Option _Explicit
Option _ExplicitArray
Dim Shared UiEditorPID As Long, ExeIcon As Long
Dim Shared AutoNameControls As _Byte
@ -3990,3 +3991,4 @@ Function LoadEditorImage& (FileName$)
End Function
'$include:'InForm.ui'

View file

@ -1,63 +1,63 @@
FUNCTION Download$ (url$, file$, timelimit) STATIC
Function Download$ (url$, file$, timelimit) Static
'as seen on http://www.qb64.org/wiki/Downloading_Files
'adapted for use with InForm
DIM theClient AS LONG, l AS LONG
DIM prevUrl$, prevUrl2$, url2$, x AS LONG
DIM e$, url3$, x$, t!, a2$, a$, i AS LONG
DIM i2 AS LONG, i3 AS LONG, d$, fh AS LONG
Dim theClient As Long, l As Long
Dim prevUrl$, prevUrl2$, url2$, x As Long
Dim e$, url3$, x$, t!, a2$, a$, i As Long
Dim i2 As Long, i3 As Long, d$, fh As Long
IF url$ <> prevUrl$ OR url$ = "" THEN
If url$ <> prevUrl$ Or url$ = "" Then
prevUrl$ = url$
IF url$ = "" THEN
IF theClient THEN CLOSE theClient: theClient = 0
EXIT SUB
END IF
If url$ = "" Then
If theClient Then Close theClient: theClient = 0
Exit Function
End If
url2$ = url$
x = INSTR(url2$, "/")
IF x THEN url2$ = LEFT$(url$, x - 1)
IF url2$ <> prevUrl2$ THEN
x = InStr(url2$, "/")
If x Then url2$ = Left$(url$, x - 1)
If url2$ <> prevUrl2$ Then
prevUrl2$ = url2$
IF theClient THEN CLOSE theClient: theClient = 0
theClient = _OPENCLIENT("TCP/IP:80:" + url2$)
IF theClient = 0 THEN Download = MKI$(2): prevUrl$ = "": EXIT FUNCTION
END IF
e$ = CHR$(13) + CHR$(10) ' end of line characters
url3$ = RIGHT$(url$, LEN(url$) - x + 1)
If theClient Then Close theClient: theClient = 0
theClient = _OpenClient("TCP/IP:80:" + url2$)
If theClient = 0 Then Download = MKI$(2): prevUrl$ = "": Exit Function
End If
e$ = Chr$(13) + Chr$(10) ' end of line characters
url3$ = Right$(url$, Len(url$) - x + 1)
x$ = "GET " + url3$ + " HTTP/1.1" + e$
x$ = x$ + "Host: " + url2$ + e$ + e$
PUT #theClient, , x$
t! = TIMER ' start time
END IF
Put #theClient, , x$
t! = Timer ' start time
End If
GET #theClient, , a2$
Get #theClient, , a2$
a$ = a$ + a2$
i = INSTR(a$, "Content-Length:")
IF i THEN
i2 = INSTR(i, a$, e$)
IF i2 THEN
l = VAL(MID$(a$, i + 15, i2 - i - 14))
i3 = INSTR(i2, a$, e$ + e$)
IF i3 THEN
i = InStr(a$, "Content-Length:")
If i Then
i2 = InStr(i, a$, e$)
If i2 Then
l = Val(Mid$(a$, i + 15, i2 - i - 14))
i3 = InStr(i2, a$, e$ + e$)
If i3 Then
i3 = i3 + 4 'move i3 to start of data
IF (LEN(a$) - i3 + 1) = l THEN
d$ = MID$(a$, i3, l)
fh = FREEFILE
OPEN file$ FOR OUTPUT AS #fh: CLOSE #fh 'Warning! Clears data from existing file
OPEN file$ FOR BINARY AS #fh
PUT #fh, , d$
CLOSE #fh
If (Len(a$) - i3 + 1) = l Then
d$ = Mid$(a$, i3, l)
fh = FreeFile
Open file$ For Output As #fh: Close #fh 'Warning! Clears data from existing file
Open file$ For Binary As #fh
Put #fh, , d$
Close #fh
Download = MKI$(1) + MKL$(l) 'indicates download was successful
prevUrl$ = ""
prevUrl2$ = ""
a$ = ""
CLOSE theClient
Close theClient
theClient = 0
EXIT FUNCTION
END IF ' availabledata = l
END IF ' i3
END IF ' i2
END IF ' i
IF TIMER > t! + timelimit THEN CLOSE theClient: theClient = 0: Download = MKI$(3): prevUrl$ = "": EXIT FUNCTION
Exit Function
End If ' availabledata = l
End If ' i3
End If ' i2
End If ' i
If Timer > t! + timelimit Then Close theClient: theClient = 0: Download = MKI$(3): prevUrl$ = "": Exit Function
Download = MKI$(0) 'still working
END FUNCTION
End Function

View file

@ -5,10 +5,10 @@
'-----------------------------------------------------------
': Controls' IDs: ------------------------------------------------------------------
DIM SHARED gifplaySample AS LONG
DIM SHARED PictureBox1 AS LONG
DIM SHARED LoadBT AS LONG
DIM SHARED PlayBT AS LONG
Dim Shared gifplaySample As Long
Dim Shared PictureBox1 As Long
Dim Shared LoadBT As Long
Dim Shared PlayBT As Long
': External modules: ---------------------------------------------------------------
'$INCLUDE:'gifplay.bi'
@ -95,3 +95,4 @@ SUB __UI_FormResized
END SUB
'$INCLUDE:'..\InForm.ui'

View file

@ -5,38 +5,38 @@
'-----------------------------------------------------------
': Controls' IDs: ------------------------------------------------------------------
DIM SHARED InFormSetup AS LONG
DIM SHARED PictureBox2 AS LONG
DIM SHARED InFormresourcesApplicationicon128PX AS LONG
DIM SHARED InFormLB AS LONG
DIM SHARED forQB64LB AS LONG
DIM SHARED ListBox1 AS LONG
DIM SHARED RetryBT AS LONG
DIM SHARED CancelBT AS LONG
DIM SHARED ActivityIndicator AS LONG
Dim Shared InFormSetup As Long
Dim Shared PictureBox2 As Long
Dim Shared InFormresourcesApplicationicon128PX As Long
Dim Shared InFormLB As Long
Dim Shared forQB64LB As Long
Dim Shared ListBox1 As Long
Dim Shared RetryBT As Long
Dim Shared CancelBT As Long
Dim Shared ActivityIndicator As Long
$VERSIONINFO:FILEVERSION#=0,0,0,1
$VERSIONINFO:PRODUCTVERSION#=0,0,0,7
$VERSIONINFO:CompanyName=Fellippe Heitor
$VERSIONINFO:FileDescription=InForm - GUI library for QB64
$VERSIONINFO:FileVersion=v0.1
$VERSIONINFO:InternalName=InFormSetup.bas
$VERSIONINFO:LegalCopyright=Open source
$VERSIONINFO:OriginalFilename=InFormSetup.exe
$VERSIONINFO:ProductName=InForm Setup
$VERSIONINFO:ProductVersion=v0.7
$VERSIONINFO:Comments=Requires the latest build of QB64
$VERSIONINFO:Web=www.qb64.org/inform
$VersionInfo:FILEVERSION#=0,0,0,1
$VersionInfo:PRODUCTVERSION#=0,0,0,7
$VersionInfo:CompanyName=Fellippe Heitor
$VersionInfo:FileDescription=InForm - GUI library for QB64
$VersionInfo:FileVersion=v0.1
$VersionInfo:InternalName=InFormSetup.bas
$VersionInfo:LegalCopyright=Open source
$VersionInfo:OriginalFilename=InFormSetup.exe
$VersionInfo:ProductName=InForm Setup
$VersionInfo:ProductVersion=v0.7
$VersionInfo:Comments=Requires the latest build of QB64
$VersionInfo:Web=www.qb64.org/inform
DIM SHARED binaryExtension$, pathAppend$
Dim Shared binaryExtension$, pathAppend$
$IF WIN THEN
$If WIN Then
binaryExtension$ = ".exe"
pathAppend$ = ""
$ELSE
binaryExtension$ = ""
pathAppend$ = "./"
$END IF
$Else
binaryExtension$ = ""
pathAppend$ = "./"
$End If
': External modules: ---------------------------------------------------------------
'$INCLUDE:'../InForm.bi'
@ -1941,3 +1941,4 @@ FUNCTION IconData$
END FUNCTION
'$INCLUDE:'../InForm.ui'

View file

@ -5,26 +5,26 @@
'-----------------------------------------------------------
': Controls' IDs: ------------------------------------------------------------------
DIM SHARED InFormUpdater AS LONG
DIM SHARED PictureBox2 AS LONG
DIM SHARED InFormresourcesApplicationicon128PX AS LONG
DIM SHARED InFormLB AS LONG
DIM SHARED forQB64LB AS LONG
DIM SHARED ListBox1 AS LONG
DIM SHARED RetryBT AS LONG
DIM SHARED CancelBT AS LONG
DIM SHARED ActivityIndicator AS LONG
Dim Shared InFormUpdater As Long
Dim Shared PictureBox2 As Long
Dim Shared InFormresourcesApplicationicon128PX As Long
Dim Shared InFormLB As Long
Dim Shared forQB64LB As Long
Dim Shared ListBox1 As Long
Dim Shared RetryBT As Long
Dim Shared CancelBT As Long
Dim Shared ActivityIndicator As Long
DIM SHARED binaryExtension$, pathAppend$
DIM SHARED CheckDevUpdates AS _BYTE
Dim Shared binaryExtension$, pathAppend$
Dim Shared CheckDevUpdates As _Byte
$IF WIN THEN
$If WIN Then
binaryExtension$ = ".exe"
pathAppend$ = ""
$ELSE
binaryExtension$ = ""
pathAppend$ = "./"
$END IF
$Else
binaryExtension$ = ""
pathAppend$ = "./"
$End If
': External modules: ---------------------------------------------------------------
'$INCLUDE:'../InForm.bi'
@ -418,3 +418,4 @@ SUB __UI_FormResized
END SUB
'$INCLUDE:'../InForm.ui'

View file

@ -1,4 +1,8 @@
Option _Explicit
Option _ExplicitArray
$Console:Only
_Dest _Console
'$INCLUDE:'InFormVersion.bas'