Search code examples
inno-setuppascalscript

Provide the file size for Inno Setup download feature


I have this definition:

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

It obtains the file size by looking at the data file on my computer rather than working it out remotely. I've used that value with Inno Setup Download plugin to specify the size of the file to download.

I'm rewriting the code for the new Inno Setup download feature. My code for managing it all (stripped down) is:

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;

I can't find any documentation in the beta for Add and from looking at the sample the third and fourth parameters are not for providing the file size. Is it the fifth?

Some official clarification about the Add parameters appreciated.


Solution

  • The TDownloadWizardPage.Add has three arguments only.

    You do not need to (and you cannot) specify the file size upfront. Inno Setup finds out the size on its own from the Content-Length HTTP header.