From: Andreas H. <ah...@us...> - 2004-04-05 20:57:44
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12153/run Modified Files: JvZlibMultiple.pas Log Message: Fixed Delphi 5 compile error Index: JvZlibMultiple.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvZlibMultiple.pas,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** JvZlibMultiple.pas 5 Apr 2004 07:14:02 -0000 1.7 --- JvZlibMultiple.pas 5 Apr 2004 20:45:03 -0000 1.8 *************** *** 32,42 **** uses SysUtils, Classes, ! {$IFDEF VCL} Graphics, Controls, Dialogs, ! {$ENDIF VCL} ! {$IFDEF VisualCLX} QGraphics, QControls, QDialogs, Types, ! {$ENDIF VisualCLX} ! ZLib, JvComponent, JvJCLUtils; type --- 32,42 ---- uses SysUtils, Classes, ! {$IFDEF VCL} Graphics, Controls, Dialogs, ! {$ENDIF VCL} ! {$IFDEF VisualCLX} QGraphics, QControls, QDialogs, Types, ! {$ENDIF VisualCLX} ! ZLib, JvComponent; type *************** *** 53,56 **** --- 53,57 ---- protected procedure AddFile(FileName, Directory, FilePath: string; DestStream: TStream); + procedure DoProgress(Position, Total: Integer); virtual; public // compresses a list of files (can contain wildcards) *************** *** 83,90 **** implementation - {$IFNDEF COMPILER6_UP} uses ! FileCtrl, JvJCLUtils; ! {$ENDIF COMPILER6_UP} {*******************************************************} --- 84,92 ---- implementation uses ! {$IFNDEF COMPILER6_UP} ! FileCtrl, ! {$ENDIF !COMPILER6_UP} ! JvJCLUtils; {*******************************************************} *************** *** 183,188 **** Count := FileStream.Read(Buffer, SizeOf(Buffer)); ZStream.Write(Buffer, Count); ! if Assigned(FOnProgress) then ! FOnProgress(Self, FileStream.Position, FileStream.Size); until Count = 0; finally --- 185,189 ---- Count := FileStream.Read(Buffer, SizeOf(Buffer)); ZStream.Write(Buffer, Count); ! DoProgress(FileStream.Position, FileStream.Size); until Count = 0; finally *************** *** 269,274 **** ZStream: TDecompressionStream; CStream: TMemoryStream; ! B: Byte; ! Tab: array[1..256] of Char; S: string; Count, FileSize, I: Integer; --- 270,274 ---- ZStream: TDecompressionStream; CStream: TMemoryStream; ! B, LastPos: Byte; S: string; Count, FileSize, I: Integer; *************** *** 282,290 **** //Read and force the directory Stream.Read(B, SizeOf(B)); ! { (RB) Can be improved } ! Stream.Read(Tab, B); ! S := ''; ! for I := 1 to B do ! S := S + Tab[I]; ForceDirectories(Directory + S); if (Length(S) > 0) then --- 282,288 ---- //Read and force the directory Stream.Read(B, SizeOf(B)); ! SetLength(S, B); ! if B > 0 then ! Stream.Read(S[1], B); ForceDirectories(Directory + S); if (Length(S) > 0) then *************** *** 292,303 **** //This make files decompress either on Directory or Directory+SavedRelativePath ! if not RelativePaths then S := ''; //Read filename Stream.Read(B, SizeOf(B)); ! { (RB) Can be improved } ! Stream.Read(Tab, B); ! for I := 1 to B do ! S := S + Tab[I]; Stream.Read(FileSize, SizeOf(FileSize)); --- 290,304 ---- //This make files decompress either on Directory or Directory+SavedRelativePath ! if not RelativePaths then ! S := ''; //Read filename Stream.Read(B, SizeOf(B)); ! if B > 0 then ! begin ! LastPos := Length(S); ! SetLength(S, LastPos + B); ! Stream.Read(S[LastPos + 1], B); ! end; Stream.Read(FileSize, SizeOf(FileSize)); *************** *** 316,320 **** ZStream := TDecompressionStream.Create(CStream); try - if Assigned(FOnDecompressingFile) then FOnDecompressingFile(Self, S); --- 317,320 ---- *************** *** 324,329 **** Count := ZStream.Read(Buffer, SizeOf(Buffer)); FileStream.Write(Buffer, Count); ! if Assigned(FOnProgress) then ! FOnProgress(Self, FileStream.Size, FileSize); until Count = 0; --- 324,328 ---- Count := ZStream.Read(Buffer, SizeOf(Buffer)); FileStream.Write(Buffer, Count); ! DoProgress(FileStream.Size, FileSize); until Count = 0; *************** *** 355,358 **** --- 354,363 ---- end; + procedure TJvZlibMultiple.DoProgress(Position, Total: Integer); + begin + if Assigned(FOnProgress) then + FOnProgress(Self, Position, Total); + end; + end. |