Skip to content

Conversation

@Irwin1985
Copy link
Contributor

Hi Team,

This PR implements AGETFILEVERSION() in ArrayFunctions.prg.

  • Logic: Uses System.Diagnostics.FileVersionInfo to extract metadata from files (EXE, DLL, etc.).
  • Output: Returns the standard VFP 15-element array.
  • Mapping: Mapped .NET properties to VFP array positions (Comments, CompanyName, FileVersion, etc.).
  • Handling: Handles null properties gracefully (converting to empty strings as per VFP behavior).

Limitations:

  • Elements 13 (OLE Self Register) and 15 (Translation Code) are currently returned as empty strings, as FileVersionInfo does not expose the raw Win32 resource data required for these specific fields.

Irwin.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements the AGetFileVersion() function in the XSharp VFP runtime, which extracts file version information from executable files and DLLs. The function uses .NET's System.Diagnostics.FileVersionInfo class to populate a 15-element array with metadata such as company name, file version, product name, and other version resource properties.

Changes:

  • Implemented AGetFileVersion() function with error handling and null-safe property access
  • Added unit tests covering basic functionality and error scenarios
  • Removed the TODO placeholder from ToDo-A.prg

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Runtime/XSharp.VFP/ToDo-A.prg Removed TODO placeholder for AGetFileVersion function
src/Runtime/XSharp.VFP/ArrayFunctions.prg Implemented AGetFileVersion function with FileVersionInfo integration and proper error handling
src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj Added FileVersionTests.prg to the test project
src/Runtime/XSharp.VFP.Tests/FileVersionTests.prg Added unit tests for AGetFileVersion covering success and failure scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@RobertvanderHulst RobertvanderHulst merged commit cd9f6e2 into dev Jan 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants