XSharpPublic
XSharpPublic copied to clipboard
Missing VFP functions to implement
https://www.xsharp.eu/forum/topic/5500?p=33646
Here are a few missing VFP functions that I needed. It would be great to see them added to XSharp Tools. I'm not proficient enough with XSharp to do it myself yet:
FUNCTION SEEK(pcExpr, pcAlias AS STRING, pcTag AS STRING)
LOCAL lcAlias, lcOrder, llFound
IF !EMPTY(pcAlias)
lcAlias = ALIAS()
SELECT (pcAlias)
ENDIF
IF !EMPTY(pcTag)
lcOrder = ORDER()
SET ORDER TO (pcTag)
ENDIF
SEEK pcExpr
llFound = FOUND()
IF !EMPTY(pcTag)
SET ORDER TO (lcOrder)
ENDIF
IF !EMPTY(pcAlias)
SELECT (lcAlias)
ENDIF
RETURN llFound
END FUNCTION
FUNCTION AGETFILEVERSION(paResult AS USUAL,pcFileName AS STRING) AS INT
LOCAL info AS System.Diagnostics.FileVersionInfo
IF !FILE.Exists(pcFileName)
RETURN 0
ENDIF
info = System.Diagnostics.FileVersionInfo.GetVersionInfo(pcFileName)
IF IsNull(info)
RETURN 0
ENDIF
paResult[1] = info.Comments
paResult[2] = info.CompanyName
paResult[3] = info.FileDescription
paResult[4] = info.FileVersion
paResult[5] = info.InternalName
paResult[6] = info.LegalCopyright
paResult[7] = info.LegalTrademarks
paResult[8] = info.OriginalFilename
paResult[9] = info.PrivateBuild
paResult[10] = info.ProductName
paResult[11] = info.ProductVersion
paResult[12] = info.SpecialBuild
paResult[13] = ""
paResult[14] = info.Language
paResult[15] = "1033"
RETURN 15
END FUNCTION
FUNCTION IsNull(pobj) AS LOGIC
RETURN pobj == NULL
END FUNCTION
The AGetFileVersion() function needs to be changed, because FoxPro automatically allocates the array and adjusts the size when the array is too small.
And IsNull() will not work this way. FoxPro also returns TRUE for variables with the value .NULL.