我正在使用 Inno Setup 分发我的应用程序。是否可以在 Inno Script 中检查特定条件,并在需要时从 Internet 下载并安装一些文件。
19992 次
4 回答
16
- 它是一个 InnoSetup 脚本和 DLL,它允许您在安装过程中下载文件。
- 它支持 FTP、HTTP 和 HTTPS。
- 它是 InnoTools Downloader 的一种替代品。只需进行少量更改。
- 它带来了不错的下载显示以及HTTPS和镜像支持。
例子:
#include <idp.iss>
[Files]
Source: "{tmp}\file.zip"; DestDir: "{app}"; Flags: external; ExternalSize: 1048576
[Code]
procedure InitializeWizard();
begin
idpAddFileSize('http://127.0.0.1/file.zip', ExpandConstant('{tmp}\file.zip'), 1048576);
idpDownloadAfter(wpReady);
end.
于 2014-03-28T13:45:08.527 回答
11
是的,有一个名为InnoTools Downloader的库,其中包含几乎可以执行此操作的示例。它们可以使用普通的 Inno 代码以您想要的任何东西为条件。
于 2011-07-31T23:00:46.737 回答
11
Inno Setup 6.1内置了对下载的支持。不再需要第三方解决方案。
检查Examples\CodeDownloadFiles.iss
Inno Setup 安装文件夹。
该示例的重要部分是:
[Files]
; These files will be downloaded
Source: "{tmp}\innosetup-latest.exe"; DestDir: "{app}"; Flags: external
Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: external
[Code]
var
DownloadPage: TDownloadWizardPage;
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
if Progress = ProgressMax then
Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
Result := True;
end;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
DownloadPage.Add('https://jrsoftware.org/download.php/is.exe', 'innosetup-latest.exe', '');
DownloadPage.Add('https://jrsoftware.org/download.php/iscrypt.dll', 'ISCrypt.dll', '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc');
DownloadPage.Show;
try
try
DownloadPage.Download;
Result := True;
except
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end else
Result := True;
end;
有关替代方法,请参阅Inno Setup 的代码部分中下载后运行程序
于 2021-02-08T11:09:04.760 回答
1
在Inno 3rd Party上发现的一款在范围和风格上与 Inno 下载插件DWinsHs非常相似。
包含一个简单直观的 chm 文件,需要解锁才能查看。
于 2017-06-22T07:31:33.787 回答