Автор: Habib2302
Дата сообщения: 29.05.2014 22:47
я хочу спросить. во время распаковки arc архивов я нажимаю отмена, но распаковка не прекращается. это так должно быть или нет?и и в FileNameLabel не отображается список извлекаемых фалов из инсталлятора. как вернуть?
[more]
Код:
; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!
#define NeedSize "5000000000"
#define NeedMem 512
#define SecondProgressBar
#define MyAppName "ABBYY Lingvo х5 Professional"
#define MyAppVersion "15.0.826.26"
#define MyAppURL "https://href.li/?http://www.abbyy.ru/lingvo-windows/20languages_pro/"
#include "WinTB.iss"
#include "botva2.iss"
[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={tmp}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} Lite RePack by Xabib
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=yes
SlicesPerDisk=4
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
AppendDefaultDirName=false
AppendDefaultGroupName=false
DisableReadyPage=true
AppID={#MyAppName}
VersionInfoDescription={#MyAppName} RePack by Xabib
AppCopyright=Xabib © 2014
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Xabib © 2014
DisableFinishedPage=false
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
Uninstallable=false
DisableProgramGroupPage=yes
#ifdef NeedSize
ExtraDiskSpaceRequired=0
#endif
DisableDirPage=yes
[Languages]
Name: "Russian"; MessagesFile: "Russian.isl"
[Files]
Source: WinTB.dll; Flags: dontcopy;
Source: C:\Windows\Fonts\*; DestDir: {app}\1111;
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
[CustomMessages]
Russian.ExtractedFile=Распаковка файлов...
Russian.Extracted=Распаковка архивов...
Russian.CancelButton=Отменить распаковку
Russian.Error=Ошибка распаковки!
Russian.ElapsedTime=Прошло:
Russian.RemainingTime=Осталось времени:
Russian.EstimatedTime=Всего:
Russian.AllElapsedTime=Время установки:
[Run]
Filename: {app}\Setup.exe; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait skipifsilent PostInstall Unchecked;
[ Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
///////////////////////////////////Относится к лого и изображениям мастера
RT_RCDATA = 10;
LOAD_LIBRARY_AS_DATAFILE = $2;
var
///////////////////////////////////Лого и изображения
lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
BtnImage: TBitmapImage;
///////////////////////////////////////////
iInitialize: Boolean;
LabelPct1,LabelCurrFileName: TLabel;
ISDoneProgressBar1: TNewProgressBar;
ISDoneCancel:integer;
ISDoneError:boolean;
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
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 Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@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 ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := ExpandConstant('{cm:Extracted} ');
LabelCurrFileName.Caption:=MinimizePathName(CurrentFile, LabelCurrFileName.Font, ScaleX(417));
Result := ISDoneCancel;
end;
///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
finally
lResStream.Free;
Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
end;
end;
function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;
procedure InitializeWizard;
begin
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage
with WizardForm do
begin
///////////////////////////////////Логотип и изображения мастера
iInitialize := True;
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') and GetFromRes('_IS_APIC', 'aPic.png') then
begin
///////////////////////////////////Изображения
bPicHandle := ImgLoad(WelcomePage.Handle, ExpandConstant('{tmp}\aPic.png'), WizardBitmapImage.Left, WizardBitmapImage.Top, WizardBitmapImage.Width, WizardBitmapImage.Height, True, True);
WizardBitmapImage.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(WelcomePage.Handle);
bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
WizardBitmapImage2.Hide;
ImgSetVisibility(bPicHandle, True);
ImgApplyChanges(FinishedPage.Handle);
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
DiskSpaceLabel.Hide;
ComponentsDiskSpaceLabel.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);
////////////////////////////////////////////
///////////////////////////////////Логотип
lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40), True, True);
ImgApplyChanges(WizardForm.Handle);
end;
///////////////////////////////////WinTB
ExtractTemporaryFile('WinTB.dll');
SetTaskBarProgressValue(0, 60);
SetTaskBarProgressState(0, TBPF_ERROR);
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);
//////////////////////////////////////
with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40));
end;
end;
end;
procedure HideControls;
begin
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
end;
procedure CreateControls;
var PBTop:integer;
begin
PBTop:=ScaleY(70);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(417);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ScaleX(0);
Top := ScaleY(30);
Width := ScaleX(417);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ScaleX(417);
Left := ScaleX(0);
Top := ScaleY(46);
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectTasks:
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
end;
if (CurPageID = wpFinished) and ISDoneError then
end;
function CheckError:boolean;
begin
result:= not ISDoneError;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:ExtractedFile}');
ISDoneCancel:=0;
// Распаковка всех необходимых файлов в папку {tmp}.
ExtractTemporaryFile('unarc.dll');
#ifdef facompress
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
ExtractTemporaryFile('English.ini');
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, 0, 0, 0, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
repeat
if not ISArcExtract (0, 0, ExpandConstant('{src}\ABBYY_Lingvo_X5.xabib'), ExpandConstant('{app}'), '', false, 'khrushchev194023', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}'), false) 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);
end;
end;
procedure DeinitializeSetup();
begin
if iInitialize then
begin
gdipShutdown;
TaskBarDestroy;
end;
end;