source: AE/Setup/Windows/AEI.iss@ 896

Last change on this file since 896 was 855, checked in by alloc, 12 years ago

AEI-Setup Win: Added proxy dialog

File size: 9.1 KB
RevLine 
[818]1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
[855]2#define AppVersion "1.1"
[818]3#define AppLongName "Anniversary Edition of Oni"
4#define AppShortName "Anniversary-Edition-Setup"
5
6#define MinJavaVersion "1.6"
7#define JavaDownloadPage "http://www.java.com/en/download/manual.jsp#win"
8
9[Setup]
10AppId={#AppId}
11AppVersion={#AppVersion}
12AppName={#AppLongName}
13DefaultDirName={pf32}\Oni
14OutputBaseFilename={#AppShortName}-v{#AppVersion}
15DefaultGroupName=Oni AE
16
17DirExistsWarning=no
18AppendDefaultDirName=no
19
20ArchitecturesInstallIn64BitMode=x64
21ShowComponentSizes=no
22AppPublisher=
23AppPublisherURL=
24AppSupportURL=
25AppUpdatesURL=
26AllowNoIcons=yes
27OutputDir=.
28Compression=lzma2/max
29SolidCompression=yes
30
31[Languages]
32Name: "en"; MessagesFile: "compiler:Default.isl"
33
34[Messages]
35en.SelectDirBrowseLabel=Please select the installation directory of Oni.
36
37[CustomMessages]
38en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
39en.JavaNotFound=This program needs a Java Runtime (JRE) with version being at least %1.%nPlease download and install a suitable JRE.%nDo you want do download a JRE now?
40
41[Tasks]
42Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
43
44[Components]
45Name: "JRE"; Description: "JRE"
46Name: "AEI"; Description: "AEI"
47
48[Dirs]
49Name: "{app}\AE"; Permissions: users-modify
50
51[Files]
52Source: "AEInstaller2Updater.jar"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
53Source: "JRE\*"; DestDir: "{app}\AE\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
54Source: "AElogo.ico"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
55
56[Icons]
57Name: "{app}\AE\AEInstaller2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
58Name: "{app}\AE\AEInstaller2Updater"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: not IsJavaInstalled
59Name: "{group}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
60Name: "{commondesktop}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: not IsJavaInstalled
61Name: "{app}\AE\AEInstaller2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
62Name: "{app}\AE\AEInstaller2Updater"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: IsJavaInstalled
63Name: "{group}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
64Name: "{commondesktop}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: IsJavaInstalled
65
66[Run]
[855]67Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: not IsJavaInstalled; BeforeInstall: WriteProxyData
68Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: IsJavaInstalled; BeforeInstall: WriteProxyData
[818]69
70
71[Code]
72var
[855]73 PageUseProxy: TInputOptionWizardPage;
74 PageProxyData: TInputQueryWizardPage;
[818]75 javaPath: String;
76
77procedure DecodeVersion (verstr: String; var verint: array of Integer);
78var
79 i,p: Integer; s: string;
80begin
81 // initialize array
82 verint := [0,0,0,0];
83 i := 0;
84 while ((Length(verstr) > 0) and (i < 4)) do
85 begin
86 p := pos ('.', verstr);
87 if p > 0 then
88 begin
89 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
90 verint[i] := StrToInt(s);
91 i := i + 1;
92 verstr := Copy (verstr, p+1, Length(verstr));
93 end
94 else
95 begin
96 verint[i] := StrToInt (verstr);
97 verstr := '';
98 end;
99 end;
100
101end;
102
103function CompareVersion (ver1, ver2: String) : Integer;
104var
105 verint1, verint2: array of Integer;
106 i: integer;
107begin
108 SetArrayLength (verint1, 4);
109 DecodeVersion (ver1, verint1);
110
111 SetArrayLength (verint2, 4);
112 DecodeVersion (ver2, verint2);
113
114 Result := 0; i := 0;
115 while ((Result = 0) and ( i < 4 )) do
116 begin
117 if verint1[i] > verint2[i] then
118 Result := 1
119 else
120 if verint1[i] < verint2[i] then
121 Result := -1;
122 i := i + 1;
123 end;
124
125end;
126
127procedure CheckJavaRuntime();
128var
129 W6432: Boolean;
130 Res: Boolean;
131 JavaVer: String;
132begin
133 W6432 := False;
134 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
135 if (Res = False) and IsWin64() then
136 begin
137 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
138 W6432 := Res;
139 end;
140 if Res = True then
141 begin
142 if Length( JavaVer ) > 0 then
143 begin
144 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
145 begin
146 if W6432 then
147 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
148 else
149 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
150 end;
151 end;
152 end;
153end;
154
155function IsJavaInstalled(): Boolean;
156begin
157 Result := Length(javaPath) > 0;
158end;
159
160function GetJavaPath(Param: String): String;
161begin
162 Result := javaPath;
163end;
164
165function InitializeSetup(): Boolean;
166begin
167 CheckJavaRuntime();
168 Result := True;
169end;
170
171procedure InitializeWizard();
172var
173 Components : TNewCheckListbox;
174 i : integer;
175begin
176 Components := WizardForm.ComponentsList;
177 i := Components.Items.IndexOf('JRE');
178 if i <> -1 then
179 begin
180 Components.ItemEnabled[i] := false;
181 Components.Checked[i] := not IsJavaInstalled();
182 end;
183 i := Components.Items.IndexOf('AEI');
184 if i <> -1 then
185 begin
186 Components.ItemEnabled[i] := false;
187 Components.Checked[i] := true;
188 end;
[855]189
190 PageUseProxy := CreateInputOptionPage(wpSelectTasks, 'Internet connection type', '', 'Do you require to use a proxy to connect to the internet?', true, false);
191 PageUseProxy.Add('Direct connection');
192 PageUseProxy.Add('Use proxy');
193 PageUseProxy.Values[0] := true;
194
195 PageProxyData := CreateInputQueryPage(PageUseProxy.ID, 'Proxy data', '', 'Please enter the data required to connect to your proxy.');
196 PageProxyData.Add('Hostname or IP:', False);
197 PageProxyData.Add('Port:', False);
[818]198end;
199
200function DirOk(Path: String): boolean;
201begin
202 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
203end;
204
205function NextButtonClick(CurPageID: Integer): boolean;
206begin
207 Result := True;
208
209 if CurPageID = wpSelectDir then
210 begin
211 if (not DirOk(WizardDirValue)) then
212 begin
213 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
214 Result := False;
215 end;
216 end;
217end;
218
219
[855]220function EnterProxyData(): Boolean;
221begin
222 Result := PageUseProxy.SelectedValueIndex = 1;
223end;
224
[818]225function ShouldSkipPage(PageID: Integer): Boolean;
226begin
[855]227 Result := false;
228 if (PageID = wpSelectComponents) then
229 Result := true;
230 if (PageID = PageProxyData.ID) then
231 Result := not EnterProxyData();
[818]232end;
233
[855]234
[818]235function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
236begin
237 Result := MemoUserInfoInfo + NewLine;
238 Result := Result + MemoDirInfo + NewLine;
239 Result := Result + MemoGroupInfo + NewLine;
240 Result := Result + MemoTasksInfo + NewLine;
[855]241
242 if (EnterProxyData()) then
243 Result := Result + NewLine + 'Set proxy configuration';
[818]244end;
245
[855]246
247procedure WriteProxyData();
248begin
249 if (EnterProxyData()) then
250 begin
251 SaveStringToFile(ExpandConstant('{app}') + '\AE\AEInstaller\AEI-ProxySettings.xml',
252 '<?xml version="1.0" ?><Proxy><useProxy>true</useProxy><hostOrIp>'+PageProxyData.Values[0]+'</hostOrIp><port>'+PageProxyData.Values[1]+'</port></Proxy>',
253 False);
254 end;
255end;
Note: See TracBrowser for help on using the repository browser.