Автор: tabak96
Дата сообщения: 03.07.2011 11:22
[more]#define MyAppName "Dungeon Siege 3"
#define NeedSize 4350
#define NeedMem 512
#define records
;#define Components
#define facompress
;#define precomp "0.4"
;#define SrepInside
;#define unrar
;#define XDelta
;#define PackZIP
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppName}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
WizardImageFile=Files\WizardImage.bmp
WizardSmallImageFile=Files\WizardSmallImage.bmp
ShowTasksTreeLines=true
DirExistsWarning=no
OutputDir=C:\Users\Max\Desktop\Для Репака\Готовые Скрипты\Закос под R.G. Modern\Закос под R.G. Modern
OutputBaseFilename=setup
Compression=none
SolidCompression=true
AllowNoIcons=false
InternalCompressLevel=none
DiskSpanning=true
DiskSliceSize=1457664000
[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
[Types]
Name: full; Description: Full installation; Flags: iscustom
#ifdef Components
[Components]
Name: type; Description: {#MyAppName}; Types: full; Flags: fixed
Name: multiplayer; Description: Addons; Types: full
Name: type\textmod; Description: Textmod; Types: full; Flags: fixed
Name: type\neon; Description: Light & Neon; Types: full
Name: type\dps; Description: DPS Citizen; Types: full
Name: type\Adverts; Description: Adverts; Types: full
#endif
[CustomMessages]
rus.Welcome1=Вас приветствует Мастер установки игры %n {#SetupSetting("AppName")}
rus.Welcome2=%n Рекомендуется закрыть все прочие приложения перед тем, как продолжить.%nНажмите «Далее», чтобы продолжить, или «Отмена», чтобы выйти из программы установки.
rus.FreeSpace=Доступно места на диске:
rus.NeedSpace=Требуется места на диске:
rus.Finished1=Завершение Мастера установки %n{#Myappname}
rus.Finished2=Игра {#MyAppName} установлена на Ваш компьютер. %nНажмите «Завершить», чтобы выйти из программы установки.
rus.AdditionalTasks=Дополнительное програмное обеспечения:
rus.UpdateDirect=Обновить DirectX
rus.ExtractedFile=Извлекается файл:
rus.Extracted=Распаковка файлов...
rus.CancelButton=Отмена
rus.Error=Ошибка распаковки!
rus.ElapsedTime=Прошло:
rus.RemainingTime=Осталось времени:
rus.EstimatedTime=Всего:
rus.AllElapsedTime=Время установки:
rus.Error2=Установка игры {#MyAppName} %n не завершена!
rus.Error=Ошибка распаковки!
rus.Error2=Установка {#MyAppName} не завершена.
rus.Error3=Во время установки {#MyAppName} произошла ошибка,%n пожалуйста отключите сторонние программы и повторите попытку установки.
[Files]
Source: "C:\Games\Dungeon Siege 3\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: Files\ISSkin.dll; DestDir: {tmp}; Flags: dontcopy
Source: Files\skin1.cjstyles; DestDir: {tmp}; Flags: dontcopy
Source: Files\papka.bmp; DestDir: {tmp}; Flags: dontcopy
Source: Files\End.bmp; DestDir: {tmp}; Flags: dontcopy
Source: Files\Logo.bmp; DestDir: {tmp}; Flags: dontcopy
Source: Files\button.bmp; DestDir: {tmp}; Flags: dontcopy
Source: Files\Logo.bmp; DestDir: {app}; Attribs: hidden system
Source: Files\WizardSmallImage.bmp; DestDir: {app}; Attribs: hidden system
Source: Files\ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Files\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef SrepInside
Source: Files\arc.ini; DestDir: {tmp}; Flags: dontcopy
Source: Files\srep.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
#if precomp == "0.38"
Source: Files\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.4"
Source: Files\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.41"
Source: Files\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#else
Source: Files\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Files\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
Source: Files\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#endif
#endif
#endif
#ifdef unrar
Source: Files\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Files\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Files\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Files\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif
[Tasks]
Name: desktopicon; Description: Создать ярлык на рабочем столе?; GroupDescription: Ярлыки:
Name: Tasks0; Description: Установить дополнительное программное обеспечения:; Flags: unchecked
Name: Tasks0\Tasks3; Description: Обновить библиотеки &DirectX; GroupDescription: """Установить дополнительное программное обеспечения:"""
Name: Tasks0\Tasks2; Description: Обновить библиотеки &Microsoft Visual C++ Redist; GroupDescription: """Установить дополнительное программное обеспечения:"""
[Run]
Filename: {src}\Redist\vcredist_x86.exe; StatusMsg: Установка Microsoft Visual C++ Redist; Parameters: /Q; WorkingDir: {src}\Redist; Flags: waituntilterminated; Tasks: Tasks0\Tasks2
Filename: {src}\Redist\DirectX\DXSETUP.exe; StatusMsg: Обновления DirectX; WorkingDir: {src}\Redist; Flags: waituntilterminated; Tasks: Tasks0\Tasks3
[Icons]
Name: {userdesktop}\{#MyAppName}; Filename: {app}\Dungeon Siege III.exe; IconFilename: {app}\Dungeon Siege III.exe; WorkingDir: {app}; Tasks: desktopicon
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; IconFilename: {app}\SPORE\Sporebin\SporeApp.exe; Comment: Удалить игру
[UninstallDelete]
Type: filesandordirs; Name: {app}
[Code]
const
Color = clblack;
ButtonWidth = 80;
ButtonHeight = 23;
bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;
bidbtnCancelUnpacking = 5;
PM_REMOVE = 1;
CP_ACP = 0; CP_UTF8 = 65001;
oneMB=1024*1024;
Period = 250;
VK_ESCAPE = 27;
HC_ACTION = 0;
WH_CALLWNDPROC = 4;
WM_PAINT = $F;
PCFonFLY=true;
notPCFonFLY=false;
var
LogoImage: TBitmapImage;
ButtonPanel: array [0..4] of TPanel;
ButtonImage: array [0..4] of TBitmapImage;
ButtonLabel: array [0..4] of TLabel;
StatusLabel, FileNameLabel, ExtractFile, StatusInfo, FinishedLabel: TLabel;
ProgressBar: TNewProgressBar;
CancelCode, n, ArcInd, UnPackError, StartInstall, LastTimerEvent, lastMb, baseMb: Integer;
WndHookID, TimerID: LongWord;
msgError: string;
FreezeTimer: Boolean;
totalUncompressedSize, origsize: Integer;
Texture2, Texture: TBitmapImage;
NeedSpaceLabel,FreeSpaceLabel: TLabel;
FreeMB, TotalMB: Cardinal;
SizeStr: String;
SizeInt: Integer;
SymbolNumber: Integer;
BmpFile: TBitmapImage;
InBevel, UpBevel:TBevel;
Finished1, LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
ISDoneProgressBar1: TNewProgressBar;
MyCancelButton: TButton;
ISDoneCancel:integer;
ISDoneError:boolean;
PCFVer:double;
StartMenuIconLabel: TLabel;
StartMenuIcon: TCheckBox;
IsCustomFontInstalled:Boolean;
GameFont:string;
//*************************************************//[Начало- ISdone]*************************************************************//
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';
function SrepInit(TmpFile:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function AddFontResource(FileName: PAnsiChar): Integer; external 'AddFontResourceA@gdi32.dll stdcall';
function RemoveFontResource(FileName: PAnsiChar): BOOL; external 'RemoveFontResourceA@gdi32.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
Result := ISDoneCancel;
end;
procedure CancelButtonOnClick(Sender: TObject);
begin
WizardForm.FileNamelabel.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
ISDoneProgressBar1.Hide;
WizardForm.StatusLabel.Caption:='Откат установки...';
ISDoneCancel:=1;
end;
procedure HideControls;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
end;
procedure CreateControls;
var PBTop:integer;
begin
WizardForm.StatusLabel.Top:=20;
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Top := PBTop;
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ScaleX(181);
Top := 80;
Width := ScaleX(80);
Font.Name:='Arial';
Font.Size:= 9;
Font.Color:=clwhite;
Font.Style := [fsBold];
BringToFront;
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := 120;
Left := ScaleX(0);
Top := ScaleY(100);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(100);
Left := 0;
Top := 120;
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
AutoSize := False;
Width := 300;
Left := 180;
Top := 210;
Font.Color:=clwhite;
end;
end;
function CheckError:boolean;
begin
result:= not ISDoneError;
end;
//************************************************ [Начало - Вн. вид инсталла] ***************************************************//
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
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 GetSize(): Integer;
begin
SizeStr:= WizardForm.DiskSpaceLabel.Caption;
for SymbolNumber:= 97 to 122 do begin
while (Pos(Chr(SymbolNumber), SizeStr) > 0) do Delete(SizeStr, Pos(Chr(SymbolNumber), SizeStr),1);
while (Pos(AnsiUppercase(Chr(SymbolNumber)), SizeStr) > 0) do Delete(SizeStr, Pos(AnsiUppercase(Chr(SymbolNumber)), SizeStr),1); end;
for SymbolNumber:= 192 to 255 do begin
while (Pos(Chr(SymbolNumber), SizeStr) > 0) do Delete(SizeStr, Pos(Chr(SymbolNumber), SizeStr),1); end;
while (Pos('.', SizeStr) > 0) do Delete(SizeStr, Pos('.', SizeStr), 1)
Delete(SizeStr, Pos(',', SizeStr), 5)
Result:= StrToInt(Trim(SizeStr));
end;
function CompareNum(FirstNum, SecondNum: Integer): Boolean;
begin
if FirstNum < SecondNum then Result:= False else Result:= True;
end;
Function MbOrTb(Byte: Extended): String;
begin
if Byte < 1024 then Result:= NumToStr(Byte) + ' Мб' else
if Byte/1024 < 1024 then Result:= NumToStr(round(Byte/1024*100)/100) + ' Гб' else
Result:= NumToStr(round((Byte/(1024*1024))*100)/100) + ' Тб'
end;
procedure GetFreeSpaceCaption(Sender: TObject);
var Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
FreeSpaceLabel.Caption := ExpandConstant('{cm:FreeSpace} ') + MbOrTB(FreeMb) + ' (' + IntToStr((FreeMb*100) div TotalMB) + ' %)';
NeedSpaceLabel.Caption := ExpandConstant('{cm:NeedSpace} ') + MbOrTb(SizeInt)
if WizardForm.CurPageID = wpSelectDir then begin
WizardForm.NextButton.Enabled:= CompareNum(FreeMB, SizeInt)
end;
end;
procedure GetNeedSpace();
begin
WizardForm.DiskSpaceLabel.Hide;
#ifdef NeedSize
SizeInt:= {#NeedSize}
#else
SizeInt:= GetSize;
#endif
NeedSpaceLabel := TLabel.Create(WizardForm);
NeedSpaceLabel.SetBounds(ScaleX(0), ScaleY(198), ScaleX(209), ScaleY(13))
NeedSpaceLabel.Parent := WizardForm.SelectDirPage;
NeedSpaceLabel.Transparent:=true;
FreeSpaceLabel := TLabel.Create(WizardForm);
FreeSpaceLabel.SetBounds(ScaleX(0), ScaleY(216), ScaleX(209), ScaleY(13))
FreeSpaceLabel.Parent := WizardForm.SelectDirPage;
FreeSpaceLabel.Transparent:=true;
WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption;
WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0;
end;
procedure RepaintInstall();
begin
ExtractTemporaryFile('button.bmp')
ExtractTemporaryFile('papka.bmp');
ExtractTemporaryFile('Logo.bmp');
WizardForm.WizardBitmapImage.Width := ScaleX(497);
WizardForm.WizardBitmapImage2.Width := ScaleX(497);
WizardForm.PageNameLabel.Width:=ScaleX(300);
WizardForm.PageDescriptionLabel.Hide;
ExtractTemporaryFile('End.bmp');
BmpFile:= TBitmapImage.Create(WizardForm);
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\End.bmp'));
BmpFile.SetBounds(0, 0, 497, 313);
BmpFile.Stretch:= true
BmpFile.Parent:= WizardForm.FinishedPage;
WizardForm.Font.Color:=clWhite;
WizardForm.Color:=Color;
WizardForm.WelcomePage.Color:=Color;
WizardForm.InnerPage.Color:=Color;
WizardForm.FinishedPage.Color:=Color;
WizardForm.SelectDirPage.Color:=Color;
WizardForm.SelectComponentsPage.Color:=Color;
WizardForm.SelectProgramGroupPage.Color:=Color;
WizardForm.SelectTasksPage.Color:=Color;
WizardForm.ReadyPage.Color:=Color;
WizardForm.InstallingPage.Color:=Color;
WizardForm.PageNameLabel.Color:=Color;
WizardForm.PageNameLabel.Font.Color:=ClWhite;
WizardForm.MainPanel.Color:=Color;
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.SelectDirLabel.Color:=Color;
WizardForm.SelectDirBrowseLabel.Color:=Color;
WizardForm.DirEdit.Color:=Color;
WizardForm.DiskSpaceLabel.Color:=Color;
WizardForm.ComponentsList.Color:=Color;
WizardForm.SelectComponentsLabel.Color:=Color;
WizardForm.TypesCombo.Hide;
WizardForm.ComponentsDiskSpaceLabel.Hide;
WizardForm.GroupEdit.Color:=Color;
WizardForm.SelectStartMenuFolderLabel.Color:=Color;
WizardForm.SelectStartMenuFolderBrowseLabel.Color:=Color;
WizardForm.SelectTasksLabel.Color:=Color;
WizardForm.TasksList.Color:=Color;
WizardForm.ReadyMemo.Color:=Color;
WizardForm.ReadyMemo.ScrollBars:= ssNone
WizardForm.ReadyLabel.Color:=Color;
WizardForm.StatusLabel.Color:=Color;
WizardForm.FilenameLabel.Color:=Color;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.Font.Size:=8
WizardForm.Font.Name:= 'Verdana'
WizardForm.Font.Color:= ClWhite;
WizardForm.Bevel.visible:=False;
WizardForm.BeveledLabel.visible:=False;
WizardForm.Bevel1.visible:=False;
WizardForm.ReadyMemo.ScrollBars:= ssNone
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectDirBitmapImage.AutoSize:=true;
WizardForm.SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\papka.bmp'));
WizardForm.SelectGroupBitmapImage.AutoSize:=true;
LogoImage := TBitmapImage.Create(WizardForm);
with LogoImage do
begin
SetBounds(ScaleX(5), ScaleY(316), ScaleX(497), ScaleY(47));
Bitmap.LoadFromFile(ExpandConstant('{tmp}\Logo.bmp'));
Parent := WizardForm;
end;
with WizardForm.WizardSmallBitmapImage do
begin
SetBounds(ScaleX(0), ScaleY(0), ScaleX(497), ScaleY(58));
end;
with WizardForm.ComponentsList do
begin
Top:=ScaleY(55);
Height:=ScaleY(150);
end;
with TLabel.Create(WizardForm) do begin
AutoSize:=False;
SetBounds(ScaleX(-25), ScaleY(230), ScaleX(550), ScaleY(70));
WordWrap:=True;
Alignment := taCenter;
Transparent:=True;
Font.Name:='Arial';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Font.Style:=[fsBold];
Caption:= ExpandConstant('{cm:Welcome1}');
Parent:=WizardForm.WelcomePage;
end;
with TLabel.Create(WizardForm) do begin
AutoSize:=False;
SetBounds(ScaleX(-25), ScaleY(258), ScaleX(550), ScaleY(100));
WordWrap:=True;
Alignment := taCenter;
Transparent:=True;
Font.Name:='Arial';
Font.Size:= 8;
Font.Color:=$FFFFFF;
Caption:= ExpandConstant('{cm:Welcome2}');
Parent:=WizardForm.WelcomePage;
end;
Finished1:= TLabel.Create(WizardForm)
with Finished1 do begin
AutoSize:=False;
SetBounds(ScaleX(-25), ScaleY(230), ScaleX(550), ScaleY(70));
WordWrap:=True;
Alignment := taCenter;
Transparent:=True;
Font.Name:='Arial';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Font.Style:=[fsBold];
Caption:= ExpandConstant('{cm:Finished1}');
Parent:=WizardForm.FinishedPage;
end;
FinishedLabel:= TLabel.Create(WizardForm)
with FinishedLabel do begin
AutoSize:=False;
SetBounds(ScaleX(-25), ScaleY(270), ScaleX(550), ScaleY(100));
WordWrap:=True;
Alignment := taCenter;
Transparent:=True;
Font.Name:='Arial';
Font.Size:= 8;
Font.Color:=$FFFFFF;
Caption:= ExpandConstant('{cm:Finished2}');
Parent:=WizardForm.FinishedPage;
end;
end;
function InitializeSetup1(): Boolean;
begin
ExtractTemporaryFile('skin1.cjstyles');
LoadSkin(ExpandConstant('{tmp}\skin1.cjstyles'), '');
Result := True;
end;
procedure DeinitializeSetup();
begin
UnloadSkin();
end;
procedure InitializeUninstallProgressForm;
begin
FileCopy(ExpandConstant('{app}\WizardSmallImage.bmp'), ExpandConstant('{tmp}\WizardSmallImage.bmp'), False);
FileCopy(ExpandConstant('{app}\Logo.bmp'), ExpandConstant('{tmp}\Logo.bmp'), False);
UninstallProgressForm.Bevel.visible:=False;
UninstallProgressForm.BeveledLabel.visible:=False;
UninstallProgressForm.Bevel1.visible:=False;
UninstallProgressForm.Color:=Color;
UninstallProgressForm.InnerPage.Color:=Color;
UninstallProgressForm.MainPanel.Color:=Color;
UninstallProgressForm.PageNameLabel.Color:=Color;
UninstallProgressForm.PageDescriptionLabel.Hide;
UninstallProgressForm.PageNameLabel.Font.Color:=clWhite;
UninstallProgressForm.PageNameLabel.Width:=ScaleX(300);
UninstallProgressForm.StatusLabel.Color:=Color;
UninstallProgressForm.StatusLabel.Font.Color:=clWhite;
LogoImage := TBitmapImage.Create(UninstallProgressForm);
with LogoImage do
begin
SetBounds(ScaleX(5), ScaleY(316), ScaleX(497), ScaleY(47));
Bitmap.LoadFromFile(ExpandConstant('{tmp}\Logo.bmp'));
Parent := UninstallProgressForm;
end;
with UninstallProgressForm.WizardSmallBitmapImage do
begin
Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardSmallImage.bmp'));
SetBounds(ScaleX(0), ScaleY(0), ScaleX(497), ScaleY(58));
end;
end;
Procedure ISDoneShow(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and ISDoneError then
begin
LabelTime3.Hide;
WizardForm.Caption:=ExpandConstant('{cm:Error}');
Finished1.Caption:=ExpandConstant('{cm:Error2}');
FinishedLabel.Caption:=ExpandConstant('{cm:Error3}');
FinishedLabel.Font.Color:=clRed;
end;
end;
function InitializeSetup:boolean;
begin
InitializeSetup1()
Result:=True;
end;
//************************************************ [Конец - Вн. вид инсталла] ***************************************************//
//************************************************ [Начало - Кнопки] ***************************************************//
procedure ButtonLabelClick(Sender: TObject);
var
Button: TButton;
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
case TLabel(Sender).Tag of
bidBack: Button:=WizardForm.BackButton
bidNext: Button:=WizardForm.NextButton
bidCancel: Button:=WizardForm.CancelButton
bidDirBrowse: Button:=WizardForm.DirBrowseButton
bidGroupBrowse: Button:=WizardForm.GroupBrowseButton
bidbtnCancelUnpacking: Button := MyCancelButton;
else
Exit
end
Button.OnClick(Button)
end;
procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then
ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth
end;
procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
end;
procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer);
var
Image: TBitmapImage;
Panel: TPanel;
Labl: TLabel;
begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=AButton.Left
Panel.Top:=AButton.Top
Panel.Width:=AButton.Width
Panel.Height:=AButton.Height
Panel.Tag:=AButtonIndex
Panel.Parent:=AButton.Parent
ButtonPanel[AButtonIndex]:=Panel
Image:=TBitmapImage.Create(WizardForm)
Image.Width:=160
Image.Height:=23
Image.Enabled:=False
Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'))
Image.Parent:=Panel
ButtonImage[AButtonIndex]:=Image
with TLabel.Create(WizardForm) do begin
Tag:=AButtonIndex
Parent:=Panel
Width:=Panel.Width
Height:=Panel.Height
Transparent:=True
OnClick:=@ButtonLabelClick
OnDblClick:=@ButtonLabelClick
OnMouseDown:=@ButtonLabelMouseDown
OnMouseUp:=@ButtonLabelMouseUp
end
Labl:=TLabel.Create(WizardForm)
Labl.Left:=23
Labl.Top:=5
Labl.Autosize:=True
Labl.Alignment:=taCenter
Labl.Tag:=AButtonIndex
Labl.Transparent:=True
Labl.Font.Color:=clwhite
Labl.Caption:=AButton.Caption
Labl.OnClick:=@ButtonLabelClick
Labl.OnDblClick:=@ButtonLabelClick
Labl.OnMouseDown:=@ButtonLabelMouseDown
Labl.OnMouseUp:=@ButtonLabelMouseUp
Labl.Parent:=Panel
ButtonLabel[AButtonIndex]:=Labl
end;
procedure UpdateButton(AButton: TButton;AButtonIndex: integer);
begin
ButtonLabel[AButtonIndex].Caption := AButton.Caption;
ButtonPanel[AButtonIndex].Visible := AButton.Visible;
ButtonLabel[AButtonIndex].Enabled := Abutton.Enabled;
ButtonLabel[AButtonIndex].Left := ButtonPanel[AButtonIndex].Width div 2 - ButtonLabel[AButtonIndex].Width div 2;
ButtonLabel[AButtonIndex].Top := ButtonPanel[AButtonIndex].Height div 2 - ButtonLabel[AButtonIndex].Height div 2;
end;
procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=True
end;
procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=False
end;
procedure UpdateButtons(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
ButtonLabel[bidBack].Left := (ButtonPanel[bidBack].Width / 2 - ButtonLabel[bidBack].Width / 2);
ButtonLabel[bidNext].Left := (ButtonPanel[bidNext].Width / 2 - ButtonLabel[bidNext].Width / 2);
ButtonLabel[bidCancel].Left := (ButtonPanel[bidCancel].Width / 2 - ButtonLabel[bidCancel].Width / 2);
ButtonLabel[bidDirBrowse].Left := (ButtonPanel[bidDirBrowse].Width / 2 - ButtonLabel[bidDirBrowse].Width / 2);
ButtonLabel[bidGroupBrowse].Left := (ButtonPanel[bidGroupBrowse].Width / 2 - ButtonLabel[bidGroupBrowse].Width / 2);
end;
procedure ButtonTextures();
begin
WizardForm.BackButton.Width:=ButtonWidth
WizardForm.BackButton.Height:=ButtonHeight
WizardForm.NextButton.Width:=ButtonWidth
WizardForm.NextButton.Height:=ButtonHeight
WizardForm.CancelButton.Width:=ButtonWidth
WizardForm.CancelButton.Height:=ButtonHeight
WizardForm.DirBrowseButton.Left:=337
WizardForm.DirBrowseButton.Width:=ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight
WizardForm.GroupBrowseButton.Left:=337
WizardForm.GroupBrowseButton.Width:=ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight
WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick
WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick
LoadButtonImage(WizardForm.BackButton,bidBack)
LoadButtonImage(WizardForm.NextButton,bidNext)
LoadButtonImage(WizardForm.CancelButton,bidCancel)
LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse)
LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse)
end;
//************************************************ [Конец - Кнопки] ***************************************************//
//******************************************* [Начало - Прогрессбар] ***************************************************//
//******************************************* [Конец - Прогрессбар] ***************************************************//
//******************************************* [Начало - Работы распаковщика] ***************************************************//
//**********************************************[разделение на 2 диска]
function NextDisk(num: integer; CheckedFile: string): string;
var Capt:string;
CheckedDir:string;
Cancel:string;
begin
CheckedFile:=ExpandConstant(CheckedFile);
if not FileExists(CheckedFile) then begin
Capt:=ExpandConstant('{cm:disk}')+' №%n'+ExpandConstant('{cm:disk2}');
StringChange(Capt, '%n', inttostr(num));
StringChange(Capt, '%f', ExtractFileName(CheckedFile));
if MsgBox(Capt, mbConfirmation, MB_OKCANCEL)= IDCANCEL then
WizardForm.Close;
DelTree(ExpandConstant('{app}'), True, True, True);
begin
NextDisk(num, CheckedFile);
end;
Result := CheckedFile;
end;
end;
//**********************************************[конец разделение на 2 диска]
procedure InitializeWizard();
begin
GetNeedSpace();
RepaintInstall();
ButtonTextures();
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
ISDoneShow(CurPageID);
if CurPageID = wpSelectDir then begin
GetFreeSpaceCaption(nil)
end;
UpdateButtons(CurPageID);
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Cancel:=True;
Confirm:=false;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// //
// ТУТ ЗАКАНЧИВАЕТЬСЯ РАЗМЕТКА ИНСТАЛЛЯТОРА, И НАЧИНАЕТСЯ РАСПАКОВКА //
// //
// //
// //
// //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
FindHandle1,ColFiles1,CurIndex1,tmp:integer;
ExecError:boolean;
InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.CancelButton.OnClick:=@CancelButtonOnClick;
WizardForm.CancelButton.Hide;
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;
// Распаковка всех необходимых файлов в папку {tmp}.
#ifdef facompress
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef SrepInside
ExtractTemporaryFile('arc.ini');
ExtractTemporaryFile('srep.exe');
#endif
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
#if precomp == "0.38"
ExtractTemporaryFile('precomp038.exe');
#else
#if precomp == "0.4"
ExtractTemporaryFile('precomp040.exe');
#else
#if precomp == "0.41"
ExtractTemporaryFile('precomp041.exe');
#else
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('precomp040.exe');
ExtractTemporaryFile('precomp041.exe');
#endif
#endif
#endif
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
ExtractTemporaryFile('7z.dll');
ExtractTemporaryFile('PackZIP.exe');
#endif
// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
TmpValue:=1;
if IsComponentSelected('type\neon') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('type\dps') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
if IsComponentSelected('type\Adverts') then Comps1:=Comps1+TmpValue; //компонент 3
// .....
// см. справку
#endif
#ifdef precomp
PCFVer:={#precomp};
#else
PCFVer:=0;
#endif
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
repeat
if not SrepInit('',512,0) then break;
if not PrecompInit(PCFVer) then break;
if not FileSearchInit(false) then break;
if not ISArcExtract ( 0, 50, ExpandConstant('{src}\data1.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
if not ISSRepExtract ( 0, 50, ExpandConstant('{app}\data_archive.oaf.srep'),ExpandConstant('{app}\data_archive.oaf'), true) then break;
// далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
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" "{arr}\"'), ExpandConstant('{tmp}'), '...') 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);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)
ISDoneError:=false;
until true;
ISDoneStop;
end;
HideControls;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
WizardForm.Caption:=ExpandConstant('{cm:Error}');
WizardForm.FileNamelabel.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
ISDoneProgressBar1.Hide;
WizardForm.StatusLabel.Caption:='Откат установки...';
end;
end;[/more]