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

View File

@@ -14,12 +14,12 @@ type
TForm1 = class(TForm) TForm1 = class(TForm)
Button1: TButton; Button1: TButton;
Button2: TButton; buttonUncompressAndShow: TButton;
editFileName: TFileNameEdit; editFileName: TFileNameEdit;
Label1: TLabel; Label1: TLabel;
memoOutput: TMemo; memoOutput: TMemo;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject); procedure buttonUncompressAndShowClick(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
@@ -52,7 +52,7 @@ begin
end; end;
end; end;
procedure TForm1.Button2Click(Sender: TObject); procedure TForm1.buttonUncompressAndShowClick(Sender: TObject);
var var
DestStream: TMemoryStream; DestStream: TMemoryStream;
i: Integer; i: Integer;
@@ -66,10 +66,7 @@ begin
for i := 0 to DestStream.Size-1 do for i := 0 to DestStream.Size-1 do
begin begin
lByte := DestStream.ReadByte(); lByte := DestStream.ReadByte();
{if not (lByte in [10, 13]) then}
lStr := lStr + Format('%x=%s ', [lByte, Char(lByte)]) lStr := lStr + Format('%x=%s ', [lByte, Char(lByte)])
{ else
lStr := lStr + Format('%x ', [lByte]);}
end; end;
memoOutput.Text := lStr; memoOutput.Text := lStr;
finally finally