1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
//Global
var
PageConfigurationService: TInputQueryWizardPage;
//PageConfigurationService: TWizardPage;
PageRepoProjects: TInputQueryWizardPage;
InformationsMsgPage: TOutputMsgWizardPage;
CheckListBox: TNewCheckListBox;
EditSHM, EditUDL: TNewEdit;
TextSHM, TextUDL : TNewStaticText;
FlagConfiguration : Integer;
StringValuePage : String;
//Initialize the Setup
function InitializeSetup(): Boolean;
//On regarde si une version n'est pas déjà installé sur la machine au quel cas on demande à l'utilisateur de désinstaller la version déjà installé
var
ResultCode: Integer;
ResultStr:string;
begin
Result:=True;
begin
If RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}_is1', 'UninstallString', ResultStr) then
begin
If ResultStr<>'' then
begin
ResultStr:=RemoveQuotes(ResultStr);
if MsgBox('L''installation a détecté que ce programme est déjà installé. ' #13#13 'Souhaitez-vous désinstaller la version existante avant de poursuivre ?', mbConfirmation, MB_YESNO) = idYes then
if not Exec(ResultStr, '/silent', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
MsgBox('Erreur !!! ' #13#13 '' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
end;
end;
end;
end;
//On regarde si le Framework 4 n'est pas déjà installé sur la machine avant de l'installer
function FrameworkIsNotInstalled: Boolean;
begin
Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
end;
//On regarde si le Package C++ Redistribuable 2008 x64 n'est pas déjà installé
function Packagex64IsNotInstalled: Boolean;
begin
Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
end;
//Event Click to choice configuration
procedure ClickEvent(Sender : TObject);
var
Msg : String;
I : Integer;
ListBox: TNewCheckListBox;
begin
//ListBox := TNewCheckListBox(Sender);
//MsgBox('', mbInformation,MB_OK);
if CheckListBox.State[2] = cbChecked then
begin
EditSHM.Enabled := False;
EditUDL.Enabled := False;
//MsgBox('Ancienne', mbInformation,MB_OK);
end
if CheckListBox.State[1] = cbChecked then
begin
EditSHM.Enabled := True;
EditUDL.Enabled := True;
//MsgBox('Nouvelle', mbInformation,MB_OK);
end
end;
procedure ConvertConfig(xmlFileName: String);
var
xmlFile: String;
xmlInhalt: TArrayOfString;
strName: String;
strTest: String;
tmpConfigFile: String;
k: Integer;
begin
xmlFile := ExpandConstant('{app}') + '\Serveur Licence\YrisSvcApp.exe.config';
tmpConfigFile:= ExpandConstant('{app}') + '\config.tmp';
strName := ExpandConstant('{app}') + '\Serveur Licence\Yris.ServeurLicence.exe';
if (FileExists(xmlFile)) then begin
//alles in string array speichern
LoadStringsFromFile(xmlFile, xmlInhalt);
//durch Array iterieren
for k:=0 to GetArrayLength(xmlInhalt)-1 do
begin
strTest := xmlInhalt[k];
if (Pos('key="1"', strTest) <> 0 ) then
begin
strTest := ' <add key="1" value="' + strName + '"/> ';
end;
SaveStringToFile(tmpConfigFile, strTest + #13#10, True);
end;
DeleteFile(xmlFile); //delete the old exe.config
RenameFile(tmpConfigFile,xmlFile);
end;
end;
//Interface de Configuration pour le fichier SHM
Procedure CreateTheWizardPages;
var
PageConfigurationService: TWizardPage;
begin
//Create Page to select Repo for Projects
PageRepoProjects := CreateInputQueryPage(wpSelectComponents, 'Répertoire Projets', 'Choix du répertoire des projets', '');
//Create TextBox
PageRepoProjects.Add('Répertoire Projets :', False);
PageRepoProjects.Values[0] := '{#SetupSetting("DefaultDirName")}\Projets';
//Configuration Page to show title and description
//PageConfigurationService := CreateInputQueryPage(wpSelectComponents, CustomMessage('TypeSHMConfigurationTitleDesc'), CustomMessage('TypeSHMConfigurationInstructionDesc'), '');
PageConfigurationService := CreateCustomPage(wpSelectComponents, CustomMessage('TypeSHMConfigurationTitleDesc'), CustomMessage('TypeSHMConfigurationInstructionDesc'));
//Create Configuration Choice
CheckListBox := TNewCheckListBox.Create(PageConfigurationService);
CheckListBox.Width := PageConfigurationService.SurfaceWidth;
CheckListBox.Height := ScaleY(97);
CheckListBox.BorderStyle := bsNone;
CheckListBox.ParentColor := True;
CheckListBox.MinItemHeight := WizardForm.TasksList.MinItemHeight;
CheckListBox.ShowLines := False;
CheckListBox.WantTabs := True;
CheckListBox.Parent := PageConfigurationService.Surface;
CheckListBox.AddGroup('Choix Configuration', '', 0, nil);
CheckListBox.AddRadioButton('Ancienne Configuration', '', 0, True, True, nil);
CheckListBox.AddRadioButton('Nouvelle Configuration', '', 0, False, True, nil);
CheckListBox.OnClick := @ClickEvent;
//Create Label SHM Configuration
TextSHM := TNewStaticText.Create(PageConfigurationService);
TextSHM.Top := CheckListBox.Top + CheckListBox.Height + ScaleY(8);
TextSHM.Caption := 'Adresse IP du serveur de Licence :';
TextSHM.AutoSize := True;
TextSHM.Parent := PageConfigurationService.Surface;
//Create Label UDL Configuration
TextUDL := TNewStaticText.Create(PageConfigurationService);
TextUDL.Top := TextSHM.Top + TextSHM.Height + ScaleY(12);
TextUDL.Caption := 'Adresse IP du serveur UDL :';
TextUDL.AutoSize := True;
TextUDL.Parent := PageConfigurationService.Surface;
//Create TextBox SHM Config
EditSHM := TNewEdit.Create(PageConfigurationService);
EditSHM.Top := CheckListBox.Top + CheckListBox.Height + ScaleY(8);
EditSHM.Left := ScaleX(180);
EditSHM.Width := PageConfigurationService.SurfaceWidth div 2 - ScaleX(8);
EditSHM.Text := 'localhost';
EditSHM.Parent := PageConfigurationService.Surface;
EditSHM.Enabled := False;
//Create TextBox UDL Config
EditUDL := TNewEdit.Create(PageConfigurationService);
EditUDL.Top := TextSHM.Top + TextSHM.Height + ScaleY(12);
EditUDL.Left := ScaleX(180);
EditUDL.Width := PageConfigurationService.SurfaceWidth div 2 - ScaleX(8);
EditUDL.Text := 'localhost';
EditUDL.Parent := PageConfigurationService.Surface;
EditUDL.Enabled := False;
//Create TextBox
//PageConfigurationService.Add(CustomMessage('TypeSHMLabel'), False);
//PageConfigurationService.Values[0] := 'localhost';
//PageConfigurationService.Add(CustomMessage('TypeUDLLabel'), False);
//PageConfigurationService.Values[1] := 'localhost';
InformationsMsgPage := CreateOutputMsgPage(wpWelcome,
'Informations Complémentaires', 'Liste des composants qui seront installés automatiquement',
'- Microsoft .NET Framework 4.0' #13#13 +
'- Package redistribuable Microsoft Visual C++ 2010 (x86)' #13#13 +
'- Package redistribuable Microsoft Visual C++ 2010 (x64)' #13#13 +
'Cliquez sur Suivant pour continuer l''installation ou sur Annuler pour sortir de l''installation.');
end;
// Initialisation
procedure InitializeWizard();
begin
CreateTheWizardPages;
end;
//Get Udl Service Name Value
function GetAdressIpSHM(Param: String): String;
begin
Result := PageConfigurationService.Values[0];
end;
function GetAdressIpUDL(Param: String): String;
begin
Result := PageConfigurationService.Values[1];
end;
//Get Projects Directory
function GetProjectsDirectory(Param: String): String;
begin
Result := PageRepoProjects.Values[0];
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := ((PageFromID(PageID) = PageRepoProjects) and not IsComponentSelected('projet')) or
((PageFromID(PageID) = PageConfigurationService) and not IsComponentSelected('gilif'));
end; |
Partager