FileSystem classby Allan Greis Eriksen
cFileSystem ClassIntroductionThis class is a redesign of the akefs.pkg package that I made many years ago for Visual DataFlex 5 and up. This is still available at https://www.vdf-guidance.com but it is using some very old technique and all methods are global. It also makes use of some global variables. Not very object oriented, so I decided to make a class of it all. The cFilesystem class is based on a cObject class and makes use of the new native array and struct options. It also uses the variable type BigInt for file sizes. Therefore it is necessary to use a recent version of Visual DataFlex. I made this class with Visual DataFlex 15.0 but it should be possible to use the class down to Visual DataFlex 11.0. This class also breaks the 2GB file limit that the old akefs.pkg has. Now you can use this class to handle huge files in theory up to 9 EB (etabyte) files! Another design goal was to speed up the file access and the transfer of data between methods. You will notice that some of the methods will take parameters by reference instead of by value. Further more you can now subclass and argument the methods for your own need. During the rewrite I killed to methods called RecursiveRemoveDirectory and RecursiveCopyDirectory. The purpose of these functions was to remove or copy a directory with all its children. While they worked okay, the where somewhat slow in the process. If you still need this functionality I recommend using the shell methods with vWin32fh.pkg by Wil van Antwerpen. This class is open source and you may use it in commercial or non-commercial software free of charge. For more information, see VDF GUIdance Open License Statement. Help fileThe class comes with a CHM help file and all methods have been carefully documented and come with examples in the help file. You are strongly encouraged to check the helpfile when looking for answers. Here's the content of the introduction page of that help file to give you an idea: The cFilesystem class is a collection of functions to access files and directories through windows kernel API.
This help file is divided into three sections.
All filenames used in this class is in OEM format. Any method that return filenames are also in OEM format. You do not have to worry about converting filenames into ANSI format to be able to access filenames with international characters. This is all taking care of by the cFilesystem class. There are also some helper methods included. These are used by other parts of cFilesystem you can use them to if you find them useful. Example of use: You may want to create an object of this class in your .src file like this: Use cFilesystem.pkg Object oFilesystem is a cFilesystem End_Object This ensures that you have easy access to the filesystem object from all over your application. But this is not a requirement. You can easily create an object of the cFilesystem class i.e. in a view where it is needed. In the example code for the rest of this help file it is assumed that there is an object called oFilesystem of the cFilesystem class instantiated earlier in the application like the example above. Download2021-05-16 cFileSystem.zip ~ 72kB 2019-09-14 cFileSystem.zip ~ 72kB 2018-09-04 cFileSystem.zip ~ 70kB 2015-08-11 cFileSystem.zip ~ 69kB 2015-07-01 cFileSystem.zip ~ 66kB 2012-01-13 cFileSystem.zip ~ 61kB 2010-08-11 cFileSystem.zip ~ 61kB List of Changes2021/05/16Added Unicode & 64 bit support for DataFlex 20 Supported from DataFlex 19.1 and higher
2019/09/14Fixed warnings that showed up in DataFlex 19.1 and code cleanup. Supported from DataFlex 19.1 and higher. 2018/09/04This is now a library and supported from DataFlex 18.1 and higher. Added new method Set/Get FileLastWriteTime 2015/08/11This one has added a function called FileVersion. This will give you the file version information from the specified file. Information like Company name, File description, Product version and information like the file contains debug information, if it is designed for 32 bit windows or DOS, the file contains a font and loads more. Check out the VS_FIXEDFILEINFO structure from MSDN for more info 2015/07/21Added a Buffer to reading a binary files. Added BinaryFileReadCachedUntilMatch, BinaryFileReadCachedCSV and BinaryFileReadCachedLN that reads using the buffer. Added BinaryFileCachedPosition that can be set and get. BinaryFileEndOfFile added that returns if the last read from the binary file had reached the end. FileExtention function that returns the file extention. FileSearchRecursive function added to search in subdirectories. Changed the filename conversion in FileSearch so it is done faster. RemoveExtention function added that removes/split the file extention from a filename. Fixed missing errornumber fix as reported in Error in error reporting forum post. Help.chm - Small changes in documentation for BinaryFileRead and BinaryFileWrite. |
|||||||||||
Copyright © 1999 - 2024 VDF-GUIdance on all material published, for details see our Disclaimer. |