This repository has been archived by the owner on Nov 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Setup.iss
354 lines (310 loc) · 13.4 KB
/
Setup.iss
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "JSONSource"
#define MyAppVersion "1.0.200"
#define MyAppPublisher "Webkingsoft"
#define MyAppURL "https://jsonsource.codeplex.com/"
#define MyAppExeName "JsonSource.exe"
[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={{54B2D300-0B15-44ED-BA06-E13758F421BC}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
UninstallDisplayName=JSON Source SSIS Plugin
DisableWelcomePage=No
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
; Donate Button image
Source: "Publish\donate.bmp"; Flags: dontcopy
Source: "Publish\130\com.webkingsoft.JSONSource_130.dll"; DestDir: "{code:GetSql130Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_130"; Components: SSIS_130; Check: CheckSql130_32
Source: "Publish\130\com.webkingsoft.JSONSource_130.dll"; DestDir: "{code:GetSql130Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_130"; Components: SSIS_130; Check: CheckSql130_64
Source: "Publish\130\Newtonsoft.Json.dll"; DestDir: "{code:GetSql130Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_130; Check: CheckSql130_32
Source: "Publish\130\Newtonsoft.Json.dll"; DestDir: "{code:GetSql130Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_130; Check: CheckSql130_64
Source: "Publish\120\com.webkingsoft.JSONSource_120.dll"; DestDir: "{code:GetSql120Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_120"; Components: SSIS_120; Check: CheckSql120_32
Source: "Publish\120\com.webkingsoft.JSONSource_120.dll"; DestDir: "{code:GetSql120Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_120"; Components: SSIS_120; Check: CheckSql120_64
Source: "Publish\120\Newtonsoft.Json.dll"; DestDir: "{code:GetSql120Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_120; Check: CheckSql120_32
Source: "Publish\120\Newtonsoft.Json.dll"; DestDir: "{code:GetSql120Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_120; Check: CheckSql120_64
Source: "Publish\110\com.webkingsoft.JSONSource_110.dll"; DestDir: "{code:GetSql110Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_110"; Components: SSIS_110; Check: CheckSql110_32
Source: "Publish\110\com.webkingsoft.JSONSource_110.dll"; DestDir: "{code:GetSql110Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "com.webkingsoft.JSONSource_110"; Components: SSIS_110; Check: CheckSql110_64
Source: "Publish\110\Newtonsoft.Json.dll"; DestDir: "{code:GetSql110Path_32}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_110; Check: CheckSql110_32
Source: "Publish\110\Newtonsoft.Json.dll"; DestDir: "{code:GetSql110Path_64}\PipelineComponents"; Flags: gacinstall; StrongAssemblyName: "Newtonsoft.Json"; Components: SSIS_110; Check: CheckSql110_64
[Components]
Name: "SSIS_130"; Description: "MS Sql Server 2016 (32 bit). Required for Visual Studio and BIDS."; Types: custom; Check: CheckSql130_32
Name: "SSIS_130"; Description: "MS Sql Server 2016 (64 bit)"; Types: custom; Check: CheckSql130_64
Name: "SSIS_120"; Description: "MS Sql Server 2014 (32 bit). Required for Visual Studio and BIDS."; Types: custom; Check: CheckSql120_32
Name: "SSIS_120"; Description: "MS Sql Server 2014 (64 bit)"; Types: custom; Check: CheckSql120_64
Name: "SSIS_110"; Description: "MS Sql Server 2012 (32 bit). Required for Visual Studio and BIDS."; Types: custom; Check: CheckSql110_32
Name: "SSIS_110"; Description: "MS Sql Server 2012 (64 bit)"; Types: custom; Check: CheckSql110_64
[Types]
Name: "Custom"; Description: "Customize components"; Flags: iscustom
[Setup]
Uninstallable=True
[Code]
// -------------------------------------------
// ----------------- SQL 130 -----------------
// -------------------------------------------
function CheckSql130_32(): Boolean;
var
Path: String;
begin
If IsWin64() then
begin
// Query the DB and look for the 130 DTS path. We assume there is no sql server installed if this fails.
Result := RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\130\SSIS\Setup\DTSPath', '', Path);
end
else
begin
Result := RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\130\DTS\Setup', 'SQLPath', Path);
end;
end;
function CheckSql130_64(): Boolean;
var
Path: String;
begin
// Query the DB and look for the 130 DTS path. We assume there is no sql server installed if this fails.
Result:= RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\130\DTS\Setup', 'SQLPath', Path);
end;
function GetSql130Path_32(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
If IsWin64() then
begin
RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\130\SSIS\Setup\DTSPath', '', Path);
Result:=Path
end
else
begin
RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\130\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
end;
function GetSql130Path_64(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\130\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
// -------------------------------------------
// ----------------- SQL 120 -----------------
// -------------------------------------------
function CheckSql120_32(): Boolean;
var
Path: String;
begin
If IsWin64() then
begin
// Query the DB and look for the 120 DTS path. We assume there is no sql server installed if this fails.
Result := RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\120\SSIS\Setup\DTSPath', '', Path);
end
else
begin
Result := RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\120\DTS\Setup', 'SQLPath', Path);
end;
end;
function CheckSql120_64(): Boolean;
var
Path: String;
begin
// Query the DB and look for the 120 DTS path. We assume there is no sql server installed if this fails.
Result:= RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\120\DTS\Setup', 'SQLPath', Path);
end;
function GetSql120Path_32(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
If IsWin64() then
begin
RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\120\SSIS\Setup\DTSPath', '', Path);
Result:=Path
end
else
begin
RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\120\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
end;
function GetSql120Path_64(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\120\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
// -------------------------------------------
// ----------------- SQL 110 -----------------
// -------------------------------------------
function CheckSql110_32(): Boolean;
var
Path: String;
begin
// Query the DB and look for the 120 DTS path. We assume there is no sql server installed if this fails.
If IsWin64() then
begin
Result:= RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DTSPath', '', Path);
end
else
begin
Result:= RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\110\DTS\Setup', 'SQLPath', Path);
end;
end;
function CheckSql110_64(): Boolean;
var
Path: String;
begin
// Query the DB and look for the 120 DTS path. We assume there is no sql server installed if this fails.
Result:= RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\110\DTS\Setup', 'SQLPath', Path);
end;
function GetSql110Path_32(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
If IsWin64() then
begin
RegQueryStringValue(HKLM64, 'SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DTSPath', '', Path);
Result:=Path
end
else
begin
RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Microsoft SQL Server\110\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
end;
function GetSql110Path_64(Dummy: string): String;
var
Path: String;
begin
// Query the DB in order to retrieve the path where to install the DLLs
RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Microsoft SQL Server\110\DTS\Setup', 'SQLPath', Path);
Result:=Path
end;
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
// Ask the user a Yes/No question
if MsgBox('The software has detected a previous version of the software installed. This process will uninstall the previous version and then the new version will be installed. Note that plugin upgrade may require metadata manual updating. Do you want to proceed?', mbConfirmation, MB_YESNO) = IDYES then
begin
UnInstallOldVersion();
end
else
begin
Abort();
end;
end;
end;
end;
procedure DonateButtonClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('open', 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6HPAB89UYSZF2', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
procedure DonateButton();
var
ImageFile: String;
Image: TBitmapImage;
begin
ExtractTemporaryFile('donate.bmp');
with TBitmapImage.Create(WizardForm) do
begin
Parent := WizardForm.FinishedPage;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\donate.bmp'));
AutoSize := True;
Left := 200;
Top := WizardForm.InstallingPage.Top + WizardForm.InstallingPage.Height - Height - 8;
Cursor := crHand;
ReplaceColor := clWhite; // Replace magenta...
ReplaceWithColor := WizardForm.WelcomePage.Color; // ...with the background color of the page
OnClick := @DonateButtonClick;
end;
end;
// -------------------------------------------
// ----------- Common Functios ---------------
// -------------------------------------------
function InitializeSetup(): boolean;
var
ResultCode: integer;
begin
// Check if at least one of the packages can be installed.
if CheckSql130_32() or CheckSql130_64() or CheckSql120_32() or CheckSql120_64() or CheckSql110_32() or CheckSql110_64() then
begin
Result:=True;
end
else
begin
MsgBox('No compatible Microsoft Sql Server has been found on this system. This version is only compatible with Microsoft Sql Server 2012, 2014 and 2016.', mbError, MB_OK);
Result := False;
end;
end;
procedure InitializeWizard;
begin
DonateButton();
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpFinished : WizardForm.FinishedLabel.Caption := 'Thank you for installing JSONSource suite. Please rememeber that this probject is maintained by only a single student who really listens to the community! Any donation is automatically spent on beer, thus really welcomed. The developer only codes when he has beer available :)';
end;
end;