improved uncompress subproject

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2719 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2013-04-03 12:12:34 +00:00
parent 4a386482fa
commit 265fe232b5
2 changed files with 10 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ object Form1: TForm1
object Button1: TButton
Left = 16
Height = 25
Top = 80
Top = 64
Width = 288
Caption = 'Uncompress gz'
OnClick = Button1Click
@@ -37,13 +37,13 @@ object Form1: TForm1
Caption = 'File to be uncompressed:'
ParentColor = False
end
object Button2: TButton
object buttonUncompressAndShow: TButton
Left = 16
Height = 25
Top = 120
Top = 96
Width = 288
Caption = 'Uncompress to a memory stream and show it'
OnClick = Button2Click
OnClick = buttonUncompressAndShowClick
TabOrder = 2
end
object memoOutput: TMemo
@@ -52,8 +52,8 @@ object Form1: TForm1
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 16
Height = 179
Top = 168
Height = 219
Top = 128
Width = 294
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 10

View File

@@ -14,12 +14,12 @@ type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
buttonUncompressAndShow: TButton;
editFileName: TFileNameEdit;
Label1: TLabel;
memoOutput: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure buttonUncompressAndShowClick(Sender: TObject);
private
{ private declarations }
public
@@ -52,7 +52,7 @@ begin
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
procedure TForm1.buttonUncompressAndShowClick(Sender: TObject);
var
DestStream: TMemoryStream;
i: Integer;
@@ -66,10 +66,7 @@ begin
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]);}
lStr := lStr + Format('%x=%s ', [lByte, Char(lByte)])
end;
memoOutput.Text := lStr;
finally