|
@@ -37,12 +37,16 @@ uses
|
|
System.SysUtils,
|
|
System.SysUtils,
|
|
System.ZLib;
|
|
System.ZLib;
|
|
|
|
|
|
- function CompressString(const aStr : string) : string;
|
|
|
|
|
|
+type
|
|
|
|
+
|
|
|
|
+ TCompressionLevel = TZCompressionLevel;
|
|
|
|
+
|
|
|
|
+ function CompressString(const aStr : string; aLevel : TCompressionLevel = zcDefault) : string;
|
|
function DecompressString(const aStr: string) : string;
|
|
function DecompressString(const aStr: string) : string;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
-function CompressString(const aStr : string) : string;
|
|
|
|
|
|
+function CompressString(const aStr : string; aLevel : TCompressionLevel = zcDefault) : string;
|
|
var
|
|
var
|
|
strstream : TStringStream;
|
|
strstream : TStringStream;
|
|
zipstream : TStringStream;
|
|
zipstream : TStringStream;
|
|
@@ -51,7 +55,7 @@ begin
|
|
try
|
|
try
|
|
zipstream := TStringStream.Create('',TEncoding.ANSI);
|
|
zipstream := TStringStream.Create('',TEncoding.ANSI);
|
|
try
|
|
try
|
|
- ZCompressStream(strstream, zipstream);
|
|
|
|
|
|
+ ZCompressStream(strstream, zipstream, aLevel);
|
|
zipstream.Position := 0;
|
|
zipstream.Position := 0;
|
|
Result := zipstream.DataString;
|
|
Result := zipstream.DataString;
|
|
finally
|
|
finally
|