PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 25 → WX (Windev, Webdev e Windev Mobile) - Live update com arquivo ini
WX (Windev, Webdev e Windev Mobile) - Live update com arquivo ini
Iniciado por Boller, 07,may. 2021 17:27 - 6 respuestas
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 07,mayo 2021 - 17:27
Exemplo

No servidor
[sistemax]
Versao = 2

......

URLini is string = “http://w.com/versao.ini”

Httprequest (URLini)

Versao is string = Httpgetresult()

Fsavetext(fcurrentdir()+ fsep()+ “versaoserver.ini”, Versao)

Versao is string = iniread (...

Versaolocal is string = iniread (...

If val(versao) > val(versaolocal)

Ftpconnect

If <> -1

Ftpget(URL)

End

Ftpclose

End

Execrun(file)

//Update file Ini with version server//

Iniwrite(....,versao,...)

Endprogram


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 08,mayo 2021 - 00:37
EXEMPLO TESTADO

PROCEDURE LiveUpdate()

baixouok is boolean

URLini is string = “http://wxsolucoes.com.br/versaovpw.ini”

HTTPRequest (URLini)

Versao is string = HTTPGetResult()

fSaveText(fCurrentDir()+ fSep()+ “versaoserver.ini”, Versao)

Versaoserver is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaoserver.ini”)

Versaolocal is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaolocal.ini”)

IF Val(Versaoserver) > Val(Versaolocal)

conexaoftp is int = FTPConnect("177.220.189.6","joao","123","21",ftpPassiveMode)

IF conexaoftp <> -1 //cdeu certo

IF FTPGetFile(conexaoftp,"/Install_VIPW.exe","c:\VIPW_Teste\Install\") = True THEN

baixouok = True

INIWrite("VPW","Versao",Versaoserver,fCurrentDir()+ fSep()+ “versaolocal.ini”)

ExeRun("c:\VIPW_Teste\Install\Install_VIPW.exe")

ToastDisplay("Sua aplicação será fechada e atualizada",toastLong,vaMiddle,haCenter,RGB(0,0,255))

EndProgram

ELSE
baixouok = False
END

ELSE

Info("Servidor offline ou erro de confguracao")

END

FTPDisconnect(conexaoftp)

END

RESULT baixouok


bY JOAO VITOR

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 08,mayo 2021 - 00:50
// Summary:
// Syntax:
//LiveUpdate ()
//
// Parameters:
// None
// Automatic procedure:
// The procedure is automatically run, after the project initialization code, with a delay set to 1 second
// It will be run in a thread (without having to call ThreadExecute), without using HFSQL
// It will be repeated in loop, with a timeout set to 10 minutes between each call
//

PROCEDURE LiveUpdate()

baixouok is boolean

URLini is string = “http://wxsolucoes.com.br/versaovpw.ini”

HTTPRequest (URLini)

Versao is string = HTTPGetResult()

fSaveText(fCurrentDir()+ fSep()+ “versaoserver.ini”, Versao)

Versaoserver is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaoserver.ini”)

Versaolocal is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaolocal.ini”)

IF Val(Versaoserver) > Val(Versaolocal)

conexaoftp is int = FTPConnect("177.220.189.6","joao","123","21",ftpPassiveMode)

IF conexaoftp <> -1 //cdeu certo

IF FTPGetFile(conexaoftp,"/Install_VIPW.exe","c:\VIPW_Teste\Install\") = True THEN

baixouok = True

FTPDisconnect(conexaoftp)

INIWrite("VPW","Versao",Versaoserver,fCurrentDir()+ fSep()+ “versaolocal.ini”) // ATUALIZA O INI LOCAL COM O VALOR DO SERVIDOR

ExeRun("c:\VIPW_Teste\Install\Install_VIPW.exe")

ToastDisplay("Sua aplicação será fechada e atualizada",toastLong,vaMiddle,haCenter,RGB(0,0,255))


EndProgram

ELSE
baixouok = False
END

ELSE

//info("Servidor offline ou erro de confguracao")

END

FTPDisconnect(conexaoftp)

END


//result baixouok


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 30,septiembre 2021 - 13:49
Procedure LiveUpdateGEW()

baixouok is boolean


conexaoftp is int = FTPConnect("187.95.147.138","Ocimar","@Ocimar$123456","21",ftpPassiveMode)

IF conexaoftp <> -1 //cdeu certo THEN

IF FTPGetFile(conexaoftp,"versaoserver.ini",fCurrentDir()+ fSep()) = True THEN
ToastDisplay("Conferindo versão",toastLong,vaMiddle,haCenter,RGB(0,0,255))
END

DataExecucao is string = INIRead("VPW","DataExecucao","",fCurrentDir()+ fSep()+ “versaolocal.ini)

Versaoserver is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaoserver.ini)

