如何在inno组件页面中正确显示组件大小 [英] How to Correctly show component sizes in inno component page

查看:69
本文介绍了如何在inno组件页面中正确显示组件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组件页面中选择的所有组件的内存大小均不正确.

I am not getting the correct memory sizes of all the component selected in the component page.

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

Please give me a solution how the total memory selected for all the components should be correct?

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

The memory size is displayed on the label at the bottom of the page.

推荐答案

如果在[文件]部分中使用了复选标记,则Inno-setup不能处理所有标记.尤其是如果您创建了依赖[code]部分的检查标志.

If in the [files] section check flags are used, not all flags can be processed by Inno-setup. Especially if you created check flags which rely on the [code] section.

在我的设置中,创建了一个包含所有文件的数组. 在此记录中,我有一个选定的标志和一个文件大小标志. 一个例子如下:

In my setup a created an array of all files. In this record I have a selected flag, and a filesizeflag. An example looks like:

 files[index].selected := // true or false depending on your wizard flow 
 files[index].filesize := {#filesize(..)} // on the .. the source file, including path

在调用目录页面向导页面之前,您需要执行一个过程,该过程计算文件大小并将其添加到已计算的文件大小中. 对于每种设置,已经计算出的文件大小是不同的,这取决于我在代码部分中拥有多少代码.

Before calling the dir page wizard page you go through a procedure which counts the file sizes and adds them to the file size already counted. Yhe file size already counted is for every setup different, depending how much code you have in the code section is my experience.

我的计算空间示例代码是一个好的开始(我希望)

My example code for counting the space is a good start (I hope)

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;

这篇关于如何在inno组件页面中正确显示组件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