diff --git a/applications/fpvviewer/uncompressor/mainform.lfm b/applications/fpvviewer/uncompressor/mainform.lfm new file mode 100644 index 000000000..35dab178f --- /dev/null +++ b/applications/fpvviewer/uncompressor/mainform.lfm @@ -0,0 +1,40 @@ +object Form1: TForm1 + Left = 241 + Height = 121 + Top = 161 + Width = 320 + Caption = 'GZ Uncompressor' + ClientHeight = 121 + ClientWidth = 320 + LCLVersion = '1.1' + object editFileName: TFileNameEdit + Left = 8 + Height = 23 + Top = 32 + Width = 264 + FileName = 'D:\lazarusccr\applications\fpvviewer\examples_files\svgz\tassu_20130329_b.svgz' + FilterIndex = 0 + HideDirectories = False + ButtonWidth = 23 + NumGlyphs = 1 + MaxLength = 0 + TabOrder = 0 + end + object Button1: TButton + Left = 16 + Height = 25 + Top = 80 + Width = 288 + Caption = 'Uncompress gz' + OnClick = Button1Click + TabOrder = 1 + end + object Label1: TLabel + Left = 8 + Height = 15 + Top = 15 + Width = 132 + Caption = 'File to be uncompressed:' + ParentColor = False + end +end diff --git a/applications/fpvviewer/uncompressor/mainform.pas b/applications/fpvviewer/uncompressor/mainform.pas new file mode 100644 index 000000000..b9b24271c --- /dev/null +++ b/applications/fpvviewer/uncompressor/mainform.pas @@ -0,0 +1,75 @@ +unit mainform; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, EditBtn, + StdCtrls; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + editFileName: TFileNameEdit; + Label1: TLabel; + procedure Button1Click(Sender: TObject); + private + { private declarations } + public + { public declarations } + procedure InflateGZ(AGZFilename: string; ADest: TStream); + end; + +var + Form1: TForm1; + +implementation + +uses zstream; + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.Button1Click(Sender: TObject); +var + DestStream: TFileStream; + lDestFilename: string; +begin + lDestFilename := Copy(editFileName.Text, 1, Length(editFileName.Text)-1); + DestStream := TFileStream.Create(lDestFilename, fmCreate); + try + InflateGZ(editFileName.Text, DestStream); + finally + DestStream.Free; + end; +end; + +procedure TForm1.InflateGZ(AGZFilename: string; ADest: TStream); +var + GZStream: TGZFileStream; + chunk:string; + cnt:integer; +const + CHUNKSIZE=4096; +begin + GZStream := TGZFileStream.Create(AGZFilename, gzopenread); + try + setlength(chunk,CHUNKSIZE); + repeat + cnt := GZStream.read(chunk[1],CHUNKSIZE); + if cnt + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="uncompressor.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="uncompressor"/> + </Unit0> + <Unit1> + <Filename Value="mainform.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="mainform"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="uncompressor"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <MsgFileName Value=""/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/applications/fpvviewer/uncompressor/uncompressor.lpr b/applications/fpvviewer/uncompressor/uncompressor.lpr new file mode 100644 index 000000000..6202d57a2 --- /dev/null +++ b/applications/fpvviewer/uncompressor/uncompressor.lpr @@ -0,0 +1,21 @@ +program uncompressor; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, mainform + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/applications/fpvviewer/uncompressor/uncompressor.res b/applications/fpvviewer/uncompressor/uncompressor.res new file mode 100644 index 000000000..7c6cf3e4b Binary files /dev/null and b/applications/fpvviewer/uncompressor/uncompressor.res differ