inno-setup - 包括使用 Inno Setup 6.1.1 beta to Ready 页面下载的文件摘要?
问题描述
使用Inno 下载插件,我有一个代码可以注册要下载的文件列表,并同时将列表添加到“就绪”页面备忘录: Building memo text for Inno Download Plugin
我修改了代码以使用 Inno Setup 6.1.1 下载页面,而不是 IDP:
procedure AddFileForDownload(Url, FileName: string);
begin
DownloadPage.Add(Url, FileName, '');
FilesToDownload := FilesToDownload + ' ' + ExtractFileName(FileName) + #13#10;
Log('File to download: ' + Url);
end;
然后我这样调整NextButtonClick
:
function NextButtonClick(CurPageID: integer): boolean;
begin
Result := True;
if (CurPageID = wpReady) then
begin
DownloadPage.Clear;
if (dotNetNeeded) then begin
{ We need to download the 4.6.2 setup from the Microsoft Website }
dotNetRedistPath := ExpandConstant('{tmp}\NDP451-KB2858728-x86-x64-AllOS-ENU.exe');
AddFileForDownload(dotnetRedistURL, 'NDP451-KB2858728-x86-x64-AllOS-ENU.exe');
end;
if (bVcRedist64BitNeeded) then
begin
{ We need to download the 64 Bit VC Redistributable from the Microsoft Website }
vcRedist64BitPath := ExpandConstant('{tmp}\vc_redist.x64.exe');
AddFileForDownload(vcRedist64BitURL, 'vc_redist.x64.exe');
end;
if (bVcRedist32BitNeeded) then
begin
{ We need to download the 32 Bit VC Redistributable from the Microsoft Website }
vcRedist32BitPath := ExpandConstant('{tmp}\vc_redist.x86.exe');
AddFileForDownload(vcRedist32BitURL, 'vc_redist.x86.exe');
end;
if (WizardIsTaskSelected('downloadhelp')) then
AddFileForDownload('{#HelpDocSetupURL}', 'HelpDocSetup.exe');
DownloadPage.Show;
try
try
DownloadPage.Download;
Result := True;
except
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end;
end;
我运行了安装程序,并检查了下载帮助文档的向导选项,但Ready页面只显示:
未添加下载部分。这个怎么可能?当我单击下一步时,它会继续到下一页下载文件。
我添加了一些额外的日志记录FilesToDownload
,这很有趣:
2020-11-01 11:44:22.409 UpdateReadyMemo FileToDownload:
2020-11-01 11:44:25.671 File to download: https://www.publictalksoftware.co.uk/downloads/MSAHelpDocumentationSetup.exe
2020-11-01 11:44:25.671 FileToDownload: HelpDocSetup.exe
在我们填充变量之前调用该UpdateReadyMemo
方法。使困惑!
解决方案
一开始我有点困惑。因为问题很明显。当您单击“就绪”页面上的“安装”按钮时,您的代码就会执行。所以显然只有在“就绪”页面显示之后。
你必须先打电话AddFileForDownload
。也许到NextButtonClick(wpSelectTasks)
。
function NextButtonClick(CurPageID: integer): boolean;
begin
Result := True;
if (CurPageID = wpSelectTasks) then
begin
DownloadPage.Clear;
if (dotNetNeeded) then
begin
// We need to download the 4.6.2 setup from the Microsoft Website
dotNetRedistPath :=
ExpandConstant('{tmp}\NDP451-KB2858728-x86-x64-AllOS-ENU.exe');
AddFileForDownload(
dotnetRedistURL, 'NDP451-KB2858728-x86-x64-AllOS-ENU.exe');
end;
if (bVcRedist64BitNeeded) then
begin
// We need to download the 64 Bit VC Redistributable
// from the Microsoft Website
vcRedist64BitPath := ExpandConstant('{tmp}\vc_redist.x64.exe');
AddFileForDownload(vcRedist64BitURL, 'vc_redist.x64.exe');
end;
if (bVcRedist32BitNeeded) then
begin
// We need to download the 32 Bit VC Redistributable
// from the Microsoft Website
vcRedist32BitPath := ExpandConstant('{tmp}\vc_redist.x86.exe');
AddFileForDownload(vcRedist32BitURL, 'vc_redist.x86.exe');
end;
if (WizardIsTaskSelected('downloadhelp')) then
AddFileForDownload('{#HelpDocSetupURL}', 'HelpDocSetup.exe');
end
else
if (CurPageID = wpReady) then
begin
DownloadPage.Show;
try
try
DownloadPage.Download;
Result := True;
except
SuppressibleMsgBox(
AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end;
end;
(未经测试)
推荐阅读
- ios - iOS - 错误消息“设备上没有剩余空间”
- excel - Excel 插件无法在 Apple 的硅 M1 处理器机器上运行
- jquery - 动画未完成时,Anime.js svg morph 动画悬停不反转
- api - BigCartel - 显示可供购买的数量
- firebase - 我可以使用 fcm 向其他用户发送推送通知吗?
- python - 如何从不同的 txt 文件在 matplotlib 中同时制作几个动画图
- java - Drools 决策表动作执行顺序
- eclipse - Eclipse 2020-03:验证 Maven 项目时出现 java.lang.StackOverflowError
- sails.js - 在 SailsJS 中允许负主键
- php - Wordpress 401 错误:rest_forbidden。抱歉,您不能发出代理 oEmbed 请求