Autor Beitrag
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Mo 08.09.03 12:54 
Hi,

ich brauche ein simples Komprimierungstool, je einfach und kleiner um so besser. Als Kommandozeilen-Version. Oder gibts da irgendeine Komponente für Delphi? Das wäre mir fast noch lieber, dann mach ich mir selber ein Programmchen. Kommt jetzt aber nicht und sagt: suchen. Da ist viel zuviel vorhanden. Absolut unüberschaubar.

_________________
Gruß
Hansa
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Mo 08.09.03 14:26 
TCompressionStream + F1
TDecompressionStream + F1

barfuesser
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 08.09.03 15:32 
barfuesser hat folgendes geschrieben:
TCompressionStream + F1
TDecompressionStream + F1

Ab welcher Version sind die Komponenten in Delphi vorhanden?

Gruß
Tino
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 08.09.03 16:13 
Gehört das nicht zur undokumentierten ZLib?
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Mo 08.09.03 17:15 
Also bei D7 Enterprise sind die beiden Streams dabei. Und sie kommen aus der ZLib. Sie sind auch ganz normal über die Hilfe aufzurufen. Falls nur die Doku fehlt, könnte ich Euch morgen genauere Infos liefern.

barfuesser
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 08.09.03 21:21 
zlib einbinden


ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
// V 1.0 By Knorkwarz

unit Packer;

interface

uses Windows;

procedure CompressFile(FileName: string); overload;
procedure CompressFile(sfrom, sto: string); overload;
procedure DeCompressFile(FileName: string); overload;
procedure DeCompressFile(sfrom, sto: string); overload;
procedure DeCompressFile(filename: string; var pout: Pointer); overload;
procedure CompressFile(FileName: string; var pin: Pointer); overload;

function FileExists(const FileName: string): Boolean;

implementation

uses ZLib;

procedure DeCompressFile(filename: string; var pout: Pointer);
var
 f: File of byte;
 pIn: Pointer;
 sizeRead,sizeWrite: integer;
begin
 pIn := nil; pOut := nil;
 assignfile(f, FileName);
 reset(f);
 try
  getmem(pIn, FileSize(f));
  BlockRead(f, pIn^, FileSize(f), sizeRead);
  DeCompressBuf(pIn, sizeRead, sizeRead, pOut, sizeWrite);
 finally
  if pIn <> nil then freemem(pIn);
  CloseFile(f);
 end;
end;

function FileExists(const FileName: string): Boolean;
var
  f: TWin32FindData;
  handle: THandle;
begin
  handle := FindFirstFile(pChar(FileName), f);
  result := (handle <> INVALID_HANDLE_VALUE);
  FindClose(Handle);
end;

procedure CompressFile(FileName: string; var pin: Pointer); overload;
var
 f: File of byte;
 pOut: Pointer;
 sizeRead,sizeWrite: integer;
begin
 pIn := nil; pOut := nil;
 assignfile(f, FileName);
 reset(f);
 try
  getmem(pIn, FileSize(f));
  BlockRead(f, pIn^, FileSize(f), sizeRead);
  CompressBuf(pIn, sizeRead, pOut, sizeWrite);
  ReWrite(f);
  BlockWrite(f, pOut^, sizeWrite);
 finally
  if pOut <> nil then freemem(pOut);
  CloseFile(f);
 end;
end;


procedure CompressFile(FileName: string); overload;
var
 f: File of byte;
 pIn,pOut: Pointer;
 sizeRead,sizeWrite: integer;
begin
 pIn := nil; pOut := nil;
 assignfile(f, FileName);
 reset(f);
 try
  getmem(pIn, FileSize(f));
  BlockRead(f, pIn^, FileSize(f), sizeRead);
  CompressBuf(pIn, sizeRead, pOut, sizeWrite);
  ReWrite(f);
  BlockWrite(f, pOut^, sizeWrite);
 finally
  if pIn <> nil then freemem(pIn);
  if pOut <> nil then freemem(pOut);
  CloseFile(f);
 end;
end;

procedure DeCompressFile(FileName: string); overload;
var
 f: File of byte;
 pIn,pOut: Pointer;
 sizeRead,sizeWrite: integer;
begin
 pIn := nil; pOut := nil;
 assignfile(f, FileName);
 reset(f);
 try
  getmem(pIn, FileSize(f));
  BlockRead(f, pIn^, FileSize(f), sizeRead);
  DeCompressBuf(pIn, sizeRead, sizeRead, pOut, sizeWrite);
  ReWrite(f);
  BlockWrite(f, pOut^, sizeWrite);
 finally
  if pIn <> nil then freemem(pIn);
  if pOut <> nil then freemem(pOut);
  CloseFile(f);
 end;
end;

procedure CompressFile(sfrom, sto: string); overload;
begin
 if FileExists(sto) then DeleteFile(pchar(sto));
 CopyFile(pchar(sfrom), pchar(sto), true);
 CompressFile(sto);
end;

procedure DeCompressFile(sfrom, sto: string); overload;
begin
 if FileExists(sto) then DeleteFile(pchar(sto));
 CopyFile(pchar(sfrom), pchar(sto), true);
 DeCompressFile(sto);
end;

end.
hansa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Mo 08.09.03 21:35 
Das sieht auf den ersten Blick gut aus, bis auf Blockread, damit habe ich ungute Erfahrungen. Wird aber wohl kaum anders gehen. Und das sieht nach einzelnen Dateien aus. Sogar der alte Lharc kannte den *. Trotzdem erstmal Danke.

_________________
Gruß
Hansa