mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:19:27 +02:00
* Added program to test downloader class
git-svn-id: trunk@5213 -
This commit is contained in:
parent
6f4201bcfc
commit
f9966bdc06
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7797,6 +7797,7 @@ utils/fppkg/pkgwget.pp svneol=native#text/plain
|
||||
utils/fppkg/rep2xml.lpi svneol=native#text/plain
|
||||
utils/fppkg/rep2xml.lpr svneol=native#text/plain
|
||||
utils/fppkg/reptest.pp svneol=native#text/plain
|
||||
utils/fppkg/testdownload.pp svneol=native#text/plain
|
||||
utils/fprcp/Makefile svneol=native#text/plain
|
||||
utils/fprcp/Makefile.fpc svneol=native#text/plain
|
||||
utils/fprcp/Readme.txt svneol=native#text/plain
|
||||
|
@ -15,6 +15,7 @@ Type
|
||||
Procedure FTPDownload(Const URL : String; Dest : TStream); override;
|
||||
Procedure HTTPDownload(Const URL : String; Dest : TStream); override;
|
||||
Public
|
||||
Constructor Create(AOWner : TComponent); override;
|
||||
Property WGet : String Read FWGet Write FWGet;
|
||||
end;
|
||||
|
||||
@ -22,6 +23,14 @@ implementation
|
||||
|
||||
uses process,pkgmessages;
|
||||
|
||||
Constructor TWGetDownloader.Create(AOWner : TComponent);
|
||||
|
||||
begin
|
||||
Inherited;
|
||||
wget:='wget';
|
||||
end;
|
||||
|
||||
|
||||
Procedure TWGetDownloader.WGetDownload(Const URL : String; Dest : TStream);
|
||||
|
||||
Var
|
||||
@ -59,4 +68,6 @@ begin
|
||||
WGetDownload(URL,Dest);
|
||||
end;
|
||||
|
||||
initialization
|
||||
DownloaderClass:=TWGetDownloader;
|
||||
end.
|
23
utils/fppkg/testdownload.pp
Normal file
23
utils/fppkg/testdownload.pp
Normal file
@ -0,0 +1,23 @@
|
||||
program testdownload;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
pkgwget, // Including this sets the Downloaderclass. Replace with downloader you want...
|
||||
pkgdownload;
|
||||
|
||||
Var
|
||||
F : TFileStream;
|
||||
|
||||
begin
|
||||
F:=TFileStream.Create('fpc.html',fmcreate);
|
||||
Try
|
||||
With DownloaderClass.Create(Nil) do
|
||||
try
|
||||
Download('http://www.freepascal.org',F);
|
||||
Finally
|
||||
Free;
|
||||
end;
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user