[Setup]
AppPublisher=Iobit, Inc.
AppPublisherURL=http://www.iobit.com
AppName=Smart Defrag Pro 6
VersionInfoVersion=6.1.5.120
AppCopyright=Copyright © 2018 Iobit.
AppVersion=6.1
DefaultDirName={pf}\Smart Defrag 6
OutputDir=.\
OutputBaseFilename=Setup
Compression=lzma2/ultra64
InternalCompressLevel=ultra64
SolidCompression=yes
DisableWelcomePage=No
InfoBeforeFile=embedded\InfoBefore.rtf
WizardImageFile=embedded\WizardImage.bmp
WizardSmallImageFile=embedded\WizardSmallImage.bmp
SetupIconFile=embedded\Icon.ico
[Files]
DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak
[Registry]
Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: String; ValueName: Smart Defrag; ValueData: "{app}\SmartDefrag.exe"; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: CheckBoxChecked;
[CustomMessages]
Group1=Select a Mode:
Group2=Additional icons:
Select1=Everything is Ready for installation
Select2=Setup is ready to install Smart Defrag Pro on your computer
Select3=To continue, click Install. If you would like to select a different folder, click Browse...%n%nClick "Install" to install Smart Defrag Pro
Radio0=Install Smart Defrag Pro
Radio1=Unpacking the Portable Version
Check0=Create a desctop icon
Check1=Create a Quick Launch icon
Check2=Create a taskbar icon
Check3=Start with Windows
TotalSpaceLabel=Total disk space:
FreeSpaceLabel=Available disk space:
NeedSpaceLabel1=At least
NeedSpaceLabel2= of free disk space is required.
MB_Message= Mb
GB_Message= Gb
TB_Message= Tb
[Code]
var
MyPage: TWizardPage;
ApplicationSize: Integer;
Image: array[0..3] of TBitmapImage;
MyGroupBox: array[0..2] of TNewGroupBox;
MyRadioBox: array[0..1] of TNewRadioButton;
MyCheckBox: array[0..3] of TNewCheckBox;
TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, Logo: TLabel;
FreeMB, TotalMB: Cardinal;
function CheckBoxChecked: Boolean;
begin
Result:=MyCheckBox[3].Checked;
end;
function NumToStr(Float: Extended): String;
begin
Result:= format('%.2n', [Float]);
StringChange(Result, ',', '.');
while ((Result[Length(Result)]='0') or (Result[Length(Result)]='.')) and (Pos('.', Result)>0) do
SetLength(Result, Length(Result)-1);
end;
function MbOrTb(Float: Extended): String;
begin
if Float<1024 then Result:=NumToStr(Float)+CustomMessage('MB_Message') else
if Float/1024<1024 then Result:=NumToStr(Float/1024)+CustomMessage('GB_Message') else
Result:=NumToStr(Float/(1024*1024))+CustomMessage('TB_Message');
end;
procedure DirEditOnChange(Sender: TObject);
var
FreeMB, TotalMB: Cardinal;
tmp2: Integer;
tmp: Extended;
begin
case Sender of
WizardForm.DirEdit: begin
GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
TotalSpaceLabel.Caption:=CustomMessage('TotalSpaceLabel')+' '+MbOrTb(TotalMB);
FreeSpaceLabel.Caption:=CustomMessage('FreeSpaceLabel')+' '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
FileSize(ExpandConstant('{src}\')+'{#SetupSetting("OutputBaseFilename")}'+'.exe', ApplicationSize);
if ApplicationSize > 1048576 then begin
tmp:=ApplicationSize/1048576; tmp2:=Trunc(ApplicationSize/1048576);
end else begin
tmp:=1; tmp2:=1;
end;
NeedSpaceLabel.Caption:=CustomMessage('NeedSpaceLabel1')+' '+Uppercase(MbOrTb(tmp))+CustomMessage('NeedSpaceLabel2');
if (FreeMB > tmp2) then begin
WizardForm.NextButton.Enabled:=True; FreeSpaceLabel.Font.Color:=$FFFFFF;
end else begin
WizardForm.NextButton.Enabled:=False; FreeSpaceLabel.Font.Color:=clRed;
end;
end;
end;
end;
procedure MyRadioProc(Sender: TObject);
var
i: Integer;
begin
if TNewRadioButton(Sender) = MyRadioBox[1] then
for i:=0 to 3 do begin
MyCheckBox[i].Checked:=False;
MyCheckBox[i].Enabled:=False;
Image[1].Show;
end else
for i:=0 to 3 do begin
if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
MyCheckBox[i].Enabled:=True;
Image[1].Hide;
end;
end;
procedure InitializeWizard;
var
i: Integer;
begin
with WizardForm do begin
LicenseLabel1.Hide;
DiskSpaceLabel.Hide;
SelectDirLabel.Hide;
SelectDirBitmapImage.Hide;
LicenseAcceptedRadio.Hide;
LicenseNotAcceptedRadio.Hide;
LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
MyPage:=CreateCustomPage(wpInfoBefore, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
//
for i:=0 to 1 do begin
Image[i]:=TBitmapImage.Create(nil);
with Image[i] do begin
SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
ExtractTemporaryFile(IntToStr(i)+'.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
Parent:=MyPage.Surface;
if i = 1 then Hide;
end;
end;
//
MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
with MyGroupBox[0] do begin
SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
Caption:=CustomMessage('Group1');
Parent:=MyPage.Surface;
end;
MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
with MyGroupBox[1] do begin
SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
Caption:=CustomMessage('Group2');
Parent:=MyPage.Surface;
end;
MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
with MyGroupBox[2] do begin
SetBounds(ScaleX(0), ScaleY(80), ScaleX(410), ScaleY(60));
Caption:=SetupMessage(msgWizardSelectDir)+':';
Parent:=WizardForm.SelectDirPage;
end;
//
for i:=0 to 1 do begin
MyRadioBox[i]:=TNewRadioButton.Create(nil);
with MyRadioBox[i] do begin
SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
Caption:=CustomMessage('Radio'+IntToStr(i));
if i = 0 then Checked:=True;
Parent:=MyGroupBox[0];
OnClick:=@MyRadioProc;
end;
end;
for i:=0 to 3 do begin
MyCheckBox[i]:=TNewCheckBox.Create(nil);
with MyCheckBox[i] do begin
SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
Caption:=CustomMessage('Check'+IntToStr(i));
if (i = 0) or (i = 1) then Checked:=True;
Parent:=MyGroupBox[1];
end;
end;
//
TotalSpaceLabel:=TLabel.Create(WizardForm);
TotalSpaceLabel.AutoSize:= False;
TotalSpaceLabel.SetBounds(ScaleX(20), ScaleY(165), ScaleX(300), ScaleY(20));
TotalSpaceLabel.Parent:=SelectDirpage;
FreeSpaceLabel:=TLabel.Create(WizardForm);
FreeSpaceLabel.AutoSize:=False;
FreeSpaceLabel.SetBounds(ScaleX(20), ScaleY(185), ScaleX(300), ScaleY(20));
FreeSpaceLabel.Parent:=SelectDirpage;
NeedSpaceLabel:=TLabel.Create(WizardForm);
NeedSpaceLabel.AutoSize:=False;
NeedSpaceLabel.SetBounds(ScaleX(20), ScaleY(205), ScaleX(300), ScaleY(20));
NeedSpaceLabel.Parent:=SelectDirpage;
Logo:=TLabel.Create(WizardForm);
Logo.AutoSize:=False;
Logo.Font.Size:=12;
Logo.Font.Color:=$820009;
Logo.Font.Style:=[fsBold, fsItalic];
Logo.Caption:='Repack By Magsoud';
Logo.SetBounds(ScaleX(10), ScaleY(326), ScaleX(180) , ScaleY(25));
Logo.Parent:= WizardForm;
DirEdit. OnChange := @ DirEditOnChange;
DirEdit.Parent:=MyGroupBox[2];
DirEdit. SetBounds (ScaleX(10), ScaleY(25), ScaleX(300), ScaleY(21));
DirBrowseButton.Parent:=MyGroupBox[2];
DirBrowseButton.SetBounds(ScaleX(320), ScaleY(24), ScaleX(75), ScaleY(23));
SelectDirBrowseLabel.SetBounds(ScaleX(0), ScaleY(20), ScaleX(417), ScaleY(42));
SelectDirBrowseLabel.Caption:=CustomMessage('Select3');
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
WizardForm.PageNameLabel.Caption:=CustomMessage('Select1');
WizardForm.PageDescriptionLabel.Caption:=CustomMessage('Select2');
WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
DirEditOnChange(WizardForm.DirEdit);
end;
end;
end;
function ShouldSkipPage(CurPageID: Integer): Boolean;
begin
case CurPageID of
wpWelcome,wpInfoBefore,MyPage.ID,wpSelectDir,wpInstalling,wpFinished: Result:=False;
else Result:=True;
end;
end;