Пользователь
Сообщения: 53
Благодарности: 0
|
Профиль
|
Сайт
|
Отправить PM
| Цитировать
я и разобрался, много чего сделал. исправил. но все же не хочет этот момент сделать.
читать дальше »
Код:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Synergy Center"
#ifndef MyAppVer
#define MyAppVer "2.4"
#endif
#ifndef MyAppPatch
#define MyAppPatch "11"
#endif
#ifndef MyAppBuild
#define MyAppBuild "0"
#endif
#define MyAppPublisher "??? ???????? ??????? ?????????? ?????"
#define MyAppURL "http://www.ivt.su/"
#define InstalledLocalURL "http://localhost"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{903E5749-D9EC-45A3-A5E1-B0621695F680}
AppName={#MyAppName}
AppVerName={#MyAppName} {#MyAppVer}.{#MyAppPatch}
VersionInfoVersion={#MyAppVer}.{#MyAppPatch}.{#MyAppBuild}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=D:\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir={#MyOutputDir}
UpdateUninstallLogAppName=no
UsePreviousAppDir=yes
CreateUninstallRegKey=no
;DisableDirPage=yes
OutputBaseFilename=Synergy Center0 {#MyAppVer}.{#MyAppPatch}
Compression=lzma
SolidCompression=yes
WizardImageFile=wizard\WizModernImage-IS.bmp
WizardSmallImageFile=wizard\WizModernSmallImage-IS.bmp
[Languages]
Name: ru; MessagesFile: i18n\Russian.isl,i18n\sc_russian.isl; LicenseFile: dontcopy\license_ru.rtf
Name: ua; MessagesFile: i18n\Ukrainian-6-5.1.11.isl,i18n\sc_ukrainian.isl; LicenseFile: dontcopy\license_ua.rtf
[Registry]
Root: HKLM; Subkey: Software\IVTBelGU\Synergy Center; ValueType: string; ValueName: Version; ValueData: {#MyAppVer}.{#MyAppPatch}; Check: Run_B; Flags: uninsdeletekey
[Dirs]
Name: {app}\apache-tomcat; Flags: uninsneveruninstall; Check: Run_B; Languages:
Name: {app}\files; Flags: uninsneveruninstall; Check: Run_B; Languages:
Name: {app}\nginx; Flags: uninsneveruninstall; Check: Run_B; Languages:
Name: {app}\dbinit; Flags: uninsneveruninstall; Check: Run_B; Languages:
Name: {app}\backups; Flags: uninsneveruninstall; Check: Run_B; Languages:
Name: {app}\db_update; Flags: uninsneveruninstall; Check: Run_A; Languages:
Name: {app}\backups; Flags: uninsneveruninstall; Check: Run_A; Languages:
[InstallDelete]
Name: {app}\apache-tomcat\bin\service.bat; Type: filesandordirs; Check: Run_A; BeforeInstall: StopTomcat
Name: {app}\apache-tomcat\work\*; Type: filesandordirs; Check: Run_A; BeforeInstall: StopTomcat
Name: {app}\apache-tomcat\webapps\ROOT\WEB-INF\classes\su\*; Type: filesandordirs; Check: Run_A; BeforeInstall: StopTomcat
Name: {app}\apache-tomcat\webapps\ROOT\WEB-INF\classes\i18n\*; Type: filesandordirs; Check: Run_A; BeforeInstall: StopTomcat
Name: {app}\apache-tomcat\webapps\ROOT\WEB-INF\lib\*; Type: filesandordirs; Check: Run_A; BeforeInstall: StopTomcat
[Files]
Source: apache-tomcat\*; DestDir: {app}\apache-tomcat; Check: Run_B; Flags: ignoreversion recursesubdirs createallsubdirs
Source: apache-tomcat\msvcr71.dll; DestDir: {sys}\; Check: Run_B; Flags: onlyifdoesntexist
Source: {#MyWebContentPath}\*; DestDir: {app}\apache-tomcat\webapps\ROOT; Check: Run_B; Flags: ignoreversion recursesubdirs createallsubdirs
Source: download\*; DestDir: {app}\apache-tomcat\webapps\ROOT\public\download\; Check: Run_B; Flags: ignoreversion recursesubdirs createallsubdirs
Source: configs\WEB-INF\settings.properties; DestDir: {app}\apache-tomcat\webapps\ROOT\WEB-INF\; Check: Run_B; Flags: ignoreversion; AfterInstall: ReplacePathInConfigs
Source: configs\WEB-INF\classes\log4j.xml; DestDir: {app}\apache-tomcat\webapps\ROOT\WEB-INF\classes\; Check: Run_B; Flags: ignoreversion; AfterInstall: ReplacePathInConfigs
Source: configs\nginx_to_autorun.reg; DestDir: {app}\nginx\; Check: Run_B; Flags: ignoreversion; AfterInstall: ReplacePathInConfigsReg
Source: nginx\add_reg.bat; DestDir: {app}\nginx\; Check: Run_B; Flags: ignoreversion; AfterInstall: ReplacePathInConfigsReg
Source: nginx\*; DestDir: {app}\nginx; Check: Run_B; Flags: ignoreversion recursesubdirs createallsubdirs
Source: dbinit\*; DestDir: {app}\dbinit; Check: Run_B; Flags: ignoreversion recursesubdirs; AfterInstall: ReplacePathInConfigsPass
Source: UserMenu\*; DestDir: {app}; Check: Run_B; Flags: ignoreversion recursesubdirs; Languages: ; AfterInstall: ReplacePathInConfigs
Source: {#MySetupDbPath}\db\*.sql; DestDir: {app}\dbinit; Check: Run_B; Flags: ignoreversion
Source: {app}\apache-tomcat\webapps\ROOT\*; DestDir: {app}\backups\Webcontent-before-{#MyAppVer}.{#MyAppPatch}-{code:GetTodaysName}; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs external uninsneveruninstall; Components: backup_app
Source: {#MyWebContentPath}\*; DestDir: {app}\apache-tomcat\webapps\ROOT; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs; BeforeInstall: StopTomcat
Source: download\*; DestDir: {app}\apache-tomcat\webapps\ROOT\public\download\; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs; BeforeInstall: AddDefaultToConfig
Source: apache-tomcat\bin\service.bat; DestDir: {app}\apache-tomcat\bin\; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs; BeforeInstall: AddDefaultToConfig
Source: configs\WEB-INF\settings.properties; Check: Run_A; Flags: dontcopy
;Source: configs\WEB-INF\classes\log4j.xml; DestDir: {app}\apache-tomcat\webapps\ROOT\WEB-INF\classes\; Flags: ignoreversion; AfterInstall: ReplacePathInConfigs
Source: db_update\*; DestDir: {app}\db_update; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs; Languages:
;Source: D:\work\_Stable\setup\db\update\{#MyAppVer}\*.sql; DestDir: {app}\db_update\sql_scripts; Flags: ignoreversion
Source: {#MySetupDbPath}\db\*.sql; DestDir: {app}\db_update\sql_scripts; Check: Run_A; Flags: ignoreversion recursesubdirs createallsubdirs
Source: dontcopy\netstat1.bat; Flags: dontcopy
Source: dontcopy\check.bat; Check: Run_A; Flags: dontcopy
Source: dontcopy\check.bat; Check: Run_B; Flags: dontcopy
[Icons]
Name: {group}\{#MyAppName}; Check: Run_B; Filename: {#InstalledLocalURL}
;Name: {group}\Start Tomcat; Filename: {app}\TomcatServiceStart.exe; WorkingDir: {app}\; Comment: {cm:RunTomcat}; Flags: runminimized; Components:
;Name: {group}\Stop Tomcat; Filename: {app}\TomcatServiceStop.exe; WorkingDir: {app}\; Comment: {cm:StopTomcat}; Flags: runminimized
Name: {group}\{cm:AdminManual}; Filename: {app}\apache-tomcat\webapps\ROOT\public\download\User_Manual\Manual_PDF\admin_manual.pdf; Check: Run_B; Languages: ru
Name: {group}\{cm:UserManual}; Filename: {app}\apache-tomcat\webapps\ROOT\public\download\User_Manual\Manual_PDF\user_manual.pdf; Check: Run_B; Languages: ru
Name: {group}\{cm:AdminManual}; Filename: {app}\apache-tomcat\webapps\ROOT\public\download\User_Manual\ua\manual_admin.pdf; Check: Run_B; Languages: ua
Name: {group}\{cm:UserManual}; Filename: {app}\apache-tomcat\webapps\ROOT\public\download\User_Manual\ua\manual_user.pdf; Check: Run_B; Languages: ua
Name: {group}\{cm:Rukovodstvo_administratora}; Check: Run_B; Filename: {app}\apache-tomcat\webapps\ROOT\public\download\User_Manual\Manual_PDF\Rukovodstvo_administratora.pdf
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Check: Run_B; Filename: {uninstallexe}
[Run]
Filename: {app}\apache-tomcat\bin\service.bat; Parameters: " install"; WorkingDir: {app}\apache-tomcat\bin\; Flags: runhidden; Check: Run_B; StatusMsg: Installing Apache Tomcat as Service
Filename: NET; Parameters: "START ""Apache Tomcat"""; Flags: runhidden; Components: PostgreSQL; Check: Run_B; StatusMsg: {cm:StartingTomcat}
Filename: {app}\dbinit\createAndInitDb.bat; Parameters: """{code:GetPsqlPath}"" {language}"; WorkingDir: {app}\dbinit\; Flags: shellexec runhidden waituntilterminated; Check: Run_B; Components: PostgreSQL; StatusMsg: {cm:CreatingDatabase}
Filename: {app}\nginx\add_reg.bat; Check: Run_B; Flags: shellexec runhidden
Filename: {app}\start_nginx.bat; Check: Run_B; Flags: shellexec runhidden
Filename: {app}\dbinit\installAdditionalCards.bat; Parameters: """{code:GetPsqlPath}"" {language}"; WorkingDir: {app}\dbinit\; Check: Run_B; Flags: shellexec runhidden waituntilterminated; Components: PostgreSQL; StatusMsg: {cm:CreatingDatabase}; Tasks: IntstallDefaultShemes
Filename: {app}\Synergy Center.url; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent shellexec; Check: Run_B; Components: PostgreSQL
;Filename: {app}\postgresql\bin\pg_dump.exe; Parameters: "-h localhost -p 5432 -U postgres -F c -b -v -f ""{app}\backups\db-before-{#MyAppVer}.{#MyAppPatch}-{code:GetTodaysName}.backup"" sc"; Flags: waituntilterminated; StatusMsg: ????? ??????? ??; Components: backup_db
Filename: {app}\apache-tomcat\bin\service.bat; Parameters: " remove"; WorkingDir: {app}\apache-tomcat\bin\; Check: Run_A; Flags: runhidden
Filename: {app}\apache-tomcat\bin\service.bat; Parameters: " install"; WorkingDir: {app}\apache-tomcat\bin\; Check: Run_A; Flags: runhidden
Filename: {app}\db_update\make_db_backup.bat; WorkingDir: {app}\; Flags: shellexec waituntilterminated; StatusMsg: StatusMsg: {cm:BackupingCurrentDB}; Check: Run_A; Components: backup_db
;Filename: NET; Parameters: "STOP ""Apache Tomcat"""; Flags: runhidden; StatusMsg: {cm:StoppingTomcat}
Filename: {app}\db_update\run_db_update.bat; WorkingDir: {app}\db_update\; Flags: shellexec waituntilterminated; Check: Run_A; StatusMsg: {cm:UpdatingDatabase}
;Filename: java; Parameters: " -jar --patches_path=""./sql_scripts/"" --log=""./sql_scripts/sql_scripts_log.log"" --sc_properites_path=""{app}/apache-tomcat/webapps/ROOT/WEB-INF/settings.properties"" "; WorkingDir: {app}\db_update\; Flags: shellexec waituntilterminated; StatusMsg: {cm:UpdatingDatabase}
;Filename: rmdir; Parameters: "/S /Q ""{app}\apache-tomcat\work\Catalina\"""; Flags: shellexec runhidden; StatusMsg: {cm:StartingTomcat}
Filename: NET; Parameters: "START ""Apache Tomcat"""; Flags: runhidden; Check: Run_A; StatusMsg: {cm:StartingTomcat}
[Components]
Name: Tomcat; Description: {cm:ApacheTomcatComponent}; Flags: fixed; Types: custom compact full; Check: Skips
Name: PostgreSQL; Description: {cm:PostgresComponent}; Types: custom full; Flags: checkablealone; ExtraDiskSpaceRequired: 16080384; Check: Skips; Languages:
Name: backup_db; Description: {cm:MakeDBBackupComponent}; Flags: checkablealone; Types: custom full; Languages: ; ExtraDiskSpaceRequired: 5000000; Check: Skip
Name: backup_app; Description: {cm:MakeApplicationBackupComponent}; Flags: checkablealone; Types: custom full; ExtraDiskSpaceRequired: 50000000; Check: Skip
[Tasks]
Name: IntstallDefaultShemes; Description: {cm:IntstallDefaultShemes}; Flags: checkablealone; Components: Postgresql; Languages:
[ Code]
var
CheckBoxA: TNewCheckBox;
CheckBoxB: TNewCheckBox;
PasswordPage: TInputQueryWizardPage;
DataDirPage: TInputDirWizardPage;
UserVarPass: String;
PathToPsql: String;
CheckLicense: TNewCheckBox;
procedure RePlaceTextinFile(FilePath:string; find:string; replace:string);
var
S: TArrayOfString;
i : Integer;
begin
if not FileExists(FilePath) then begin MsgBox('Oaee ia iaeaai ' + FilePath, mbError, mb_Ok); Exit;end; // anee oaeea iao, auoiaei
LoadStringsFromFile(FilePath, S);
for i:= 0 to GetArrayLength(S)-1 do begin
if (Pos(AnsiUpperCase(find), AnsiUpperCase(S[i])) > 0) then begin
StringChangeEx(S[i], find, replace, True);
end;
end;
SaveStringsToFile(FilePath, S, False); // nio?aiyai oaee
end;
procedure ReplacePathInConfigsReg();
var filecontent: String;
var pathForConfig: String;
var langForConfig: String;
begin
LoadStringFromFile(ExpandConstant(CurrentFileName), filecontent);
langForConfig:=ExpandConstant('{language}');
pathForConfig:=ExpandConstant('{app}');
StringChange(pathForConfig,'\','\\');
StringChange(filecontent,'{INSTALL_PATH}',pathForConfig);
StringChange(filecontent,'{LANGUAGE}',langForConfig);
SaveStringToFile(ExpandConstant(CurrentFileName), filecontent, false);
end;
function CheckPortUsing(Port: String; fileStrings: TArrayOfString): Boolean;
var i: Integer;
begin
for i:=0 to GetArrayLength(fileStrings)-1 do
begin
if ((Pos(':'+Port+' ',fileStrings[i])>0) and (Pos('LISTENING',fileStrings[i]) >0)) then
begin
Result := true;
exit;
end;
end;
Result := false;
end;
procedure LicenseOnClick(Sender: TObject);
begin
WizardForm.NextButton.Enabled := false;
if (CheckLicense.Checked) = True then
begin
WizardForm.LicenseAcceptedRadio.Checked := True;
WizardForm.NextButton.Enabled := True;
end else
begin
WizardForm.LicenseNotAcceptedRadio.Checked := True;
WizardForm.NextButton.Enabled := False;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
case PageID of
wpLicense: Result := True;
end;
end;
function GetBuildNumber(param: String): String;
var
BuildVersion: String;
begin
LoadStringFromFile(ExpandConstant('buildNumber.txt'), BuildVersion);
Result := BuildVersion;
end;
function GetPsqlPath(Param: String): String;
begin
Result := PathToPsql + '\psql.exe';
end;
procedure ReplacePathInConfigs();
var filecontent: String;
var pathForConfig: String;
var langForConfig: String;
begin
LoadStringFromFile(ExpandConstant(CurrentFileName), filecontent);
langForConfig:=ExpandConstant('{language}');
pathForConfig:=ExpandConstant('{app}');
StringChange(pathForConfig,'\','/');
StringChange(filecontent,'{INSTALL_PATH}',pathForConfig);
StringChange(filecontent,'{LANGUAGE}',langForConfig);
SaveStringToFile(ExpandConstant(CurrentFileName), filecontent, false);
end;
procedure ReplacePathInConfigsPass();
var filecontent: String;
begin
LoadStringFromFile(ExpandConstant(CurrentFileName), filecontent);
StringChange(filecontent,'{PG_PASS}',UserVarPass);
SaveStringToFile(ExpandConstant(CurrentFileName), filecontent, false);
end;
procedure StopTomcat();
var
ErrorCode: Integer;
begin
if not Exec('NET',' STOP "Apache Tomcat"', '' ,SW_HIDE, ewWaitUntilTerminated, ErrorCode) then
begin
MsgBox('Fail to stop tomcat', mbInformation, mb_Ok);
end;
end;
function CheckDBUpdateIsOk(): Boolean;
var filecontent: String;
var pathToLog: String;
begin
Result:= false;
pathToLog:=ExpandConstant('{app}')+'\db_update\db_update_log.log';
LoadStringFromFile(pathToLog, filecontent);
if (Pos('Update succesfully',filecontent)>0) then
begin
Result:= true;
end
end;
procedure CurPageChanged(CurPageID: Integer);
var ResultCode: Integer;
Begin
if CurPageID=wpWelcome then
begin
WizardForm.NextButton.Enabled := False;
end;
end;
procedure AddDefaultToConfig();
var filecontent_default: String;
var configStrings,defaultStrings: TArrayOfString;
var pathToConfig,pathToDefaultConfig,appPath: String;
var langForConfig,currentKey: String;
var currentPos,i,j: Integer;
var containKey: Boolean;
begin
ExtractTemporaryFile('settings.properties');
pathToConfig:=ExpandConstant('{app}')+'\apache-tomcat\webapps\ROOT\WEB-INF\settings.properties';
pathToDefaultConfig:=ExpandConstant('{tmp}\settings.properties');
appPath:=ExpandConstant('{app}');
langForConfig:=ExpandConstant('{language}');
LoadStringFromFile(pathToDefaultConfig, filecontent_default);
StringChange(appPath,'\','/');
StringChange(filecontent_default,'{INSTALL_PATH}',appPath);
StringChange(filecontent_default,'{LANGUAGE}',langForConfig);
SaveStringToFile(pathToDefaultConfig, filecontent_default, false);
LoadStringsFromFile(pathToDefaultConfig, defaultStrings);
LoadStringsFromFile(pathToConfig, configStrings);
for i:=0 to GetArrayLength(defaultStrings)-1 do
begin
currentPos:=Pos('=',defaultStrings[i]);
if ((currentPos>0)) then
begin
currentKey:=Trim(Copy(defaultStrings[i], 0, currentPos-1));
containKey:=false;
for j:=0 to GetArrayLength(configStrings)-1 do
begin
if ((Pos(currentKey,configStrings[j])>0)) then
begin
containKey:=true;
end;
end;
if (containKey=false) then
begin
SetArrayLength(configStrings, GetArrayLength(configStrings)+1);
configStrings[GetArrayLength(configStrings)-1]:=defaultStrings[i];
end
end;
end;
SaveStringsToFile(pathToConfig, configStrings, false);
end;
var
TodaysName : String;
function GetToday : String;
begin
Result := GetDateTimeString ('yyyy.mm.dd hh.nn.ss', '-', #0);
end;
function GetTodaysName (Param: String): String;
begin
if ('' = TodaysName) then
begin
TodaysName := GetToday ();
end;
Result := TodaysName;
end;
function Run_A: Boolean; begin Result:=CheckBoxA.Checked; end;
function Run_B: Boolean; begin Result:=CheckBoxB.Checked; end;
Function InitializeSetup: Boolean;
var ResultCode: Integer;
var fileStrings: TArrayOfString;
var pathToOutput: String;
var outputFile: String;
var
ReturnCode: Integer;
begin
if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Corssys\Synergy Center') or
RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\IVTBelGU\Synergy Center')
then
begin
if MsgBox('Сообщение' + #10#13 +
'Установить обновление Synergy Center?', mbError, MB_YESNO) = idYes
then
begin
MsgBox(ExpandConstant('Сейчас будет устанавливаться обновление Synergy Center'), mbInformation, mb_Ok);
Result := true;
end
else
begin
MsgBox(ExpandConstant('Сообщение' #13#10 'Не возможно установить Synergy Center, удалите предыдушую верисю и повторите попытку'), mbInformation, mb_Ok);
Result := false;
exit;
end;
end
else
Begin
MsgBox(ExpandConstant('Сейчас будет устанавливаться Synergy Center'), mbInformation, mb_Ok);
If (ExpandConstant('{reg:HKLM\Software\JavaSoft\Java Runtime Environment,CurrentVersion}') = '1.6')
then
Result:= True
else MsgBox(ExpandConstant('{cm:SetupJRE}'), mbInformation, mb_Ok);
outputFile:=ExpandConstant('{tmp}\netstatoutput.log');
pathToOutput:=ExpandConstant('{tmp}\');
ExtractTemporaryFile('netstat1.bat');
if Exec(ExpandConstant('{tmp}\netstat1.bat'), 'netstatoutput.log', pathToOutput, SW_HIDE, ewWaitUntilTerminated, ResultCode)
then
begin
//MsgBox(outputFile, mbInformation, mb_Ok);
// handle success if necessary; ResultCode contains the exit code
LoadStringsFromFile(outputFile, fileStrings);
DeleteFile(outputFile);
DeleteFile(ExpandConstant('{tmp}\netstat1.bat'));
If (CheckPortUsing('80',fileStrings) and (Result=true)) then
begin
Result := MsgBox(ExpandConstant('{cm:Port80InUse}'), mbConfirmation, MB_YESNO) = idYes;
end
end
else
begin
MsgBox('Error ', mbInformation, mb_Ok);
end
Result := true;
end
End;
procedure InitializeWizard;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.LicenseNotAcceptedRadio.Hide;
WizardForm.LicenseAcceptedRadio.Hide;
{ CheckLicense }
CheckLicense := TNewCheckBox.Create(WizardForm);
with CheckLicense do
begin
Name := 'CheckLicense';
Parent := WizardForm.WelcomePage;
Left := ScaleX(176);
Top := ScaleY(288);
Width := ScaleX(200);
Height := ScaleY(17);
OnClick := @LicenseOnClick;
CheckLicense.Caption := WizardForm.LicenseAcceptedRadio.Caption;
end;
with WizardForm.LicenseMemo do
begin
Left := ScaleX(164);
Top := ScaleY(0);
Width := ScaleX(333);
Height := ScaleY(284);
Parent := WizardForm.WelcomePage;
end;
CheckLicense.Checked := false;
DataDirPage := CreateInputDirPage(wpSelectDir, ExpandConstant('{cm:DirSelectCaption}'), ExpandConstant('{cm:DirSelectDescription}'), ExpandConstant('{cm:DirSelectSubCaption}'), False, '' );
DataDirPage.Add('');
DataDirPage.Values[0] := GetPreviousData('DataDir', 'C:\Program Files\PostgreSQL\9.0\bin');
PasswordPage := CreateInputQueryPage(DataDirPage.ID, ExpandConstant('{cm:PasswordInputCaption}') ,ExpandConstant('{cm:PasswordInputDescription}'), ExpandConstant('{cm:PasswordInputSubCapton}') );
PasswordPage.Add(SetupMessage(msgPasswordEditLabel), True);
{ CheckBoxA }
CheckBoxA := TNewCheckBox.Create(WizardForm);
with CheckBoxA do
begin
Name := 'CheckBoxA';
Parent := WizardForm.WelcomePage;
Left := ScaleX(216);
Top := ScaleY(176);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := '??????? 1';
end;
{ CheckBoxB }
CheckBoxB := TNewCheckBox.Create(WizardForm);
with CheckBoxB do
begin
Name := 'CheckBoxB';
Parent := WizardForm.WelcomePage;
Left := ScaleX(216);
Top := ScaleY(208);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := '??????? 2';
end;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Corssys\Synergy Center') or
RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\IVTBelGU\Synergy Center')
then
begin
CheckBoxA.Enabled:=true;
CheckBoxA.Checked:=true;
CheckBoxB.Enabled:=false;
CheckBoxB.Checked:=false;
end
else
begin
CheckBoxA.Enabled:=false;
CheckBoxA.Checked:=false;
CheckBoxB.Enabled:=true;
CheckBoxB.Checked:=true;
end;
CheckBoxA.visible:=false;
CheckBoxB.visible:=false;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var filecontent: String;
ReturnCode: Integer;
begin
begin
if CheckBoxA.Checked = true then
begin
If CurPageID = wpSelectDir then
begin
If (FileSearch('settings.properties', ExpandConstant('{app}')+'\apache-tomcat\webapps\ROOT\WEB-INF')='') then
begin
MsgBox(ExpandConstant('{cm:ErrorSCNotFound}'), mbCriticalError, mb_Ok);
Result:=False;
end
end
Result := True;
if CurPageID = DataDirPage.ID then begin
if FileExists ( DataDirPage.Edits[0].Text + '\psql.exe' ) then
begin
Result := True;
PathToPsql := DataDirPage.Edits[0].Text;
DeleteFile(ExpandConstant('{app}\text.txt'))
SaveStringToFile(ExpandConstant('{app}\text.txt'), DataDirPage.Edits[0].Text, True)
end
else
begin
MsgBox(ExpandConstant('{cm:msgNotFoundPsql}'), mbError, MB_OK);
Result := False;
end;
end
if CurPageID = PasswordPage.ID then begin
UserVarPass := PasswordPage.Edits[0].Text;
ExtractTemporaryFile('check.bat');
Exec (ExpandConstant ( '{tmp}\check.bat' ), PasswordPage.Edits[0].Text + ' "' + PathToPsql + '"' , ExpandConstant ( '{tmp}' ), SW_HIDE, ewWaitUntilTerminated, ReturnCode );
if ReturnCode = 0 then
begin
Result := True;
end
else
begin
MsgBox(ExpandConstant('{cm:msgIncorrectPassword}'), mbError, MB_OK);
Result := False;
end;
DeleteFile ( ExpandConstant ('{tmp}\check.bat') );
end;
end
end
if CheckBoxB.Checked = true then
begin
Result := True;
if CurPageID = DataDirPage.ID then begin
if FileExists ( DataDirPage.Edits[0].Text + '\psql.exe' ) then
begin
Result := True;
PathToPsql := DataDirPage.Edits[0].Text;
DeleteFile(ExpandConstant('{app}\text.txt'))
SaveStringToFile(ExpandConstant('{app}\text.txt'), DataDirPage.Edits[0].Text, True)
end
else
begin
MsgBox(ExpandConstant('{cm:msgNotFoundPsql}'), mbError, MB_OK);
Result := False;
end;
end;
begin
if CurPageID = PasswordPage.ID then begin
UserVarPass := PasswordPage.Edits[0].Text;
ExtractTemporaryFile('check.bat');
Exec (ExpandConstant ( '{tmp}\check.bat' ), PasswordPage.Edits[0].Text + ' "' + PathToPsql + '"' , ExpandConstant ( '{tmp}' ), SW_HIDE, ewWaitUntilTerminated, ReturnCode );
if ReturnCode = 0 then
begin
Result := True;
end
else
begin
MsgBox(ExpandConstant('{cm:msgIncorrectPassword}'), mbError, MB_OK);
Result := False;
end;
DeleteFile ( ExpandConstant ('{tmp}\check.bat') );
end;
end;
end;
end;
function Skip:boolean;
var
sz:Integer;
s:string;
begin
Result:=True;
begin
If not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Corssys\Synergy Center') or
RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\IVTBelGU\Synergy Center') then
Result:=False
end;
end;
function Skips:boolean;
var
sz:Integer;
s:string;
begin
Result:=True;
begin
If RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Corssys\Synergy Center') or
RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\IVTBelGU\Synergy Center') then
Result:=False
end;
end;
|