Dark_Delphin
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору #define NeedSize "10000000000" #define Components ;#define records ;#define precomp04 #define precomp038 ;#define unrar [Setup] AppName=ISDone AppVerName=ISDone DefaultDirName={pf}\ISDone OutputDir=. OutputBaseFilename=Setup SolidCompression=yes #ifdef NeedSize ExtraDiskSpaceRequired={#NeedSize} #endif WizardImageFile=img.bmp WizardSmallImageFile=img.bmp #ifdef Components [Types] Name: "full"; Description: "Full installation"; Flags: iscustom [Components] Name: "text"; Description: "Язык субтитров"; Types: full; Flags: fixed Name: "text\rus"; Description: "Русский"; Flags: exclusive; ExtraDiskSpaceRequired: 100000000 Name: "text\eng"; Description: "Английский"; Flags: exclusive; ExtraDiskSpaceRequired: 200000000 Name: "voice"; Description: "Язык озвучки"; Types: full; Flags: fixed Name: "voice\rus"; Description: "Русский"; Flags: exclusive; ExtraDiskSpaceRequired: 500000000 Name: "voice\eng"; Description: "Английский"; Flags: exclusive; ExtraDiskSpaceRequired: 600000000 #endif [Files] Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy Source: Include\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy #ifdef records Source: records.inf; DestDir: {tmp}; Flags: dontcopy #endif #ifdef precomp038 Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy #endif [CustomMessages] russian.ExtractedFile=Распаковывается файл: russian.CancelButton=Отменить распаковку russian.Error=Ошибка распаковки! [Languages] Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" [UninstallDelete] Type: filesandordirs; Name: {app} [Code] var LabelPct,LabelCurrFileName: TLabel; ISDoneProgressBar: TNewProgressBar; MyCancelButton: TButton; OveralPct,Cancel:integer; CallBack:longword; MyError:boolean; type TCallback = function (Pct: integer;CurrentFile:string): longword; TMessage = record hWnd: HWND; msg, wParam: Word; lParam: LongWord; Time: TFileTime; pt: TPoint; end; function PeekMessage(var lpMsg: TMessage; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall'; function TranslateMessage(const lpMsg: TMessage): BOOL; external 'TranslateMessage@user32.dll stdcall'; function DispatchMessage(const lpMsg: TMessage): Longint; external 'DispatchMessageA@user32.dll stdcall'; function WrapMyCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:innocallback.dll stdcall'; function ISArcExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; callback: longword; Password, CfgFile, WorkPath: AnsiString):BOOL; external 'ISArcExtract@files:ISDone.dll stdcall'; function IS7ZipExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; callback: longword; Password: AnsiString):BOOL; external 'IS7zipExtract@files:ISDone.dll stdcall'; function ISPrecompExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean; callback: longword):BOOL; external 'ISPrecompExtract@files:ISDone.dll stdcall'; function ISSRepExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile, IdxFile: AnsiString; DeleteInFile:boolean; callback: longword):BOOL; external 'ISSrepExtract@files:ISDone.dll stdcall'; function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):BOOL; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall'; function StartRecord(RecordFileName:AnsiString; AllComponents:longword):BOOL; external 'StartRecord@files:ISDone.dll stdcall'; function CheckPoint(CurComponent:Integer):BOOL; external 'CheckPoint@files:ISDone.dll stdcall'; function StopRecord:BOOL; external 'StopRecord@files:ISDone.dll stdcall'; function ProgressCallback(Pct: integer; CurrentFile:AnsiString): longword; var Msg: TMessage; begin if Pct<=ISDoneProgressBar.Max then ISDoneProgressBar.Position := Pct; LabelPct.Caption := IntToStr(Pct div 10)+'.'+chr(48 + Pct mod 10)+'%'; LabelCurrFileName.Caption :=ExpandConstant('{cm:ExtractedFile} ')+CurrentFile; while PeekMessage(Msg, 0, 0, 0, 1) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; Result := Cancel; end; procedure CancelButtonOnClick(Sender: TObject); begin if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then Cancel:=1; end; procedure InitializeWizard(); begin //////////// WizardForm.MainPanel.Color := clsilver; WizardForm.WizardBitmapImage.Width := 497; WizardForm.WizardBitmapImage2.Width := 497; WizardForm.PageNameLabel.Width:=0; WizardForm.PageDescriptionLabel.Hide; WizardForm.Font.Color:=clblack; WizardForm.Color:=clsilver; WizardForm.WelcomePage.Color:=clsilver; WizardForm.InnerPage.Color:=clsilver; WizardForm.FinishedPage.Color:=clsilver; WizardForm.WelcomeLabel1.Hide; WizardForm.WelcomeLabel2.Hide; with TLabel.Create(WizardForm) do begin AutoSize:=WizardForm.WelcomeLabel1.AutoSize; Left:=WizardForm.WelcomeLabel1.Left; Top:=WizardForm.WelcomeLabel1.Top Width:=WizardForm.WelcomeLabel1.Width Height:=WizardForm.WelcomeLabel1.Height WordWrap:=WizardForm.WelcomeLabel1.WordWrap; Font.Name:=WizardForm.WelcomeLabel1.Font.Name; Font.Size:=WizardForm.WelcomeLabel1.Font.Size; Font.Color:=clblack; Font.Style:=WizardForm.WelcomeLabel1.Font.Style; Caption:=WizardForm.WelcomeLabel1.Caption; Parent:=WizardForm.WelcomeLabel1.Parent Transparent:=True end; with TLabel.Create(WizardForm) do begin AutoSize:=WizardForm.WelcomeLabel2.AutoSize; Left:=WizardForm.WelcomeLabel2.Left; Top:=WizardForm.WelcomeLabel2.Top Width:=WizardForm.WelcomeLabel2.Width Height:=WizardForm.WelcomeLabel2.Height WordWrap:=WizardForm.WelcomeLabel2.WordWrap; Font.Name:=WizardForm.WelcomeLabel2.Font.Name; Font.Size:=WizardForm.WelcomeLabel2.Font.Size; Font.Color:=clblack; Font.Style:=WizardForm.WelcomeLabel2.Font.Style; Caption:=WizardForm.WelcomeLabel2.Caption; Parent:=WizardForm.WelcomeLabel2.Parent Transparent:=True end; ///////////////////////////////////////////// ISDoneProgressBar := TNewProgressBar.Create(WizardForm); with ISDoneProgressBar do begin Left := ScaleX(0); Top := ScaleY(40); Width := ScaleX(417); Max := 1000; Height := WizardForm.ProgressGauge.Height; Parent := WizardForm.InstallingPage; end; LabelPct := TLabel.Create(WizardForm); with LabelPct do begin Parent := WizardForm.InstallingPage; AutoSize := False; Width := WizardForm.ProgressGauge.Width; Top := WizardForm.ProgressGauge.Top + ScaleY(40); Alignment := taCenter; Caption := ''; end; LabelCurrFileName := TLabel.Create(WizardForm); with LabelCurrFileName do begin Parent := WizardForm.InstallingPage; AutoSize := False; Width := WizardForm.ProgressGauge.Width; Left := ScaleX(0); Top := WizardForm.ProgressGauge.Top + ScaleY(25); Caption := ''; end; end; Procedure CurPageChanged(CurPageID: Integer); Begin if (CurPageID = wpFinished) and MyError then begin WizardForm.Caption:= ExpandConstant('{cm:Error}'); WizardForm.FinishedLabel.Font.Color:= clRed; WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ; end; end; procedure CurStepChanged(CurStep: TSetupStep); var ChComp, TmpValue:longword; n:integer; begin if CurStep = ssInstall then begin //Если необходимо, можно переделать на ssPostInstall WizardForm.ProgressGauge.Hide; WizardForm.CancelButton.Visible:=false; MyCancelButton:=TButton.Create(WizardForm); with MyCancelButton do begin Parent:=WizardForm; Width:=ScaleX(135); Caption:=ExpandConstant('{cm:CancelButton}'); Left:=ScaleX(360); Top:=WizardForm.cancelbutton.top; OnClick:=@CancelButtonOnClick; end; CallBack:=WrapMyCallback(@ProgressCallback,2); Cancel:=0; OveralPct:=0; // Распаковка всех необходимых файлов в папку {tmp}. Это необходимо для того, чтобы //выполнять установку в момент ssInstall, и секция [Run] выполнялась после установки. #ifdef records ExtractTemporaryFile('records.inf'); #endif #ifdef precomp038 ExtractTemporaryFile('packjpg_dll.dll'); ExtractTemporaryFile('RTconsole.exe'); ExtractTemporaryFile('precomp038.exe'); ExtractTemporaryFile('zlib1.dll'); #endif // Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll ChComp:=0; #ifdef Components TmpValue:=1; if IsComponentSelected('text\rus') then ChComp:=ChComp+TmpValue; //компонент 1 TmpValue:=TmpValue*2; if IsComponentSelected('text\eng') then ChComp:=ChComp+TmpValue; //компонент 2 TmpValue:=TmpValue*2; if IsComponentSelected('voice\rus') then ChComp:=ChComp+TmpValue; //компонент 3 TmpValue:=TmpValue*2; if IsComponentSelected('voice\eng') then ChComp:=ChComp+TmpValue; //компонент 4 #endif StartRecord(ExpandConstant('{src}\records.inf'),ChComp); repeat MyError:=true; if not ISArcExtract ( 0, OveralPct, 0, ExpandConstant('{src}\muzk.arc'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break; if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\muzk.srep'), ExpandConstant('{app}\muzk.pcf'), '', true, CallBack ) then break; if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\muzk.pcf'), ExpandConstant('{app}\muzk.7z'), true, CallBack ) then break; if not IS7ZipExtract ( 0, OveralPct, 0, ExpandConstant('{app}\muzk.7z'), ExpandConstant('{app}'), true, CallBack, '' ) then break; MyError:=false; until true; StopRecord; MyCancelButton.Visible:=false; WizardForm.CancelButton.Visible:=true; end; if (CurStep=ssPostInstall) and MyError then Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); end; |