A few missing VFP functions

This forum is meant for questions and discussions about the XSharp Tools libraries, which contain code written by XSharp users that they want to share with others,
The development team is not responsible for this code

Moderator: wriedmann

Post Reply
b2k
Posts: 20
Joined: Thu Oct 06, 2022 5:53 pm
Location: USA

A few missing VFP functions

Post by b2k »

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.

Code: Select all

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
User avatar
robert
Posts: 5038
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: A few missing VFP functions

Post by robert »

Brian,
Thanks for the code snippets. We'll take a look and will integrate them in our product.
We will most likely clean them up a bit, because inside the runtime we prefer to type the variables (such as the locals) and we also prefer to use functions over commands such as SEEK and SET ORDER TO

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply