From 4a386482fa416d97bb11ce59eacd8a20b681d098 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 3 Apr 2013 11:13:44 +0000 Subject: [PATCH] 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 --- .../fpvviewer/uncompressor/mainform.lfm | 30 +++++++++++++++++-- .../fpvviewer/uncompressor/mainform.pas | 28 +++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/applications/fpvviewer/uncompressor/mainform.lfm b/applications/fpvviewer/uncompressor/mainform.lfm index 35dab178f..a205dda5d 100644 --- a/applications/fpvviewer/uncompressor/mainform.lfm +++ b/applications/fpvviewer/uncompressor/mainform.lfm @@ -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 diff --git a/applications/fpvviewer/uncompressor/mainform.pas b/applications/fpvviewer/uncompressor/mainform.pas index b9b24271c..eaa66dee5 100644 --- a/applications/fpvviewer/uncompressor/mainform.pas +++ b/applications/fpvviewer/uncompressor/mainform.pas @@ -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;