Autor Beitrag
dirkil2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Di 11.01.05 10:21 
Ich würde gerne alle Files aus einem ZIP File in ein Directory enpacken. Geht das mit der ZLIB?
Wenn das ZIP File aus nur einem einzigen File besteht, mache ich das so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.DeCompressStreamToFile( var src: TMemoryStream; destfilename: String );
var
  dest: TFileStream;
  ZStream: TCustomZLibStream;
  Count: Integer;
  Buffer: array[0..BufferSize-1] of Byte;
begin
    dest := TFileStream.Create(destfilename,fmCreate);
    src.Position := 0;
    ZStream := TDecompressionStream.Create(src);
    while True do
    begin
      Count := ZStream.Read(Buffer, BufferSize);
      if Count <> 0 then
        dest.WriteBuffer(Buffer, Count)
      else
        Break;
    end;
    ZStream.Free;
    src.Position := 0;
    dest.Free;

end;


Aber wie gehts mit mehreren?

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Di 11.01.05 15:30 
dirkil2 hat folgendes geschrieben:
Geht das mit der ZLIB?

Nein.

_________________
Ciao, Sprint.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Di 11.01.05 16:02 
Sprint hat folgendes geschrieben:
dirkil2 hat folgendes geschrieben:
Geht das mit der ZLIB?
Nein.
Doch.

www.wotsit.org/searc...page=2&s=archive


@dirkil2: erstaunlich, daß das mit normalen ZIP-Dateien funktioniert :gruebel:

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Mi 12.01.05 08:52 
@tommie-lie

Vielen Dank für den Hinweis, aber bekommst Du den Code compiliert? Ich bekomme immer die Fehlermeldung:

[Fataler Fehler] Project1.dpr(23): Unit StdActns wurde mit einer unterschiedlichen Version von StrUtils.TStringSearchOptions compiliert
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Mi 12.01.05 09:32 
Bin fündig geworden. Es gibt die DelphiZip Komponenten (www.dsdt.info/tutorials/delphizip/) , die eine Betrachtung wert sind. Ich habe sie installiert und mein ZIP-Archiv entpackt. Funktioniert einwandfrei. Ob die anderen Funktionen auch so gut klappen, kann ich noch nicht sagen.