为 Inno Setup 下载功能提供文件大小

Provide the file size for Inno Setup download feature

我有这个定义:

#define HelpDocSetupFileSize FileSize("..\HelpNDoc\CHM\Output\MSAHelpDocumentationSetup.exe")

它通过查看我计算机上的数据文件而不是远程计算来获取文件大小。我在 Inno Setup Download 插件中使用了该值来指定要下载的文件的大小。

我正在为新的 Inno Setup 下载功能重写代码。我管理这一切的代码(精简)是:

function NextButtonClick(CurPageID: integer): boolean;
begin
  Result := True;

  if (CurPageID = wpReady) then
  begin
    DownloadPage.Clear;
    if (WizardIsTaskSelected('downloadhelp')) then
      DownloadPage.Add('{#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;

我在测试版中找不到 Add 的任何文档,并且通过查看样本,第三和第四个参数不用于提供文件大小。是第五个吗?

Add 参数的一些官方说明表示赞赏。

TDownloadWizardPage.Add 只有三个参数。

您不需要(也不能)预先指定文件大小。 Inno Setup 从 Content-Length HTTP header.

中自行找出大小