问题
I have reviewed the help documentation for IDP and I cannot find any functions for building the memo text of the files to download.
Previously I was using DwinsHs and it has been giving me problems. But I was able to use:
function DwinsHs_MemoDownloadInfo(Space, NewLine: String): String;
var
i: Integer;
begin
Result := '';
for i := 0 to GetArrayLength(DwinsHs_DownloadsList) - 1 do
begin
if DwinsHs_DownloadsList[i].Required then
begin
Result := Result + Space + ExtractFileName(DwinsHs_DownloadsList[i].Filename);
if DwinsHs_DownloadsList[i].Downloaded then
begin
Result := Result + Space + ExpandConstant('{cm:ReadyMemo_Downloaded}');
end;
Result := Result + NewLine;
end;
end;
if Result <> '' then
begin
Result := ExpandConstant('{cm:ReadyMemo_Download}') + NewLine + Result;
end;
end;
So, potentially we have up to 4 items that will be downloaded:
- Help Documentation setup
- VC Redist x86
- VC Redist x64
- Dot Net Framework
The relevant files are added using idpAddFile
(although I don't specify file sizes so there is a little delay). I have asked it to show the download page after wpPreparing
:
idpDownloadAfter(wpPreparing);
Ideally, on the memo page I would like it to list the files that we have determined the user wants to download.
回答1:
You know what files you are downloading, so collect their names at the time you are calling idpAddFile
. You can make a wrapper function as a replacement for idpAddFile
.
var
FilesToDownload: string;
procedure AddFileForDownload(Url, Filename: string);
begin
idpAddFile(Url, Filename);
FilesToDownload := FilesToDownload + ' ' + ExtractFileName(FileName) + #13#10;
end;
来源:https://stackoverflow.com/questions/62460884/building-memo-text-for-inno-download-plugin