Versaolocal is string = INIRead ("VPW","Versao","",fCurrentDir()+ fSep()+ “versaolocal.ini)

IF Val(Versaoserver) > Val(Versaolocal) AND DataExecucao <> DateSys()

IF FTPGetFile(conexaoftp,"Install_GEW.exe",fCurrentDir()+ fSep()) = True THEN

baixouok = True

FTPDisconnect(conexaoftp)

INIWrite("VPW","Versao",Versaoserver,fCurrentDir()+ fSep()+ “versaolocal.ini) // ATUALIZA O INI LOCAL COM O VALOR DO SERVIDOR

INIWrite("VPW","DataExecucao",DateSys(),fCurrentDir()+ fSep()+ “versaolocal.ini) // ATUALIZA O INI LOCAL COM O VALOR DO SERVIDOR

// INFO(fCurrentDir()+ fSep()+ “versaolocal.ini”)

ExeRun(fCurrentDir()+ fSep()+ "Install_GEW.exe")

ToastDisplay("Sua aplicação será fechada e atualizada",toastLong,vaMiddle,haCenter,RGB(0,0,255))


EndProgram

ELSE
baixouok = False
END

END

ELSE

//info("Servidor offline ou erro de confguracao")

END

FTPDisconnect(conexaoftp)

//result baixouok


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 30,septiembre 2021 - 18:01
Video explicando a tecnica do LiveUpdate com arquivos ini e FTP
==========================================



https://repository.windev.com/resource.awp…

OK

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 08,noviembre 2022 - 15:47









--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Miembro registrado
3.651 mensajes
Popularité : +175 (223 votes)
Publicado el 08,noviembre 2022 - 15:48
CODE PARA MOBILE

// Summary: <specify the procedure action>
// Syntax:
//LiveUpdate ()
//
// Parameters:
// None
// Example:
// <Specify a usage example>
//
// Return value:
PROCEDURE LiveUpdate()

baixouok is boolean


conexaoftp is int = FTPConnect("187.95.147.180","OcimarTeste","@Ocimar$123456$$$$","21",ftpPassiveMode)

IF conexaoftp <> -1//cdeu certo THEN

IF FTPGet(conexaoftp,"versaoserver.ini",fCurrentDir()+fSep()) =True THEN
ToastDisplay("Conferindo versão",toastLong,vaMiddle,haCenter)
END

DataExecucao is string = INIRead("VPW","DataExecucao","",fCurrentDir()+fSep()+ “versaolocal.ini”)

Versaoserver is string = INIRead("VPW","Versao","",fCurrentDir()+fSep()+ “versaoserver.ini”)

Versaolocal is string = INIRead("VPW","Versao","",fCurrentDir()+fSep()+ “versaolocal.ini”)

IF Val(Versaoserver) >Val(Versaolocal) AND DataExecucao<>DateSys()

IF FTPGet(conexaoftp,"Install_GEW.apk",fCurrentDir()+fSep())= True THEN

baixouok = True

FTPDisconnect(conexaoftp)

INIWrite("VPW","Versao",Versaoserver,fCurrentDir()+fSep()+ “versaolocal.ini”)// ATUALIZA O INI LOCAL COM O VALOR DO SERVIDOR

INIWrite("VPW","DataExecucao",DateSys(),fCurrentDir()+fSep()+ “versaolocal.ini”)// ATUALIZA O INI LOCAL COM O VALOR DO SERVIDOR

//INFO(fCurrentDir()+ fSep()+ “versaolocal.ini”)

ExeRun(fCurrentDir()+fSep()+"Install_GEW.apk")

ShellExecute(fCurrentDir()+fSep()+"Install_GEW.apk")

ToastDisplay("Sua aplicação será fechada e atualizada",toastLong,vaMiddle,haCenter)

EndProgram

ELSE
baixouok=False
END

END

ELSE

Info("Servidor offline ou erro de confguracao")

END

FTPDisconnect(conexaoftp)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/