Installation 如何在inno组件页面中正确显示组件大小

Installation 如何在inno组件页面中正确显示组件大小,installation,inno-setup,Installation,Inno Setup,我没有获得在组件页面中选择的所有组件的正确内存大小 请给我一个解决方案,为所有组件选择的总内存应该如何正确 内存大小显示在页面底部的标签上。如果在[文件]部分使用了检查标志,Inno setup无法处理所有标志。特别是如果您创建了依赖于[code]部分的检查标志 在我的设置中,创建了一个包含所有文件的数组。 在这个记录中,我有一个selected标志和一个filesizeflag。 例如: files[index].selected := // true or false depending

我没有获得在组件页面中选择的所有组件的正确内存大小

请给我一个解决方案,为所有组件选择的总内存应该如何正确


内存大小显示在页面底部的标签上。

如果在[文件]部分使用了检查标志,Inno setup无法处理所有标志。特别是如果您创建了依赖于[code]部分的检查标志

在我的设置中,创建了一个包含所有文件的数组。 在这个记录中,我有一个selected标志和一个filesizeflag。 例如:

 files[index].selected := // true or false depending on your wizard flow 
 files[index].filesize := {#filesize(..)} // on the .. the source file, including path
在调用“目录页面向导”页面之前,您需要完成一个计算文件大小并将其添加到已计算的文件大小的过程。 根据我的经验,对于每个设置,已经计算的文件大小是不同的,这取决于代码部分中有多少代码

我希望我的计算空间的示例代码是一个良好的开端

Procedure GetSetUsedDiskSpace();
// This procedure counts an displays the used disk space
{}
var
 TempS, SearchString, NumberString, diskspace : String;
 Position, p2                                 : Integer;
 Tot_disk, TempSpace                          : Longint;
 {}
 begin
  TempS        := InitDiskSpace; // wizardform.DiskSpaceLabel.Caption;
  SearchString := 'MB';
  Position     := pos(SearchString, TempS);
  NumberString := copy(TempS, 1, Position-2); // exclusive the space before the MB
  p2           := 0;
  repeat // find the space before the number
   p2           := pos(' ', NumberString);
   NumberString := copy(NumberString, p2 + 1, length(NumberString) - p2);
  until p2 = 0;
  p2 := pos(',', NumberString);
  if (p2 = 0) then
   begin // Some languages use the period as a decimal separator
    p2 := pos('.', NumberString);
   end;
  if (p2 > 0) then
   begin
    NumberString := copy(Numberstring, 1, p2-1) + copy(NumberString, p2+1, 1);
    // If there is a need to more shifting we add some code
   end;
  TempSpace := StrToInt(NumberString);
  TempSpace := TempSpace * 1024 * 1024; // Conversion to bytes
  TempSpace := TempSpace / 10;          // We replaced the decimal separator once
  CountSpace;                           // Count the space for our selection
  Tot_disk      := UsedDiskSpace + TempSpace; // The total in bytes
  UsedDiskSpace := Tot_disk;                  // We need this for the control panel
  Tot_disk      := Tot_disk / 1024;           // The total in kilobytes
  Tot_disk      := Tot_disk / 1024;           // The total in MB
  diskspace     := IntToStr(Tot_disk);
  TempS         := SetupMessage(msgDiskSpaceMBLabel);
  StringChangeEx(TempS, '[mb]', diskspace, True);
  WizardForm.DiskSpaceLabel.Caption := TempS;
 end;

在“选择组件”页面中,我有不同的组件要安装,当您在复选框中选择多个组件时,内存大小总计不正确。您是否尝试过一些代码?如果有任何错误,请粘贴到此处。我没有尝试任何代码。我在“选择组件”页面中选择的所有组件的内存大小都不正确。当您检查多个组件时,页面底部的标签显示不正确的大小。它有多不正确?total标签显示它知道将使用的最小所需空间。它还排除了包含在多个组件中的额外项。