AGetFileVersion() Method
Creates an array containing detailed information for a file Note: Params 13 and 15 are not implemented. Param 13 specifies if file can self register and param 15 specified the translation code.
[VisualBasic]
Public Shared Function AGetFileVersion(ByRef aFileInfoArray() As String, ByVal cFileName As String) As Integer
[C#]
public static int AGetFileVersion(ref string[] aFileInfoArray, string cFileName)
Example
[VisualBasic]
Fills MyArray with detailed information about the file
Dim laArray() As String
AGetFileVersion(laArray, GetFile()) 'Call GetFile() dialog
Dim lnI As Integer
For lnI = 0 To laArray.Length - 1
Console.WriteLine(laArray(lnI))
Next
[C#]
//Create an array of type string and pass it by reference to the AGetFileVersion() along with the name of the file
//Fills MyArray with detailed information about the file
string[] MyArray = new string[0];
int i = VFPToolkit.arrays.AGetFileVersion(ref MyArray, "c:\\visio10\\gdiplus.dll");
Tip: Note the use of double backslash \\ as a separator. In C# the backslash is used to specify escape sequence so you need to specify the \\ as a separator or specify the path using the @"c:\MyPath\MyFile".
Implementation
[VisualBasic]
Public Shared Function AGetFileVersion(ByRef aFileInfoArray() As String, ByVal cFileName As String) As Integer
'Create the FileVersionInfo object from System.Diagnostics and pass the FileName for which we want to get information
Dim fvi As System.Diagnostics.FileVersionInfo = FileVersionInfo.GetVersionInfo(cFileName)
'Specify the right dimensions for the array
aFileInfoArray = New String(15) {}
'Fill the array the right values
aFileInfoArray(0) = fvi.Comments
aFileInfoArray(1) = fvi.CompanyName
aFileInfoArray(2) = fvi.FileDescription
aFileInfoArray(3) = fvi.FileVersion
aFileInfoArray(4) = fvi.InternalName
aFileInfoArray(5) = fvi.LegalCopyright
aFileInfoArray(6) = fvi.LegalTrademarks
aFileInfoArray(7) = fvi.OriginalFilename
aFileInfoArray(8) = fvi.PrivateBuild
aFileInfoArray(9) = fvi.ProductName
aFileInfoArray(10) = fvi.ProductVersion
aFileInfoArray(11) = fvi.SpecialBuild
aFileInfoArray(12) = ""
aFileInfoArray(13) = fvi.Language
aFileInfoArray(14) = ""
'Return the number of items back
Return aFileInfoArray.Length
End Function
[C#]
public static int AGetFileVersion(ref string[] aFileInfoArray, string cFileName)
{
//Create the FileVersionInfo object from System.Diagnostics and pass the FileName for which we want to get information
System.Diagnostics.FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(cFileName);
//Specify the right dimensions for the array
aFileInfoArray = new string[15];
//Fill the array the right values
aFileInfoArray[0] = fvi.Comments;
aFileInfoArray[1] = fvi.CompanyName;
aFileInfoArray[2] = fvi.FileDescription;
aFileInfoArray[3] = fvi.FileVersion;
aFileInfoArray[4] = fvi.InternalName;
aFileInfoArray[5] = fvi.LegalCopyright;
aFileInfoArray[6] = fvi.LegalTrademarks;
aFileInfoArray[7] = fvi.OriginalFilename;
aFileInfoArray[8] = fvi.PrivateBuild;
aFileInfoArray[9] = fvi.ProductName;
aFileInfoArray[10] = fvi.ProductVersion;
aFileInfoArray[11] = fvi.SpecialBuild;
aFileInfoArray[12] = "";
aFileInfoArray[13] = fvi.Language;
aFileInfoArray[14] = "";
//Return the number of items back
return aFileInfoArray.Length ;
}
Requirements
Namespace:VFPToolkit
Class:VFPToolkit.files
Platforms:Windows98, WindowsNT4.0, WindowsMillenniumEdition, Windows2000, WindowsXPHomeEdition, WindowsXPProfessional, Windows.NETServerfamily
Assembly:VFPToolkit (in VFPToolkitNET.dll)
See Also
VFPToolkit.files Members | VFPToolkit Namespace