【问题标题】:Download additional files based on contents of first download using IDP根据使用 IDP 首次下载的内容下载其他文件
【发布时间】:2019-10-11 04:37:58
【问题描述】:

想要使用 Inno Download Plugin (IDP) 根据首次下载的内容下载文件。该怎么做?

这是我的代码

[Code]
procedure InitializeWizard();
var
  line: string;
  line2: string;
  url: string;
  appname: string;
begin
  idpAddFile('http://download.website.com/files.txt', ExpandConstant('{tmp}\files.txt'));
  idpDownloadAfter(wpReady);
  TryGetFileLine(expandConstant('{tmp}\files.txt'), 0, line);
  TryGetFileLine(expandConstant('{tmp}\files.txt'), 1, line2);
  url := line;
  appname := line2;    
  idpAddFile(url, ExpandConstant('{tmp}\'+appname));
  idpDownloadAfter(wpReady);
end;

这里第二个文件在第一个文件完成之前开始下载。那么如何一个接一个呢?

【问题讨论】:

  • 我认为 IDP 不支持并行下载。为什么会这样?
  • @MartinPrikryl 那么如何一个接一个地下载多个文件?任何帮助..
  • 您的代码确实会一个接一个地下载这两个文件
  • 不,它没有发生!第二个文件在第一个文件完成之前开始下载。
  • 我也使用了idpStopDownloadidpStartDownload,但没有运气。

标签: inno-setup pascalscript inno-download-plugin


【解决方案1】:

告诉 IDP 最初只下载列表。然后等待下载完成(参见Running a program after it is downloaded in Code section in Inno Setup)并根据结果创建新的下载列表并重新开始下载。

var
  ListDownloaded: Boolean;

procedure InitializeWizard();
begin
  idpAddFile('http://www.example.com/files.txt', ExpandConstant('{tmp}\files.txt'));
  idpDownloadAfter(wpReady);
  ListDownloaded := False;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  Url, AppName: string;
begin
  Result := True;
  if CurPageID = IDPForm.Page.ID then
  begin
    if not ListDownloaded then
    begin
      TryGetFileLine(ExpandConstant('{tmp}\files.txt'), 0, Url);
      TryGetFileLine(ExpandConstant('{tmp}\files.txt'), 1, AppName);

      idpClearFiles;
      idpAddFile(Url, ExpandConstant('{tmp}\' + AppName));
      idpFormActivate(nil); { This restarts the download }
      Result := False;
      ListDownloaded := True;
    end;
  end;
end;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-25
    相关资源
    最近更新 更多