forked from FelisDiligens/Fallout76-QuickConfiguration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.iss
219 lines (187 loc) · 7.62 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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Fallout 76 Quick Configuration"
#define MyAppPublisher "FelisDiligens"
#define MyAppURL "https://www.nexusmods.com/fallout76/mods/546"
#define MyAppExeName "Fo76ini.exe"
#define ProjectVersion "1.12.6"
#define ProjectGitDir "C:\Users\vboxuser\Downloads\Fallout76-QuickConfiguration"
#define AppConfigDir "{localappdata}\Fallout 76 Quick Configuration"
#define INIBackupDir "{userdocs}\My Games\Fallout 76\Backups"
[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={{997D2843-19B3-4AB4-A879-8AC56ACA26D4}
AppName={#MyAppName}
AppVersion={#ProjectVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile={#ProjectGitDir}\LICENSE
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir={#ProjectGitDir}\Publish
OutputBaseFilename=Setup_v{#ProjectVersion}
SetupIconFile={#ProjectGitDir}\Fo76ini\icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
DisableWelcomePage=no
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#ProjectGitDir}\Publish\v{#ProjectVersion}\Fo76ini.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ProjectGitDir}\Publish\v{#ProjectVersion}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
;[UninstallDelete]
;Type: filesandordirs; Name: "{#AppConfigDir}\*.*"
; https://stackoverflow.com/a/28872499
; https://stackoverflow.com/a/48153232
; https://stackoverflow.com/a/42626292
[Code]
var
UninstallOptionsPage: TNewNotebookPage;
UninstallNextButton: TNewButton;
CheckBoxRemoveSettings: TNewCheckBox;
CheckBoxRemoveBackups: TNewCheckBox;
procedure UpdateUninstallWizard;
begin
UninstallProgressForm.PageNameLabel.Caption := 'Uninstall Fallout 76 Quick Configuration';
UninstallProgressForm.PageDescriptionLabel.Caption :=
'Remove Fallout 76 Quick Configuration from your computer.';
UninstallNextButton.Caption := 'Proceed';
UninstallNextButton.ModalResult := mrNone;
UninstallNextButton.Caption := 'Uninstall';
{ Make the "Uninstall" button break the ShowModal loop }
UninstallNextButton.ModalResult := mrOK;
end;
procedure UninstallNextButtonClick(Sender: TObject);
begin
UpdateUninstallWizard;
end;
procedure InitializeUninstallProgressForm();
var
PageText: TNewStaticText;
PageNameLabel: string;
PageDescriptionLabel: string;
CancelButtonEnabled: Boolean;
CancelButtonModalResult: Integer;
begin
if not UninstallSilent then
begin
PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;
{ Create the Welcome page and make it active }
UninstallOptionsPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallOptionsPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallOptionsPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallOptionsPage.Align := alClient;
UninstallOptionsPage.Color := clWindow;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallOptionsPage;
{ Create controls }
PageText := TNewStaticText.Create(UninstallProgressForm);
with PageText do
begin
Parent := UninstallOptionsPage;
Top := UninstallProgressForm.StatusLabel.Top;
Left := UninstallProgressForm.StatusLabel.Left;
Width := UninstallProgressForm.StatusLabel.Width;
Height := UninstallProgressForm.StatusLabel.Height;
AutoSize := False;
ShowAccelChar := False;
Caption := 'Pick optional files to remove:';
end;
UninstallNextButton := TNewButton.Create(UninstallProgressForm);
with UninstallNextButton do
begin
Parent := UninstallProgressForm;
Left :=
UninstallProgressForm.CancelButton.Left -
UninstallProgressForm.CancelButton.Width -
ScaleX(10);
Top := UninstallProgressForm.CancelButton.Top;
Width := UninstallProgressForm.CancelButton.Width;
Height := UninstallProgressForm.CancelButton.Height;
OnClick := @UninstallNextButtonClick;
end;
UninstallProgressForm.CancelButton.TabOrder := UninstallNextButton.TabOrder + 1;
CheckBoxRemoveSettings := TNewCheckBox.Create(UninstallProgressForm);
with CheckBoxRemoveSettings do
begin
Parent := UninstallOptionsPage;
Left := PageText.Left;
Top := PageText.Top + PageText.Height;
Width := PageText.Width;
Height := ScaleY(30);
Caption := 'Remove tool''s settings and log files';
Checked := True
end;
CheckBoxRemoveBackups := TNewCheckBox.Create(UninstallProgressForm);
with CheckBoxRemoveBackups do
begin
Parent := UninstallOptionsPage;
Left := CheckBoxRemoveSettings.Left;
Top := CheckBoxRemoveSettings.Top + CheckBoxRemoveSettings.Height;
Width := CheckBoxRemoveSettings.Width;
Height := ScaleY(30);
Caption := 'Remove *.ini backups in "My Games" folder';
Checked := False
end;
{ Run our wizard pages }
UpdateUninstallWizard;
CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
UninstallProgressForm.CancelButton.Enabled := True;
CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
UninstallProgressForm.CancelButton.ModalResult := mrCancel;
if UninstallProgressForm.ShowModal = mrCancel then Abort;
{ Restore the standard page payout }
UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;
UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;
UninstallProgressForm.InnerNotebook.ActivePage :=
UninstallProgressForm.InstallingPage;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then { or usPostUninstall }
begin
if CheckBoxRemoveSettings.Checked then
begin
Log('Deleting configuration folder');
if DelTree(ExpandConstant('{#AppConfigDir}'), True, True, True) then
begin
Log('Deleted configuration folder');
end
else
begin
MsgBox('Couldn''t remove configuration folder.', mbError, MB_OK);
end;
end;
if CheckBoxRemoveBackups.Checked then
begin
Log('Deleting backups folder');
if DelTree(ExpandConstant('{#INIBackupDir}'), True, True, True) then
begin
Log('Deleted backups folder');
end
else
begin
MsgBox('Couldn''t remove backups folder.', mbError, MB_OK);
end;
end;
end;
end;