adds more debug info to the uncompressor

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2718 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2013-04-03 11:13:44 +00:00
parent 60bdc5be13
commit 4a386482fa
2 changed files with 56 additions and 2 deletions

View File

@ -1,10 +1,10 @@
object Form1: TForm1
Left = 241
Height = 121
Height = 357
Top = 161
Width = 320
Caption = 'GZ Uncompressor'
ClientHeight = 121
ClientHeight = 357
ClientWidth = 320
LCLVersion = '1.1'
object editFileName: TFileNameEdit
@ -37,4 +37,30 @@ object Form1: TForm1
Caption = 'File to be uncompressed:'
ParentColor = False
end
object Button2: TButton
Left = 16
Height = 25
Top = 120
Width = 288
Caption = 'Uncompress to a memory stream and show it'
OnClick = Button2Click
TabOrder = 2
end
object memoOutput: TMemo
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 16
Height = 179
Top = 168
Width = 294
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
Lines.Strings = (
'memoOutput'
)
TabOrder = 3
end
end

View File

@ -14,9 +14,12 @@ type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
editFileName: TFileNameEdit;
Label1: TLabel;
memoOutput: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
@ -49,6 +52,31 @@ begin
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
DestStream: TMemoryStream;
i: Integer;
lStr: string;
lByte: Byte;
begin
DestStream := TMemoryStream.Create();
try
InflateGZ(editFileName.Text, DestStream);
DestStream.Position := 0;
for i := 0 to DestStream.Size-1 do
begin
lByte := DestStream.ReadByte();
{if not (lByte in [10, 13]) then}
lStr := lStr + Format('%x=%s ', [lByte, Char(lByte)])
{ else
lStr := lStr + Format('%x ', [lByte]);}
end;
memoOutput.Text := lStr;
finally
DestStream.Free;
end;
end;
procedure TForm1.InflateGZ(AGZFilename: string; ADest: TStream);
var
GZStream: TGZFileStream;