Files
vfp_roaauto/COMUN/programe/version.prg

127 lines
4.0 KiB
Plaintext

Function Getversion
Lparameters lcprogram
Dimension versionarray[1]
clocalexe=GetCurrentAppPath(lcprogram)
*MESSAGEBOX("&clocalexe")
Agetfileversion(versionarray,"&clocalexe")
If Alen(versionarray)>3
Return versionarray[4]
Else
Return "0.0.0"
Endif
EndFunc
*******************************************************************************************
Function GetTxtVersion
Lparameters lcprogram
lcFisierVersiune = gcDirMare + [\] + lcProgram + [\versiune.txt]
If File(lcFisierVersiune)
lcVersiune = FileToStr(lcFisierVersiune)
If Empty(lcVersiune)
Return "0.0.0"
Else
Return lcVersiune
EndIf
Else
Return "0.0.0"
Endif
Endfunc
*******************************************************************************************
Function CompareVersion
Lparameters xmlVersion,xmlData,lcprogram,msg,tnTip
*!* modificare v 2.0.14
&& tnTip = 0 sau nu este dat ca parametru : versiunea se citeste din executabil
&& tnTip = 1 : versiunea se citeste din fisierul versiune.txt
cVersionCurrent = Iif(Empty(tnTip),Getversion(lcprogram),GetTxtVersion(lcprogram))
*!* cVersionCurrent=Getversion(lcprogram)
*!* modificare v 2.0.14 ^
cXmlVersion=xmlVersion
*MESSAGEBOX(cVersionCurrent + " " +cXmlVersion)
If cVersionCurrent="0"
cVersionCurrent="0.0.0"
Endif
If cVersionCurrent="0"
Return .F.
Else
lnTmpLen=Len(cVersionCurrent)
*!* modificare v 2.0.13 : daca am cVersionCurrent = '1.0.10' si cXmlVersion = '1.0.100' nu mai face actualizarea
*!* If (Alltrim(cVersionCurrent)=Left(Alltrim(cXmlVersion),lnTmpLen))
If Alltrim(cVersionCurrent)=Alltrim(cXmlVersion)
*!* modificare v 2.0.13 ^
Return .F.
Else
lcmesaj1=stripXmlMsg(xmlData)
If lcmesaj1#"NO_MESSAGE" And !msg
AMessagebox(lcmesaj1,48,"Actualizare")
Endif
Return .T.
Endif
Endif
Endfunc
*******************************************************************************************
Function StripXmlVersion
Lparameters cXmlVersion
Return Strextract(Alltrim(cXmlVersion),"<",">",1)
Endfunc
*******************************************************************************************
Function stripXmlMsg
Lparameters cXmlVersion
Return Strextract(Alltrim(cXmlVersion),"{","}",1)
Endfunc
*******************************************************************************************
Function GetCurrentAppPath
Lparameters lcprogram
If At("_",lcprogram)#0
lccurrentUR=Substr(lcprogram,At("_",lcprogram)+1)
* MESSAGEBOX(lccurrentUR)
Else
lccurrentUR=lcprogram
Endif
cAppPath=Addbs(Justpath(Sys(16,0)))
If Atc("PROCEDURE",cAppPath) > 0
cAppPath = Substr(cAppPath,Rat(":",cAppPath)-1)
Endif
liat=Rat("\",cAppPath,2)
Return Addbs(Left(cAppPath,liat-1))+lccurrentUR+"\"+lcprogram+".exe"
Endfunc
*******************************************************************************************
Function GetIniPath
Local lcAppPath
lcAppPath=Addbs(GetAppStartPath())
lcAppPath = STRTRAN(lcAppPath, 'PROGRAME\','',1,1,1)
lcAppPath = STRTRAN(lcAppPath, 'PROGRAMS\','',1,1,1)
liat=Rat("\",lcAppPath,2)
lcAppPath=Addbs(Left(lcAppPath,liat-1))+"settings.ini"
Return lcAppPath
Endfunc
*******************************************************************************************
Function GetCurrentTempPath
Lparameters lcprogram
If At("_",lcprogram)#0
lccurrentUR=Substr(lcprogram,At("_",lcprogram)+1)
* MESSAGEBOX(lccurrentUR)
Else
lccurrentUR=lcprogram
Endif
cAppPath=Addbs(Justpath(Sys(16,0)))
If Atc("PROCEDURE",cAppPath) > 0
cAppPath = Substr(cAppPath,Rat(":",cAppPath)-1)
Endif
liat=Rat("\",cAppPath,2)
Return Addbs(Left(cAppPath,liat-1))+lccurrentUR+"\temporar.zip"
Endfunc
*******************************************************************************************
Function GetProg
Lparameters cAppPath
cAppPath = Substr(cAppPath,Rat("\",cAppPath)+1)
cAppPath = Left(cAppPath,At("exe",cAppPath)-2)
Return cAppPath
Endfunc
*******************************************************************************************