Function SaveString(Data : TStringList; Filename, Password : String; Compress : Boolean) : Integer;
Function LoadString(var Data : TStringList; Filename, Password : String) : Integer;
Which save a contents of a TStringList to a file and also reads it back. The data is always compressed when saved, and if password is provided, the data is also encrypted after compression using DEC encryption library.
Please see below for the detailed specs. Included is the DEC encryption library and SynZIP compression library which you may use, you can also use an alternative compression library assuming it's free to use and comes with source code (and works with Delphi 2010).
Implement Function SaveString(Data : TStringList; Filename, Password : String; Compress : Boolean) : Integer;
Which saves the given StringList data to the file (overwrites the file content if file exists), using encryption IF and ONLY IF password <> '' and compresses the data before encryption if Compress = True.
The encryption must be implemented using DEC version 5.2 (included)
The compression algorithm can be anything, as long as it with Delphi or asm source code. No DLLs or any other third party files must be required. Must be free to use in commercial, closed source software.
For example, you can use SynZIP (also included).
Also implement Function LoadString(var Data : TStringList; Filename, Password : String) : Integer;
Which reads data written to disk with SaveString. The LoadString function must automatically detect whether the data is compressed and decompress it if needed. If Password <> '', then the given password is used to decrypt the data.
The read, (possibly) decompressed and decrypted data is returned via the Data parameter variable.
The functions returns 0 if no error occurs, and an error code in a case of error.
The functions must be compatible with Delphi 2010 and with unicode data.