-
Notifications
You must be signed in to change notification settings - Fork 8
/
vcsetup.iss
161 lines (134 loc) · 5.38 KB
/
vcsetup.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
; NOTES:
; - Prior to compiling this file, run "git clone https://github.com/DomGries/InnoDependencyInstaller"
; - AppVersion must be defined on the commandline with /dAppVersion=""
#define public Dependency_Path_NetCoreCheck "InnoDependencyInstaller\dependencies\"
#include "InnoDependencyInstaller\CodeDependencies.iss"
#define SourceExeFilePath "publish\installer"
#define AppID "{33DFCEE8-022C-4C66-A366-79A7415320F2}"
#define AppName "Volume Control"
#define AppPublisher "radj307"
#define CurrentYear GetDateTimeString('yyyy','','')
#define AppURL "https://github.com/radj307/volume-control"
#define AppExeName "VolumeControl.exe"
#define AppMutex "VolumeControlSingleInstance"
#define AppFileVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "FileVersion")
#define AppVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "ProductVersion")
[Setup]
AppId={{#AppID}
AppName={#AppName}
AppVersion={#AppVersion}
AppVerName={#AppName} {#AppVersion}
AppCopyright=Copyright © 2022-{#CurrentYear} {#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
VersionInfoDescription={#AppName} installer
VersionInfoProductName={#AppName}
VersionInfoVersion={#AppFileVersion}
UninstallDisplayIcon={app}\{#AppExeName}
UninstallDisplayName={#AppName}
AppPublisher={#AppPublisher}
ShowLanguageDialog=yes
UsePreviousLanguage=no
LanguageDetectionMethod=uilanguage
WizardStyle=modern
WizardSizePercent=100
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
LicenseFile=LICENSE
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={autopf}\VolumeControl
DisableProgramGroupPage=yes
; OutputDir=publish
;DON'T CHANGE THIS ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ without also changing the name in UpdateChecker.cs
OutputBaseFilename=VolumeControl-Installer_{#AppVersion}
SetupIconFile=VolumeControl\Resources\icons\iconSilveredInstall.ico
Compression=lzma
SolidCompression=yes
AppMutex={#AppMutex}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#SourceExeFilePath}\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{autoprograms}\{#AppName}"; Filename: "{app}\{#AppExeName}"
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
Type: dirifempty; Name: "{app}"
[Code]
function GetUninstallKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
end;
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := GetUninstallKey();
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 else if (CurStep=ssPostInstall) then begin
RegWriteStringValue(HKEY_AUTO, GetUninstallKey(), 'DisplayVersion', '{#emit SetupSetting('AppVersion')}');
end;
end;
function InitializeSetup: Boolean;
begin
Dependency_AddDotNet60;
Result := True;
end;
procedure InitializeWizard();
var
i: Integer;
begin
{ Set the license memo text alignment to center & strip preceding whitespace }
WizardForm.LicenseMemo.Alignment := taCenter;
for i:= WizardForm.LicenseMemo.Lines.Count downto 0 do
WizardForm.LicenseMemo.Lines[i] := Trim(WizardForm.LicenseMemo.Lines[i]);
end;