如何使用 Inno Setup 和 Inno Dependency Installer Setup 解决 UpdateReadyMemo 输出问题?

问题描述 投票:0回答:1

这些

<event> functions work in the 
[代码]`部分到底是如何做的 Inno Setup 的?

我在这里看到类似的问题,但没有接受的答案:

Inno Setup 具有多个 UpdateReadyMemo 事件

我问这个问题是因为我有一个问题需要解决。我正在使用 Inno Dependency Installer 设置工具,它包括以下

[<event('UpdateReadyMemo')>][2]
处理程序:

<event('UpdateReadyMemo')>
function Dependency_Internal3(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
  Result := '';
  if MemoUserInfoInfo <> '' then begin
    Result := Result + MemoUserInfoInfo + Newline + NewLine;
  end;
  if MemoDirInfo <> '' then begin
    Result := Result + MemoDirInfo + Newline + NewLine;
  end;
  if MemoTypeInfo <> '' then begin
    Result := Result + MemoTypeInfo + Newline + NewLine;
  end;
  if MemoComponentsInfo <> '' then begin
    Result := Result + MemoComponentsInfo + Newline + NewLine;
  end;
  if MemoGroupInfo <> '' then begin
    Result := Result + MemoGroupInfo + Newline + NewLine;
  end;
  if MemoTasksInfo <> '' then begin
    Result := Result + MemoTasksInfo;
  end;

  if Dependency_Memo <> '' then begin
    if MemoTasksInfo = '' then begin
      Result := Result + SetupMessage(msgReadyMemoTasks);
    end;
    Result := Result + FmtMessage(Dependency_Memo, [Space]);
  end;
end;

但是,我的脚本中还有一个

UpdateReadyMemo
处理程序:

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
    Result := '';
    if MemoUserInfoInfo <> '' then
        Result := Result + MemoUserInfoInfo + NewLine + NewLine;
    if MemoDirInfo <> '' then
        Result := Result + MemoDirInfo + NewLine + NewLine;
    if MemoComponentsInfo <> '' then
        Result := Result + MemoComponentsInfo + NewLine + NewLine;
    if MemoGroupInfo <> '' then
        Result := Result + MemoGroupInfo + NewLine + NewLine;
    if (MemoTasksInfo <> '') then
        Result := Result + MemoTasksInfo + NewLine + NewLine;

    { Only display the Auto Backup Settings info if it is a new install }
    if (not bIsUpgrading) then
        Result := Result + AutoBackupPage_MemoInfo(Space, NewLine);

    Log('UpdateReadyMemo FileToDownload: ' + FilesToDownload);
    if ((FilesToDownload <> '') or WizardIsComponentSelected('downloadhelp')) then
    begin
        Result := Result + ExpandConstant('{cm:ReadyMemo_Download}') + NewLine;

        if (FilesToDownload <> '') then
            Result := Result + FilesToDownload;
    end;
  
end;

它有这样一点:

Log('UpdateReadyMemo FileToDownload: ' + FilesToDownload);
if ((FilesToDownload <> '') or WizardIsComponentSelected('downloadhelp')) then
begin
    Result := Result + ExpandConstant('{cm:ReadyMemo_Download}') + NewLine;

    if (FilesToDownload <> '') then
        Result := Result + FilesToDownload;
end;

当我运行安装程序时:

我想在这里看到的是:

Download files:
    MSAHelpDocumentationSetup.exe
    .NET Runtime 8.0.3 (x64)

我怎样才能达到这个结果?

inno-setup pascalscript inno-dependency-installer
1个回答
0
投票

这就是我们决定解决这个问题的方法:

  1. 我向库中引入了一个新的全局变量:

    Dependency_NeedRestart、Dependency_ForceX86、Dependency_IgnoreUpdateReadyMemoEvent:布尔值;

  2. 我更新了

    UpdateReadyMemo
    处理程序,如下所示:

<event('UpdateReadyMemo')>
function Dependency_Internal3(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
  Result := '';

  if not Dependency_IgnoreUpdateReadyMemoEvent then begin
      if MemoUserInfoInfo <> '' then begin
        Result := Result + MemoUserInfoInfo + Newline + NewLine;
      end;
      if MemoDirInfo <> '' then begin
        Result := Result + MemoDirInfo + Newline + NewLine;
      end;
      if MemoTypeInfo <> '' then begin
        Result := Result + MemoTypeInfo + Newline + NewLine;
      end;
      if MemoComponentsInfo <> '' then begin
        Result := Result + MemoComponentsInfo + Newline + NewLine;
      end;
      if MemoGroupInfo <> '' then begin
        Result := Result + MemoGroupInfo + Newline + NewLine;
      end;
      if MemoTasksInfo <> '' then begin
        Result := Result + MemoTasksInfo;
      end;

      if Dependency_Memo <> '' then begin
        if MemoTasksInfo = '' then begin
          Result := Result + SetupMessage(msgReadyMemoTasks);
        end;
        Result := Result + FmtMessage(Dependency_Memo, [Space]);
      end;
    end;
end;
  1. 我在安装程序中的

    InitializeSetup
    函数顶部添加了这一行:

    Dependency_IgnoreUpdateReadyMemoEvent := True;
    
  2. 最后我修改了我的版本

    UpdateReadyMemo
    :

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
    Result := '';
    if MemoUserInfoInfo <> '' then
        Result := Result + MemoUserInfoInfo + NewLine + NewLine;
    if MemoDirInfo <> '' then
        Result := Result + MemoDirInfo + NewLine + NewLine;
    if MemoComponentsInfo <> '' then
        Result := Result + MemoComponentsInfo + NewLine + NewLine;
    if MemoGroupInfo <> '' then
        Result := Result + MemoGroupInfo + NewLine + NewLine;
    if (MemoTasksInfo <> '') then
        Result := Result + MemoTasksInfo + NewLine + NewLine;

    { Only display the Auto Backup Settings info if it is a new install }
    if (not bIsUpgrading) then
        Result := Result + AutoBackupPage_MemoInfo(Space, NewLine);

    if ((FilesToDownload <> '') or (Dependency_Memo <> '') or WizardIsComponentSelected('downloadhelp')) then
    begin
        Result := Result + ExpandConstant('{cm:ReadyMemo_Download}');
        
        if (Dependency_Memo <> '') then begin
            Result := Result + FmtMessage(Dependency_Memo, [Space]); 
            Log('UpdateReadyMemo FileToDownload: ' + Dependency_Memo);

            if (FilesToDownload <> '') then
                Result := Result + NewLine;
        end;

        if (FilesToDownload <> '') then begin
            Result := Result + FilesToDownload; 
            Log('UpdateReadyMemo FileToDownload: ' + FilesToDownload);
        end;
    end;
end;

我做了一些初步测试,结果很好:

唯一的障碍是,如果我向后导航,转到安装向导的开头,取消选中下载帮助文档的选项,然后向前导航……当我们到达

UpdateReadyMemo
页面时,它尚未检测到我的更改.

© www.soinside.com 2019 - 2024. All rights reserved.