Sedang Disiapkan

Create two simple but threaded Delphi file access classes

Implement in Delphi 2010 (or compatible) the following two threaded classes:

TThreadedFileExtCollector

* This class will receive as an input a directory path (e.g. 'c:\', or 'd:\stuff\'), from this directory path, including its sub-directories, the thread will iterate all the files and return to the main program thread (i.e. the piece of code that called the thread) a TStringList with all the file extensions. The result list must not contain duplicate lines. An example of a result list could be:

.exe

.dll

.jpg

.txt

The class must contain a method of aborting the iteration from the main program thread, for example, a Kill() method, which would without any further delay stop the directory structure iteration and return the result list.

TThreadedFileVerificator

* This class will receive as an input two TStringLists: 1) VerifyExtList and 2) VerifyAttribList.

The VerifyExtList input string list contains a list of filenames and paths. The class will go through the VerifyExtList string list and verifies the given file or directory exists, if it doesn't exist, it is created. An example VerifyExtList could be:

c:\foobar\

c:\qwerty\[url removed, login to view]

Note: If the input list line is a filename, it is possible that the directory of the filename doesn't exist either, in such case it must be created. For example, if the line is "c:\qwerty\[url removed, login to view]" and the file doesn't exist, the code must first check if "c:\qwerty" directory exists, if it doesn't, it is created, and after that an empty "[url removed, login to view]" is created to the directory.

After VerifyExtList has been gone through, the class will go through the VerifyAttribList. It too contains a list of filenames and paths. The given filenames and paths may or may not exist. If the input line is a filename, the class will verify that the file doesn't have the ReadOnly attribute set. If it is set, the attribute is removed. If the input line is a directory path, the class will check that all the files in this directory (not the sub-directories) do not have the ReadOnly attribute set. If any such file is found, the attribute is removed.

The class must provide a mechanism for the main program thread to wait for the thread's completion. For example, the main program thread could do While [url removed, login to view]() do [url removed, login to view]; which would break when the thread has processed both the input lists.

Note: It is possible that either of the input lists contains filenames or paths that point to a disk drive that cannot be modified (e.g. a cd-rom) and thus the content cannot be changed (e.g. it's not possible to create a new directory to a cd-rom). In such case, the class must simply proceed to the next line of the input list without raising an exception and without Windows showing any error messages.

Kemahiran: Delphi

Lihat lebih lanjut: threaded, create two, create a simple program, create delphi dll, found log files, found raising, delphi file, program exe access, class log found, delphi files, simple access example, duplicate file, check attribute, windows dll create, iteration delphi, create exe file dll, program stop wait, file exe access, delphi string contains, rom note, file access, create check file, exe file access file, delphi access, create error log file

Tentang Majikan:
( 591 ulasan ) Turku, Thailand

ID Projek: #4085084

Dianugerahkan kepada:

gyk

Hello, I am happy to create these classes for you.

$111 USD dalam sehari
(8 Ulasan)
4.2

2 freelancers are bidding on average $131 for this job

qspsolutions

Details in PMB.

$150 USD dalam 0 hari
(17 Ulasan)
5.6