var
HardwareInfoPage: TWizardPage;
wpHardware: Integer;
WizardImg, StatusPanelBlock: array[1..6] of Longint;
HardwarePanel, DirEdit, DirFolder, GroupEdit, GroupFolder: Longint;
StatusPanelLabel: array[1..6] of TLabelEx;
PageNameLabel, PageDescLabel, WelcomeLabel1, WelcomeLabel2,
HardwareLabel, HardwareClickLabel, ProcessorName, VideoCardName, SoundCardName, PhysRAMSize, OSName,
Processor, VideoCard, SoundCard, PhysRAM, OS,
SelectDirBrowseLabel, DirEditText, GroupEditText, SelectDirLabel, SelectStartMenuFolderLabel, FreeSpaceLabel, NeedSpaceLabel,
SelectComponentsLabel, FinishedHeadingLabel, FinishedLabel,
StatusLabel, FilenameLabel, ElapsedTimeLabel, RemainingTimeLabel, PctLabel1: TLabelEx;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
PctLabel2: TLabelEx;
ISDoneProgressBar2: TNewProgressBar;
#endif
procedure DirEditChange(Sender: TObject); forward;
procedure GroupEditChange(Sender: TObject); forward;
function CheckError: Boolean;
begin
Result := not ISDoneError;
end;
procedure RedesignWizardForm;
var
i: Integer;
begin
#ifdef SPLASH
ExtractTemporaryFile('Splash.png');
ShowSplashScreen(WizardForm.Handle, ExpandConstant('{tmp}\Splash.png'), 1000, 2000, 1000, 0, 255, False, $FFFFFF, 10);
#endif
with WizardForm do
begin
InnerNotebook.Hide;
OuterNotebook.Hide;
ClientWidth := ScaleX(837);
ClientHeight := ScaleY(500);
Center;
Bevel.Width := ClientWidth;
Bevel.Top := ScaleY(438);
BackButton.Left := ScaleX(560);
BackButton.Top := ScaleY(458);
NextButton.Left := ScaleX(650);
NextButton.Top := BackButton.Top;
CancelButton.Left := ScaleX(740);
CancelButton.Top := BackButton.Top;
end;
for i := 1 to 6 do
WizardImg[i] := ImgLoad(WizardForm.Handle, 'WizardImg' + IntToStr(i) + '.jpg', 0, 0, WizardForm.ClientWidth, WizardForm.ClientHeight, True, True);
ImgLoad(WizardForm.Handle, 'StatusPanel.png', 0, ScaleY(32), ScaleX(194), ScaleY(389), True, True);
ImgLoad(WizardForm.Handle, 'WorkingSpace.png', ScaleX(234), ScaleY(32), ScaleX(603), ScaleY(389), True, True);
ImgLoad(WizardForm.Handle, 'Logo.png', ScaleX(100), ScaleY(450), ScaleX(316), ScaleY(43), True, True);
BASS_Init(ExpandConstant('{tmp}\Music.mp3'));
BASS_CreateOnOffButton(WizardForm, 'MusicButton.png', 20, 450, 36, 36, 4);
ImgApplyChanges(WizardForm.Handle);
end;
procedure CreateStatusPanel;
var
i, BlockTop: Integer;
begin
BlockTop := 70;
for i := 1 to 6 do
begin
StatusPanelBlock[i] := ImgLoad(WizardForm.Handle, 'StatusPanelBlock.png', 0, ScaleY(BlockTop), ScaleX(172), ScaleY(40), True, True);
BlockTop := BlockTop + 54;
end;
StatusPanelLabel[1] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelWelcome'), ScaleX(15), ScaleY(80), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
StatusPanelLabel[2] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelHardware'), ScaleX(15), ScaleY(134), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
StatusPanelLabel[3] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelDirs'), ScaleX(15), ScaleY(188), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
StatusPanelLabel[4] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelComponents'), ScaleX(15), ScaleY(242), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
StatusPanelLabel[5] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelInstalling'), ScaleX(15), ScaleY(296), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
StatusPanelLabel[6] := LabelCreateEx(WizardForm, CustomMessage('StatusPanelFinished'), ScaleX(15), ScaleY(350), ScaleX(142), ScaleY(20),
'Calibri', 13, 2, [fsBold], clWhite, clBlack, False, False, taLeftJustify);
ImgApplyChanges(WizardForm.Handle);
end;
procedure SetFreeDiscSpace;
var
FreeMB, TotalMB: Cardinal;
begin
GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
SetLabelExCaption(FreeSpaceLabel, FmtMessage(CustomMessage('FreeSpaceLabel'), [MbOrTb(FreeMB)]));
end;
procedure CreateWizardComponents;
begin
PageNameLabel := LabelCreateEx(WizardForm, '', ScaleX(270), ScaleY(60), ScaleX(531), ScaleY(30),
'Calibri', 14, 2, [fsBold], $efefef, $2a2c2d, False, True, taLeftJustify);
PageDescLabel := LabelCreateEx(WizardForm, '', ScaleX(280), ScaleY(90), ScaleX(511), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
// *** "Welcome" wizard page
WelcomeLabel1 := LabelCreateEx(WizardForm, WizardForm.WelcomeLabel1.Caption, ScaleX(270), ScaleY(70), ScaleX(531), ScaleY(45),
'Calibri', 14, 2, [fsBold], $efefef, $2a2c2d, False, True, taCenter);
WelcomeLabel2 := LabelCreateEx(WizardForm, WizardForm.WelcomeLabel2.Caption, ScaleX(270), ScaleY(180), ScaleX(531), ScaleY(160),
'Calibri', 11, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
// *** "Hardware Information" wizard page
HardwareInfoPage := CreateCustomPage(wpWelcome, CustomMessage('WizardHardwareInfo'), CustomMessage('HardwareInfoDesc'));
wpHardware := HardwareInfoPage.ID;
HardwareLabel := LabelCreateEx(WizardForm, CustomMessage('HardwareLabelGood'), ScaleX(280), ScaleY(130), ScaleX(511), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
HardwarePanel := ImgLoad(WizardForm.Handle, 'HardwarePanel.png', ScaleX(280), ScaleY(190), ScaleX(511), ScaleY(146), True, True);
Processor := LabelCreateEx(WizardForm, CustomMessage('Processor'), ScaleX(286), ScaleY(193), ScaleX(125), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
VideoCard := LabelCreateEx(WizardForm, CustomMessage('VideoCard'), ScaleX(286), ScaleY(224), ScaleX(125), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
SoundCard := LabelCreateEx(WizardForm, CustomMessage('SoundCard'), ScaleX(286), ScaleY(255), ScaleX(125), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
PhysRAM := LabelCreateEx(WizardForm, CustomMessage('PhysRAM'), ScaleX(286), ScaleY(286), ScaleX(125), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
OS := LabelCreateEx(WizardForm, CustomMessage('OS'), ScaleX(286), ScaleY(317), ScaleX(125), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
ProcessorName := LabelCreateEx(WizardForm, GetProcessorName + ' @' + IntToStr(GetProcessorFreq) + ' MHz', ScaleX(432), ScaleY(193), ScaleX(352), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
VideoCardName := LabelCreateEx(WizardForm, DelSp(GetVideoName) + ' ~' + IntToStr(GetVideoRam) + CustomMessage('MB'), ScaleX(432), ScaleY(224), ScaleX(352), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
SoundCardName := LabelCreateEx(WizardForm, GetSoundCardName, ScaleX(432), ScaleY(255), ScaleX(352), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
PhysRAMSize := LabelCreateEx(WizardForm, IntToStr(GetTotalRam + 1) + ' ' + CustomMessage('MB'), ScaleX(432), ScaleY(286), ScaleX(352), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
OSName := LabelCreateEx(WizardForm, GetOsName + ' [x' + IntToStr(GetOsBit) + ']', ScaleX(432), ScaleY(317), ScaleX(352), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
HardwareClickLabel := LabelCreateEx(WizardForm, SetupMessage(msgClickNext), ScaleX(280), ScaleY(350), ScaleX(511), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
if (GetProcessorFreq * GetProcessorCoreCount) < {#Processor} then
begin
SetLabelExColor(ProcessorName, $2a2c2d, clRed);
SetLabelExCaption(HardwareLabel, CustomMessage('HardwareLabelRed'));
end;
if GetVideoRam < {#VideoRAM} then
begin
SetLabelExColor(VideoCardName, $2a2c2d, clRed);
SetLabelExCaption(HardwareLabel, CustomMessage('HardwareLabelRed'));
end;
if GetSoundCards = 0 then
begin
SetLabelExColor(ProcessorName, $2a2c2d, clRed);
SetLabelExCaption(HardwareLabel, CustomMessage('HardwareLabelRed'));
SetLabelExCaption(SoundCardName, CustomMessage('SoundCardRed'));
end;
if (GetTotalRam + 1) < {#PhysRAM} then
begin
SetLabelExColor(PhysRAMSize, $2a2c2d, clRed);
SetLabelExCaption(HardwareLabel, CustomMessage('HardwareLabelRed'));
end;
if {#OpSystem} > GetOsNumber then
begin
SetLabelExColor(OSName, $2a2c2d, clRed);
SetLabelExCaption(HardwareLabel, CustomMessage('HardwareLabelRed'));
end;
// *** "Select Destination Location" wizard page
SelectDirBrowseLabel := LabelCreateEx(WizardForm, WizardForm.SelectDirBrowseLabel.Caption, ScaleX(280), ScaleY(130), ScaleX(511), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
DirFolder := ImgLoad(WizardForm.Handle, 'Folder.png', ScaleX(280), ScaleY(170), ScaleX(73), ScaleY(57), True, True);
DirEdit := ImgLoad(WizardForm.Handle, 'Edit.png', ScaleX(370), ScaleY(205), ScaleX(330), ScaleY(22), True, True);
SelectDirLabel := LabelCreateEx(WizardForm, WizardForm.SelectDirLabel.Caption, ScaleX(370), ScaleY(175), ScaleX(405), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
DirEditText := LabelCreateEx(WizardForm, '', ScaleX(376), ScaleY(208), ScaleX(328), ScaleY(22),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
SetLabelExCaption(DirEditText,
MinimizePathName(WizardForm.DirEdit.Text, DirEditText.Massive[0].Font, DirEditText.Massive[0].Width));
WizardForm.DirEdit.OnChange := @DirEditChange;
WizardForm.DirBrowseButton.Parent := WizardForm;
WizardForm.DirBrowseButton.Left := ScaleX(716);
WizardForm.DirBrowseButton.Top := ScaleY(205);
GroupFolder := ImgLoad(WizardForm.Handle, 'Folder.png', ScaleX(280), ScaleY(260), ScaleX(73), ScaleY(57), True, True);
GroupEdit := ImgLoad(WizardForm.Handle, 'Edit.png', ScaleX(370), ScaleY(295), ScaleX(330), ScaleY(22), True, True);
SelectStartMenuFolderLabel := LabelCreateEx(WizardForm, WizardForm.SelectStartMenuFolderLabel.Caption, ScaleX(370), ScaleY(265), ScaleX(420), ScaleY(30),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
GroupEditText := LabelCreateEx(WizardForm, '', ScaleX(376), ScaleY(298), ScaleX(328), ScaleY(22),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
SetLabelExCaption(GroupEditText,
MinimizePathName(WizardForm.GroupEdit.Text, GroupEditText.Massive[0].Font, GroupEditText.Massive[0].Width));
WizardForm.GroupEdit.OnChange := @GroupEditChange;
WizardForm.GroupBrowseButton.Parent := WizardForm;
WizardForm.GroupBrowseButton.Left := ScaleX(716);
WizardForm.GroupBrowseButton.Top := ScaleY(295);
NeedSpaceLabel := LabelCreateEx(WizardForm, FmtMessage(CustomMessage('NeedSpaceLabel'), [MbOrTB({#NeedSpace})]),
ScaleX(280), ScaleY(360), ScaleX(300), ScaleY(16), 'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
FreeSpaceLabel := LabelCreateEx(WizardForm, '', ScaleX(280), ScaleY(380), ScaleX(300), ScaleY(16),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, True, taLeftJustify);
SetFreeDiscSpace;
// *** "Select Components" wizard page
SelectComponentsLabel := LabelCreateEx(WizardForm, WizardForm.SelectComponentsLabel.Caption, ScaleX(280), ScaleY(130), ScaleX(511), ScaleY(50),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
WizardForm.ComponentsList.Parent := WizardForm;
WizardForm.ComponentsList.SetBounds(ScaleX(280), ScaleY(190), ScaleX(511), ScaleY(180));
WizardForm.ComponentsList.ItemHeightFixed := True;
// *** "Installing" wizard page
WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.SetBounds(ScaleX(280), ScaleY(190), ScaleX(511), ScaleY(25));
StatusLabel := LabelCreateEx(WizardForm, SetupMessage(msgStatusExtractFiles), ScaleX(280), ScaleY(140), ScaleX(511), ScaleY(20),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, False, taLeftJustify);
FilenameLabel := LabelCreateEx(WizardForm, '* * *', ScaleX(280), ScaleY(170), ScaleX(511), ScaleY(20),
'Calibri', 9, 0, [fsbold], $dddddd, $2a2c2d, False, False, taLeftJustify);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do
begin
Parent := WizardForm;
SetBounds(ScaleX(280), ScaleY(190), ScaleX(460), ScaleY(25));
Max := 1000;
Hide;
end;
PctLabel1 := LabelCreateEx(WizardForm, '', ScaleX(750), ScaleY(193), ScaleX(50), ScaleY(20),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, False, taLeftJustify);
#ifdef SecondProgressBar
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do
begin
Parent := WizardForm;
SetBounds(ScaleX(280), ScaleY(230), ScaleX(460), ScaleY(25));
Max := 1000;
Hide;
end;
PctLabel2 := LabelCreateEx(WizardForm, '', ScaleX(750), ScaleY(233), ScaleX(50), ScaleY(20),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, False, taLeftJustify);
#endif
ElapsedTimeLabel := LabelCreateEx(WizardForm, '', ScaleX(280), ScaleY(270), ScaleX(250), ScaleY(20),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
RemainingTimeLabel := LabelCreateEx(WizardForm, '', ScaleX(280), ScaleY(290), ScaleX(250), ScaleY(20),
'Calibri', 10, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
// *** "Setup Completed" wizard page
FinishedHeadingLabel := LabelCreateEx(WizardForm, WizardForm.FinishedHeadingLabel.Caption, ScaleX(270), ScaleY(70), ScaleX(531), ScaleY(45),
'Calibri', 14, 2, [fsBold], $efefef, $2a2c2d, False, True, taCenter);
FinishedLabel := LabelCreateEx(WizardForm, '', ScaleX(270), ScaleY(180), ScaleX(531), ScaleY(160),
'Calibri', 11, 2, [fsBold], $dddddd, $2a2c2d, False, True, taLeftJustify);
end;
////////////////////////////////////////////////////////////////////////////
procedure HideWizardComponents;
var
i: Integer;
begin
for i := 1 to 6 do
ImgSetVisibility(WizardImg[i], False);
HideLabelEx(WelcomeLabel1);
HideLabelEx(WelcomeLabel2);
ImgSetVisibility(HardwarePanel, False);
HideLabelEx(HardwareLabel);
HideLabelEx(Processor);
HideLabelEx(VideoCard);
HideLabelEx(SoundCard);
HideLabelEx(PhysRAM);
HideLabelEx(OS);
HideLabelEx(ProcessorName);
HideLabelEx(VideoCardName);
HideLabelEx(SoundCardName);
HideLabelEx(PhysRAMSize);
HideLabelEx(OSName);
HideLabelEx(HardwareClickLabel);
ImgSetVisibility(DirFolder, False);
ImgSetVisibility(GroupFolder, False);
ImgSetVisibility(DirEdit, False);
ImgSetVisibility(GroupEdit, False);
WizardForm.DirBrowseButton.Hide;
HideLabelEx(SelectDirLabel);
HideLabelEx(DirEditText);
WizardForm.GroupBrowseButton.Hide;
HideLabelEx(SelectStartMenuFolderLabel);
HideLabelEx(GroupEditText);
HideLabelEx(NeedSpaceLabel);
HideLabelEx(FreeSpaceLabel);
HideLabelEx(SelectDirBrowseLabel);
HideLabelEx(SelectComponentsLabel);
WizardForm.ComponentsList.Hide;
WizardForm.ProgressGauge.Hide;
HideLabelEx(PctLabel1);
#ifdef SecondProgressBar
HideLabelEx(PctLabel2);
#endif
HideLabelEx(ElapsedTimeLabel);
HideLabelEx(RemainingTimeLabel);
HideLabelEx(FilenameLabel);
HideLabelEx(StatusLabel);
HideLabelEx(FinishedHeadingLabel);
HideLabelEx(FinishedLabel);
end;
procedure ChangeWizardPages(CurPageID: Integer);
var
i: Integer;
begin
HideWizardComponents;
ShowLabelEx(PageNameLabel);
ShowLabelEx(PageDescLabel);
SetLabelExCaption(PageNameLabel, WizardForm.PageNameLabel.Caption);
SetLabelExCaption(PageDescLabel, WizardForm.PageDescriptionLabel.Caption);
for i := 1 to 6 do
SetLabelExColor(StatusPanelLabel[i], clBlack, clSilver);
case CurPageID of
wpWelcome:
begin
ImgSetVisibility(WizardImg[1], True);
SetLabelExColor(StatusPanelLabel[1], clBlack, clWhite);
HideLabelEx(PageNameLabel);
HideLabelEx(PageDescLabel);
ShowLabelEx(WelcomeLabel1);
ShowLabelEx(WelcomeLabel2);
end;
wpHardware:
begin
ImgSetVisibility(WizardImg[2], True);
SetLabelExColor(StatusPanelLabel[2], clBlack, clWhite);
ImgSetVisibility(HardwarePanel, True);
ShowLabelEx(HardwareLabel);
ShowLabelEx(Processor);
ShowLabelEx(VideoCard);
ShowLabelEx(SoundCard);
ShowLabelEx(PhysRAM);
ShowLabelEx(OS);
ShowLabelEx(ProcessorName);
ShowLabelEx(VideoCardName);
ShowLabelEx(SoundCardName);
ShowLabelEx(PhysRAMSize);
ShowLabelEx(OSName);
ShowLabelEx(HardwareClickLabel);
end;
wpSelectDir:
begin
ImgSetVisibility(WizardImg[3], True);
SetLabelExColor(StatusPanelLabel[3], clBlack, clWhite);
ImgSetVisibility(DirFolder, True);
ImgSetVisibility(GroupFolder, True);
ImgSetVisibility(DirEdit, True);
ImgSetVisibility(GroupEdit, True);
WizardForm.DirBrowseButton.Show;
ShowLabelEx(SelectDirLabel);
ShowLabelEx(DirEditText);
WizardForm.GroupBrowseButton.Show;
ShowLabelEx(SelectStartMenuFolderLabel);
ShowLabelEx(GroupEditText);
ShowLabelEx(FreeSpaceLabel);
ShowLabelEx(NeedSpaceLabel);
ShowLabelEx(SelectDirBrowseLabel);
end;
wpSelectComponents:
begin
ImgSetVisibility(WizardImg[4], True);
SetLabelExColor(StatusPanelLabel[4], clBlack, clWhite);
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
ShowLabelEx(SelectComponentsLabel);
WizardForm.ComponentsList.Show;
end;
wpInstalling:
begin
ImgSetVisibility(WizardImg[5], True);
SetLabelExColor(StatusPanelLabel[5], clBlack, clWhite);
WizardForm.ProgressGauge.Show;
ShowLabelEx(StatusLabel);
ShowLabelEx(FilenameLabel);
end;
wpFinished:
begin
ImgSetVisibility(WizardImg[6], True);
SetLabelExColor(StatusPanelLabel[6], clBlack, clWhite);
ShowLabelEx(FinishedHeadingLabel);
if not ISDoneError then
SetLabelExCaption(FinishedLabel, WizardForm.FinishedLabel.Caption)
else
SetLabelExCaption(FinishedLabel, SetupMessage(msgSetupAborted));
ShowLabelEx(FinishedLabel);
end;
end;
ImgApplyChanges(WizardForm.Handle);
end;
////////////////////////////////////////////////////////////////////////////
procedure DirEditChange(Sender: TObject);
begin
SetLabelExCaption(DirEditText,
MinimizePathName(WizardForm.DirEdit.Text, DirEditText.Massive[0].Font, DirEditText.Massive[0].Width));
SetFreeDiscSpace;
end;
procedure GroupEditChange(Sender: TObject);
begin
SetLabelExCaption(GroupEditText,
MinimizePathName(WizardForm.GroupEdit.Text, GroupEditText.Massive[0].Font, GroupEditText.Massive[0].Width));
end;
////////////////////////////////////////////////////////////////////////////
function ISDoneProgressCallback(OveralPct, CurrentPct: Integer; CurrentFile, TimeStr1, TimeStr2, TimeStr3: PAnsiChar): LongWord;
begin
if OveralPct <= 1000 then ISDoneProgressBar1.Position := OveralPct;
SetLabelExCaption(PctLabel1, IntToStr(OveralPct div 10) + '.' + chr(48 + OveralPct mod 10) + ' %');
#ifdef SecondProgressBar
if CurrentPct <= 1000 then ISDoneProgressBar2.Position := CurrentPct;
SetLabelExCaption(PctLabel2, IntToStr(CurrentPct div 10) + '.' + chr(48 + CurrentPct mod 10) + ' %');
#endif
SetLabelExCaption(FilenameLabel, MinimizePathName(CurrentFile, FilenameLabel.Massive[0].Font, FilenameLabel.Massive[0].Width));
SetLabelExCaption(ElapsedTimeLabel, FmtMessage(CustomMessage('ElapsedTime'), [TimeStr2]));
SetLabelExCaption(RemainingTimeLabel, FmtMessage(CustomMessage('RemainingTime'), [TimeStr1]));
Result := ISDoneCancel;
end;
procedure ISDoneSetComponents(var Comps1, Comps2, Comps3, TmpValue: Cardinal);
begin
Comps1 := 0;
Comps2 := 0;
Comps3 := 0;
TmpValue := 1;
if IsComponentSelected('lang\rus') then Comps1 := Comps1 + TmpValue;
TmpValue := TmpValue * 2;
if IsComponentSelected('lang\eng') then Comps1 := Comps1 + TmpValue;
TmpValue := TmpValue * 2;
if IsComponentSelected('medecine\medecine1') then Comps1 := Comps1 + TmpValue;
TmpValue := TmpValue * 2;
if IsComponentSelected('medecine\medecine2') then Comps1 := Comps1 + TmpValue;
TmpValue := TmpValue * 2;
if IsComponentSelected('medecine\medecine3') then Comps1 := Comps1 + TmpValue;
end;
procedure ISDoneUnPack(CurStep: TSetupStep);
var
Comps1, Comps2, Comps3, TmpValue: Cardinal;
begin
WizardForm.ProgressGauge.Hide;
ISDoneProgressBar1.Show;
ShowLabelEx(PctLabel1);
#ifdef SecondProgressBar
ISDoneProgressBar2.Show;
ShowLabelEx(PctLabel2);
#endif
ShowLabelEx(ElapsedTimeLabel);
ShowLabelEx(RemainingTimeLabel);
ISDoneCancel := 0;
ISDoneExtractTemporaryFiles;
ISDoneSetComponents(Comps1, Comps2, Comps3, TmpValue);
#ifdef precomp
PCFVer := {#precomp};
#else
PCFVer := 0;
#endif
ISDoneError := True;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1, Comps2, Comps3, MainForm.Handle, {#NeedMem}, @ISDoneProgressCallback) then
begin
repeat
if not SrepInit('', 512, 0) then break;
if not PrecompInit('', 128, PCFVer) then break;
if not FileSearchInit(true) then break;
if not ISArcExtract ( 0,5, ExpandConstant('{src}\data-1.bin'), ExpandConstant('{app}\'), '', false, '1g2x3h7421', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ISArcExtract ( 0,5, ExpandConstant('{src}\data-2.bin'), ExpandConstant('{app}\'), '', false, '1g2x3h7421', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ISArcExtract ( 0,20 , ExpandConstant('{src}\data-3.bin'), ExpandConstant('{app}\HardWest_Data'), '', false, '1g2x3h7421', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ISArcExtract ( 0,30, ExpandConstant('{src}\data-4.bin'), ExpandConstant('{app}\HardWest_Data'), '', false, '1g2x3h7421', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ISArcExtract ( 0,40, ExpandConstant('{src}\data-5.bin'), ExpandConstant('{app}\Data'), '', false, '1g2x3h7421', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 30, ExpandConstant('{src}\data4.bin'), ExpandConstant('{app}\envs'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 30, ExpandConstant('{src}\data4.bin'), ExpandConstant('{app}\data_win64\worlds\windy_city'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data6.bin'), ExpandConstant('{app}\Data'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data7.bin'), ExpandConstant('{app}\Data\Win32'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data8.bin'), ExpandConstant('{app}\Data\Win32'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data10.bin'), ExpandConstant('{app}\Data'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data11.bin'), ExpandConstant('{app}\Data'), '', false, '12345', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISPrecompExtract( 0, 10, ExpandConstant('{app}\1.pcf'), ExpandConstant('{app}\1.arc'), true) then break;
//if not ISArcExtract ( 0, 10, ExpandConstant('{app}\1.arc'), ExpandConstant('{app}\'), '', true, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
#ifdef Components
//if not ISArcExtract ( 1, 0, ExpandConstant('{src}\G1.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 2, 0, ExpandConstant('{src}\G2.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 3, 0, ExpandConstant('{src}\G3.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 4, 0, ExpandConstant('{src}\G4.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 5, 0, ExpandConstant('{src}\Data-4.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 6, 0, ExpandConstant('{src}\G6.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//if not ISArcExtract ( 7, 0, ExpandConstant('{src}\G7.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
#endif
//// äàëåå íàõîäÿòñÿ çàêîììåíòèðîâàíûå ïðèìåðû ðàçëè÷íûõ ôóíêöèé ðàñïàêîâêè (÷òîáû êàæäûé ðàç íå ëàçèòü â ñïðàâêó çà ïðèìåðàìè)
(*
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not IS7ZipExtract ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
if not ISSRepExtract ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'), ExpandConstant('{app}\data.7z'), true) then break;
if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\out.dat'), false) then break;
if not ISPackZIP ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',false) then break;
if not ShowChangeDiskWindow ('Ïîæàëóéñòà, âñòàâüòå âòîðîé äèñê è äîæäèòåñü åãî èíèöèàëèçàöèè.', ExpandConstant('{src}'),'CODMW_2.arc') then break;
// ðàñïàêîâêà ãðóïïû ôàéëîâ ïîñðåäñòâîì âíåøíåãî ïðèëîæåíèÿ
FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
ExecError:=false;
while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
InFilePath:=ISGetName(0);
OutFilePath:=ISGetName(1);
OutFileName:=ISGetName(2);
ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)
ISDoneError := False;
until True;
ISDoneStop;
end;
ISDoneProgressBar1.Hide;
HideLabelEx(PctLabel1);
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
HideLabelEx(PctLabel2);
#endif
HideLabelEx(ElapsedTimeLabel);
HideLabelEx(RemainingTimeLabel);
if (CurStep = ssPostInstall) and ISDoneError then
begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', False);
end;
end;
////////////////////////////////////////////////////////////////////////////
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('ISSkinEx.dll');
ExtractTemporaryFile('Tiger.cjstyles');
ExtractTemporaryFile('Music.mp3');
ExtractTemporaryFile('zlib1.dll');
LoadSkin(ExpandConstant('{tmp}\Tiger.cjstyles'), '');
Result := True;
end;
procedure InitializeWizard();
begin
RedesignWizardForm;
CreateStatusPanel;
CreateWizardComponents;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpInstalling then
begin
SuspendProc;
Confirm := False;
Cancel := ExitSetupMsgBox;
if Cancel then
begin
SetLabelExCaption(StatusLabel, SetupMessage(msgStatusRollback));
HideLabelEx(FilenameLabel);
ISDoneCancel := 1;
end;
ResumeProc;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
ChangeWizardPages(CurPageID);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
ISDoneUnPack(CurStep);
end;
procedure DeinitializeSetup();
begin
gdipShutdown;
BASS_DeInit;
// Hide Window before unloading skin so user does not get
// a glimse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;[/SPOILER]