
08-02-2024, 00:11
|
 |
Registered User
|
|
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
|
|
Quote:
Originally Posted by Tihiy_Don
Maybe it will be useful to someone.
Automatically set the unpacking parameters depending on the amount of RAM:
Code:
function GetRamMemory: Integer;
var i: Integer;
s: String;
begin
s:=MbOrTb(RamInfo.TotalRam, 0);
for i:=length(s) downto 1 do
if not (s[i] in ['0','1','2','3','4','5','6','7','8','9']) then delete(s,i,1);
Result:=StrToInt(s);
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
XValue, LRamValue, LCpuValue, SValue: String;
begin
case GetRamMemory of
0..2:
begin
XValue:= 't4';
SValue:= '512mb';
LRamValue:= '512mb';
LCpuValue:= '4';
end;
3..4:
begin
XValue:= 't4';
SValue:= '768mb';
LRamValue:= '768mb';
LCpuValue:= '4';
end;
// ....
end;
|
how about this way? i think it's more convenient.
Code:
procedure _GetMeRAMInGB;
var
MyRamInGB: Integer;
begin
// Note: ARamUsage.TotalRam --> Total RAM in MB.
MyRamInGB := Round(ARamUsage.TotalRam / 1024); // 0, 1, 2, 3, ....
case MyRamInGB of
0..2:
begin
MsgBox('RAM: 0..2 GB', mbInformation, MB_OK);
end;
3..4:
begin
MsgBox('RAM: 3..4 GB', mbInformation, MB_OK);
end;
// ....
else
begin
MsgBox('Are you sure you really have RAM installed? ;)', mbError, MB_OK);
end;
end;
end;
|