forked from SteveMoody73/Amleto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmleto64.iss
executable file
·185 lines (158 loc) · 7.22 KB
/
Amleto64.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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[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={{3C37B532-D178-4B8D-9169-08AB76E045B1}
AppName=Amleto
AppVerName=Amleto 3.4
AppVersion=3.4
AppPublisher=Virtualcoder
AppPublisherURL=http://virtualcoder.co.uk/
AppSupportURL=http://virtualcoder.co.uk/amleto
AppUpdatesURL=http://virtualcoder.co.uk/amleto
DefaultDirName={pf}\Amleto
DefaultGroupName=Amleto
OutputBaseFilename=Amleto64
Compression=lzma
SolidCompression=yes
ChangesAssociations=yes
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Dirs]
Name: "{commonappdata}\Amleto"; Permissions: everyone-modify
Name: "{commonappdata}\Amleto\Logs"; Permissions: everyone-modify
[Files]
Source: "Amleto\bin\x64\Release\Amleto.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected;
Source: "AmletoClient\bin\x64\Release\AmletoClient.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: IsClientSelected;
Source: "RemoteExecution\bin\x64\Release\RemoteExecution.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "AmletoClientService\bin\x64\Release\AmletoClientService.exe"; DestDir: "{app}"; Flags: ignoreversion; BeforeInstall: StopClientService; Check: IsClientServiceSelected;
Source: "AmletoServerService\bin\x64\Release\AmletoServerService.exe"; DestDir: "{app}"; Flags: ignoreversion; BeforeInstall: StopServerService; Check: IsServerServiceSelected;
Source: "Amleto\Libraries\CommonMark.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected Or IsServerServiceSelected;
Source: "Amleto\Libraries\Cyotek.Windows.Forms.ImageBox.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected Or IsServerServiceSelected;
Source: "Amleto\Libraries\HtmlRenderer.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected Or IsServerServiceSelected;
Source: "Amleto\Libraries\HtmlRenderer.WinForms.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected Or IsServerServiceSelected;
Source: "Amleto\Libraries\ImageListView.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: IsServerSelected Or IsServerServiceSelected;
Source: "Amleto\Libraries\FreeImageNet.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Amleto\Libraries\64\FreeImage.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Amleto\bin\x64\Release\NLog.*"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\Amleto Server"; Filename: "{app}\Amleto.exe"; Check: IsServerSelected;
Name: "{group}\Amleto Client"; Filename: "{app}\AmletoClient.exe"; Check: IsClientSelected;
Name: "{group}\{cm:UninstallProgram,Amleto}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Amleto Server"; Filename: "{app}\Amleto.exe"; Tasks: desktopicon; Check: IsServerSelected;
Name: "{commondesktop}\Amelto Client"; Filename: "{app}\AmletoClient.exe"; Tasks: desktopicon; Check: IsClientSelected;
[Run]
Filename: "{app}\AmletoServerService.exe"; Parameters: "--install"; Check: IsServerServiceSelected
Filename: "{app}\AmletoClientService.exe"; Parameters: "--install"; Check: IsClientServiceSelected
Filename: "net"; Parameters: "start AmletoServer"; Flags: runhidden; StatusMsg: "Starting Server Service"; Check: IsServerServiceSelected
Filename: "net"; Parameters: "start AmletoClient"; Flags: runhidden; StatusMsg: "Starting Client Service"; Check: IsClientServiceSelected
[UninstallRun]
Filename: "net"; Parameters: "stop AmletoServer"; Flags: runhidden; StatusMsg: "Stopping Server Service";
Filename: "net"; Parameters: "stop AmletoClient"; Flags: runhidden; StatusMsg: "Stopping Client Service";
Filename: "{app}\AmletoServerService.exe"; Parameters: "--uninstall"
Filename: "{app}\AmletoClientService.exe"; Parameters: "--uninstall"
[Code]
var
OptionPage: TInputOptionWizardPage;
procedure InitializeWizard;
begin
OptionPage := CreateInputOptionPage(wpSelectDir, 'Program Selection', 'Which software do you want to install?',
'Please select the options to install, then click Next', False, False);
OptionPage.Add('Install Amleto Server');
OptionPage.Add('Install Amleto Client');
OptionPage.Add('Install Amleto Server Service');
OptionPage.Add('Install Amleto Client Service');
OptionPage.Values[0] := True;
OptionPage.Values[1] := True;
OptionPage.Values[2] := False;
OptionPage.Values[3] := False;
end;
function IsServerSelected: Boolean;
begin
Result := OptionPage.Values[0];
end;
function IsClientSelected: Boolean;
begin
Result := OptionPage.Values[1];
end;
function IsServerServiceSelected: Boolean;
begin
Result := OptionPage.Values[2];
end;
function IsClientServiceSelected: Boolean;
begin
Result := OptionPage.Values[3];
end;
procedure StopClientService();
var
ResultCode: Integer;
begin
if Exec('net', 'stop AmletoClient', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
end;
end;
procedure StopServerService();
var
ResultCode: Integer;
begin
if Exec('net', 'stop AmletoService', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
end;
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
UnInstallOldVersion();
end;
end;
end;