![]() |
|
ضغط الملفات بصيغة 7z من خلال دلفي - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي التقنية (https://delphi4arab.net/forum/forumdisplay.php?fid=6) +--- قسم : دلفي والتعامل مع الملفات (https://delphi4arab.net/forum/forumdisplay.php?fid=22) +--- الموضوع : ضغط الملفات بصيغة 7z من خلال دلفي (/showthread.php?tid=1577) |
ضغط الملفات بصيغة 7z من خلال دلفي - kachwahed - 28-01-2010 بسم الله الرحمن الرحيم
السلام عليكم7Zip Plugin API هو مكون مجاني في شكل مكتبة ربط DLL معه مكتبة PAS للاستعمال، يسمح بضغط/فك الضغط عن الملفات المضغوطة وفق الخوارزمية الشهيرة 7z، يدعم الصيغ التالية: PHP كود : T7zCompressionMethod = (m7Copy, m7LZMA, m7BZip2, m7PPMd, m7Deflate, m7Deflate64); طريقة الاستخدام سهلة جدا. موضحة في الرابط مع التحميل: كود : http://www.progdigy.com/?page_id=13أعددت مثال صغير في المرفقات: كود : http://i45.tinypic.com/33vg85d.jpgهناك أيضا مكتبات أخرى مجانية: - بأقل حجم 7-zip32.dll (من تأليف صيني ) مكتوبة على ++C، مرفقة ومعها مكتبة PAS للاستعمال.- بحجم أقل من ذلك مكتبة SevenZipVCL_074a ودعم SFX، مرفقة مع الأمثلة وطريقة الاستخدام، الموقع: كود : http://www.rg-software.de/كود : http://jcl.svn.sourceforge.net/viewvc/jcl/trunk/jcl/source/common/JclCompression.pas?view=markupكود : uses
JclCompression;
procedure TfrmSevenZipTest.Button1Click(Sender: TObject);
const
FILENAME = 'F:\temp\test.zip';
var
archiveclass: TJclDecompressArchiveClass;
archive: TJclDecompressArchive;
item: TJclCompressionItem;
s: String;
i: Integer;
begin
archiveclass := GetArchiveFormats.FindDecompressFormat(FILENAME);
if not Assigned(archiveclass) then
raise Exception.Create('Could not determine the Format of ' + FILENAME);
archive := archiveclass.Create(FILENAME);
try
if not (archive is TJclSevenZipDecompressArchive) then
raise Exception.Create('This format is not handled by 7z.dll');
archive.ListFiles;
s := Format('test.zip Item Count: %d'#13#10#13#10, [archive.ItemCount]);
for i := 0 to archive.ItemCount - 1 do
begin
item := archive.Items[i];
case item.Kind of
ikFile:
s := s + IntToStr(i+1) + ': ' + item.PackedName + #13#10;
ikDirectory:
s := s + IntToStr(i+1) + ': ' + item.PackedName + '\'#13#10;//'
end;
end;
if archive.ItemCount > 0 then
archive.ExtractAll('F:\temp\test'); //or archive.ExtractSelected
ShowMessage(s);
finally
archive.Free;
end;
end;ضغط الملفات بصيغة 7z من خلال دلفي - محمد عبد العزيز - 29-01-2010 كإضافة لمن هو مهتم بخواريزمية الضغط LZMA المستخدمة في 7Zip هناك Pascal LZMA SDK تحويل من C الى Pascal ; دلفي 7 كود : http://www.birtles.org.uk/programming/وبالتوفيق ضغط الملفات بصيغة 7z من خلال دلفي - محمد عبد العزيز - 11-02-2011 هناك ايضا LZMA2بالصيغة/اللاحقة الجديدة XZ كود : tukaani.org/xzضغط الملفات بصيغة 7z من خلال دلفي - onexite - 06-09-2014 PHP كود : program ZipFolder; {$APPTYPE CONSOLE} uses // Add a ZipForge unit to the program SysUtils, ZipForge, Classes; var archiver : TZipForge; begin // Create an instance of the TZipForge class archiver := TZipForge.Create(nil); try with archiver do begin // Set the name of the archive file we want to create FileName := 'C:\test.zip'; // Because we create a new archive, // we set Mode to fmCreate OpenArchive(fmCreate); // Set base (default) directory for all archive operations BaseDir := 'C:\'; // Add the c:\Test folder to the archive with all subfolders AddFiles('C:\Test\*.*'); CloseArchive(); end; except on E: Exception do begin Writeln('Exception: ', E.Message); // Wait for the key to be pressed Readln; end; end; end. كود : http://www.componentace.com/zip_component_zip_delphi_zipforge.htm |