Forum > General
[ SOLVED ]Abbrevia
DanishMale:
I try to create a ZIP-file which it does, however, there are no file inside the ZIP-file ... it is simply empty??
It is expected to see a file called EEO.db3 inside the ZIP-file, but as you can see on the image there is no file there
Just a follow up question... which unit defines soStripDrive,soStripPath,soReplace for Abbrevia ?
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ZipBtnClick(Sender: TObject);var Zip : TAbZipper; ZipFileName: String;begin try ZipFileName := BackupFileFolderEdit.Text+FormatDateTime('YYYYMMDD', Now())+'.EEO_Backup.zip'; Zip := TAbZipper.Create(Application); Zip.LogFile := BackupFileFolderEdit.Text+FormatDateTime('YYYYMMDD', Now())+'.zip.log'; Zip.Logging := True; Zip.ArchiveType := atZip; Zip.BaseDirectory := ExtractFilePath(ZipFileName); Zip.TempDirectory := GetTempDir; Zip.CompressionMethodToUse := smBestMethod; Zip.DeflationOption := doNormal; // Zip.StoreOptions := [soStripDrive,soStripPath,soReplace]; Zip.FileName := ZipFileName; Zip.AddFiles(ExtractFilePath(Application.ExeName)+'EEO.db3',0); Zip.Save; Zip.CloseArchive; Zip.Free; except on E: Exception do begin ShowMessage(E.Message); end; end;end;
I wonder what I am missing out here....
Thx in advance
jamie:
Looks like a component meant for Delphi.
Lazarus has in its Libraries the component TZipper, and it works.
wp:
In addition to what jamie wrote:
https://wiki.freepascal.org/paszlib
https://www.freepascal.org/docs-html/fcl/zipper/index.html
The FPC TZipper works very well. It used in fpspreadsheet to write Excel xlsx and LibreOffice ods files. I would not even think of replacing it by the famous, but unmaintained Abbrevia library.
jamie:
I am slowly porting over a specialized CAD type of app that I prefer to preload lots of footprints from custom formats and I use the Zipper to do memory compression to keep them loaded in memory at all times.
You would be surprised at how many footprints I can get in memory doing that.
I don't have any performance issues because the ones that I am currently viewing, keeping alive are in their native state at that time.
Ericktux:
hello friend I use it like this with abbrevia:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses . . . . AbZipper, AbUnzper; -----------procedure TForm1.Button1Click(Sender: Tobject); // COMPRIMIRvar Zip : TAbZipper; begin Zip := TabZipper.Create(Application); //zip.BaseDirectory := 'C:\Agenda TUX\'; // path del archivo a zipear, si no hay zipea todo el arbol zip.FileName:= 'prueba.zip'; // archivo salida, si usamos “BaseDirectory” usar “'C:\Agenda TUX\'prueba.zip” Zip.AddFiles('ericktux.txt',0); // el archivo para zipear y “0” para que no toque otros archivos // Zip.Password := '123'; // agregarle passwords zip.Save; zip.Free; End; procedure TForm1.Button2Click(Sender: Tobject); // DESCOMPRIMIRvar uZip : TAbUnZipper; begin uZip := TabUnZipper.Create(Application); //uzip.BaseDirectory := 'C:\Agenda TUX\'; uZip.FileName:= 'prueba.Zip'; // archivo salida, si usamos “BaseDirectory” usar “'C:\Agenda TUX\'prueba.zip” // uZip.Password := '123'; // descomprimir con passwords uZip.ExtractFiles('ericktux.txt'); // archivo dentro del ZIP a extraer //uZip.CloseArchive; uZip.Free; End;
with "zipper" I use it like this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---usesZipper; . . . . . // COMPRESSvar Zipper: TZipper;begin Zipper:=TZipper.Create; try Zipper.FileName:='archive.zip'; Zipper.Entries.AddFileEntry('appnote.txt'); Zipper.ZipAllFiles; finally FreeAndNil(Zipper) end;End; // DESCOMPRESSfunction descomprimir_zip(File_ZIP, UnPackPath: String):Boolean;var UnZipper: TUnZipper;beginResult:=false; UnZipper := TUnZipper.Create; try try UnZipper.FileName := File_ZIP; UnZipper.OutputPath := UnPackPath; UnZipper.Examine; UnZipper.UnZipAllFiles; Result:=true; except { on E: Exception do Write(E.Message); // ejemplo ShowMessage(E.Message); } Result:=false; end; finally UnZipper.Free; end;end; // EXAMPLE: if descomprimir_zip('C:\Users\Win10\AppData\Local\Temp\myfiles\tool.zip','C:\ericktux_software') then ShowMessage('exito') else ShowMessage('error');
I hope it works for you brother, regards
Navigation
[0] Message Index
[#] Next page