我现在已经盯着这个InnoSetup代码几个小时了,我无法围绕以下事项:
-In“procedure CurStepChanged”common.dat和common.fat不会被复制到{app}目录。为什么呢?
- 我手动将common.dat和common.fat复制到{app}目录进行测试,但xdelta3.exe不会在“procedure CurStepChanged”中执行。 xdelta3.exe的参数是“-d -s old_file patch_file new_file”。 Xdelta3.exe,common_patch.xdelta和commonfat_patch.xdelta被复制到正确的位置({app})。为什么呢?
我在俯瞰什么?
[Setup]
AppCopyright=lostprophet
AppName=Far Cry 3 Magyarítás
AppVerName=Far Cry 3 Magyarítás 1.0
RestartIfNeededByRun=false
PrivilegesRequired=admin
SetupIconFile=F:\Copy\Copy\MAGYARITASOK\PROGRESS\Far Cry 3\installer\fc3_ikon.ico
WizardImageFile="F:\Copy\Copy\MAGYARITASOK\PROGRESS\Far Cry 3\installer\installer.bmp"
WizardSmallImageFile="F:\Copy\Copy\MAGYARITASOK\PROGRESS\Far Cry 3\installer\fc3_ikon.bmp"
DefaultDirName={reg:HKLM\Software\Wow6432Node\Ubisoft\Far Cry 3,InstallDir|{pf}\Far Cry 3}
AppendDefaultDirName=false
OutputDir=C:\Users\lostprophet\Desktop
OutputBaseFilename=farcry3hun_1.0
Compression=lzma/Ultra64
InternalCompressLevel=Ultra64
LanguageDetectionMethod=none
UsePreviousGroup=false
AppendDefaultGroupName=false
UninstallDisplayName=Far Cry 3 magyarítás
AppVersion=1.0
UninstallFilesDir=interface
AppPublisherURL=http://lostprophet.ekapocs.com
VersionInfoVersion=1.0
VersionInfoCompany=lostprophet
VersionInfoCopyright=lostprophet
VersionInfoProductName=Far Cry 3 magyarítás
LicenseFile=F:\Copy\Copy\MAGYARITASOK\PROGRESS\Far Cry 3\installer\information.rtf
InfoBeforeFile=F:\Copy\Copy\MAGYARITASOK\PROGRESS\Far Cry 3\installer\information2.rtf
ShowLanguageDialog=auto
[Languages]
Name: "hu"; MessagesFile: "compiler:Languages\Hungarian.isl"
[Files]
Source: "common_patch.xdelta"; DestDir: {app};
Source: "commonfat_patch.xdelta"; DestDir: {app};
Source: "xdelta3.exe"; DestDir: {app};
Source: "Splash.png"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
[Code]
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
procedure InitializeWizard();
begin
ExtractTemporaryFile('Splash.png');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}\Splash.png'),1000,3000,1000,0,255,True,$FFFFFF,10);
end;
const
MySecretDir = '{app}';
procedure OnDirEditChange(Sender: TObject);
begin
if FileExists(AddBackslash(WizardDirValue) + 'data_win32/patch.dat') then
WizardForm.NextButton.Enabled := True
else
WizardForm.NextButton.Enabled := False;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectDir then
begin
MsgBox('Válaszd ki a Far Cry 3 telepítési könyvtárát, ha a telepítő önmagától nem találná meg!', mbInformation, MB_OK);
WizardForm.DirEdit.OnChange := @OnDirEditChange;
OnDirEditChange(nil);
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: integer;
ErrorCode: integer;
begin
if CurStep = ssInstall then
begin
FileCopy(ExpandConstant('{app}\data_win32\common.dat'),ExpandConstant('{app}'),true);
FileCopy(ExpandConstant('{app}\data_win32\common.fat'),ExpandConstant('{app}'),true);
Exec(ExpandConstant('{app}\xdelta3.exe'), '-d -s common.dat common_patch.xdelta common2.dat', '',SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{app}\xdelta3.exe'), '-d -s common.fat commonfat_patch.xdelta common2.fat', '',SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
OldFile3: string;
OldFile4: string;
begin
if CurUninstallStep = usPostUninstall then
begin
OldFile3 := ExpandConstant('{app}\data_win32\common_orig.dat');
OldFile4 := ExpandConstant('{app}\data_win32\common_orig.fat');
if FileExists(OldFile3) and FileExists(OldFile4) then
begin
RenameFile(OldFile3, ExpandConstant('{app}\data_win32\common.dat'));
RenameFile(OldFile4, ExpandConstant('{app}\data_win32\common.fat'));
end;
end;
end;