TJclCompressArchive (project Jedi). How to select a compression format?

1.8k views Asked by At

Using Delphi XE on Win7 x64, have Jedi Class Library ver. 3.45, and 7z.dll ver. 9.20,

Uses .., jclcompression;

procedure TForm1.Button1Click(Sender: TObject);
const
   an = 'C:\1.7z';
   fn = 'C:\1.txt';
var Arc: TJclCompressArchive;
    Ext: TJclCompressArchiveClass;

begin
   Ext := GetArchiveFormats.FindCompressFormat(an);
   Arc := Ext.Create(an);
   Arc.AddFile(ExtractFileName(fn), fn);
   Arc.Password:='123';

   // arc. .. compresslevel:= 0..9 (or store..ultra)
   // arc. .. compressmethod:= (lzma,lzma,bzip2,ppmd)
   // arc. .. dictionarysize:= (1 shl 1..30)
   // arc. .. comressheader:= true-false
   // arc. .. cryptalgorithm:= ??? aes256 only?
   // arc. .. threads:= 1..2
   // arc. .. cryptheader:= true-false

   Arc.Compress;

end;

How do I select the compression options shown above as comments with "//"?

Jedi documentation is practically nil, there can be someone faced such problem?

Tried some different versions of "job" with 7z: tSevenZip, SevenZipVcl, SevenZip Api, but has come to conclusion, that the freshest version for job with 7z.dll at project Jedi.

1

There are 1 answers

2
ain On BEST ANSWER

The 7z specific parameters are implemented by TJcl7zCompressArchive class so thats what you have to use... try something like

Ext := GetArchiveFormats.FindCompressFormat(an);
if(Ext <> nil)and(Ext.InheritsFrom(TJcl7zCompressArchive))then begin
   Arc := Ext.Create(an);
   TJcl7zCompressArchive(Arc).SetCompressionLevel(9);
   TJcl7zCompressArchive(Arc).SetCompressHeader(True);
   ...
end;