forked from brian-pantano/PianoFromAbove
-
Notifications
You must be signed in to change notification settings - Fork 10
/
PianoFromAbove.nsi
289 lines (243 loc) · 13 KB
/
PianoFromAbove.nsi
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
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
!include "x64.nsh"
;--------------------------------
;General
!define Version 1.1.0
Name "Piano From Above"
OutFile "PFA-${Version}-setup.exe"
BrandingText "PFA ${Version}"
Var TargetFile ;Set in onInit
RequestExecutionLevel admin
SetCompressor /SOLID /FINAL lzma
;Default installation folder
InstallDir "$LOCALAPPDATA\Piano From Above"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Piano From Above" ""
Function .onInit
${If} ${RunningX64}
StrCpy $TargetFile "PFA-${Version}-x86_64.exe"
${Else}
StrCpy $TargetFile "PFA-${Version}-x86.exe"
${EndIf}
SetShellVarContext current
Call uninstall
FunctionEnd
Function uninstall
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "UninstallString"
StrCmp $R0 "" Done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Piano From Above needs to be unstalled first.$\n$\nClick OK to remove the previous version. Your settings will be saved." IDCANCEL Cancel
ExecShell open "$R0"
Cancel:
Abort
Done:
FunctionEnd
;--------------------------------
;Interface Configuration
!define MUI_ICON "PianoFromAbove\Images\PFA Icon.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "PianoFromAbove\Images\Install Header.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "PianoFromAbove\Images\Mirror Wizard.bmp"
!define MUI_FINISHPAGE_RUN "$INSTDIR\$TargetFile"
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Piano From Above (required)" SecProgramFile
SectionIn RO
SetOutPath "$INSTDIR"
${If} ${RunningX64}
SetRegView 64
File "Release\PFA-1.1.0-x86_64.exe"
${Else}
File "Release\PFA-1.1.0-x86.exe"
${EndIf}
File "Docs\Readme.txt"
File "Docs\Credits.txt"
;Store installation folder
WriteRegStr HKCU "Software\Piano From Above" "" $INSTDIR
;Add/Remove programns
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "DisplayName" "Piano From Above"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "DisplayVersion" "1.1.0"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "DisplayIcon" "$INSTDIR\$TargetFile"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "Publisher" "Brian Pantano"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "EstimatedSize" 1122
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "NoModify" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above" "NoRepair" 1
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "DirectX 9 Update" SecDirectX
SetOutPath "$INSTDIR"
File "Redist\DXSETUP.exe"
File "Redist\DSETUP.dll"
File "Redist\dsetup32.dll"
File "Redist\dxdllreg_x86.cab"
File "Redist\dxupdate.cab"
File "Redist\Jun2010_d3dx9_43_x86.cab"
File "Redist\Jun2010_d3dx9_43_x64.cab"
ExecWait '"$INSTDIR\DXSETUP.exe" /silent'
Delete "$INSTDIR\DXSETUP.exe"
Delete "$INSTDIR\DSETUP.dll"
Delete "$INSTDIR\dsetup32.dll"
Delete "$INSTDIR\dxdllreg_x86.cab"
Delete "$INSTDIR\dxupdate.cab"
Delete "$INSTDIR\Jun2010_d3dx9_43_x86.cab"
Delete "$INSTDIR\Jun2010_d3dx9_43_x64.cab"
SectionEnd
Section "Start Menu Shortcuts" SecStartMenu
CreateDirectory "$SMPROGRAMS\Piano From Above"
CreateShortCut "$SMPROGRAMS\Piano From Above\Piano From Above.lnk" "$INSTDIR\$TargetFile" "" "$INSTDIR\$TargetFile" 0
CreateShortCut "$SMPROGRAMS\Piano From Above\View Readme.lnk" "$INSTDIR\Readme.txt"
CreateShortCut "$SMPROGRAMS\Piano From Above\View Credits.lnk" "$INSTDIR\Credits.txt"
CreateShortCut "$SMPROGRAMS\Piano From Above\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
SectionEnd
Section "Desktop Shortcut" SecDesktop
CreateShortCut "$DESKTOP\Piano From Above.lnk" "$INSTDIR\$TargetFile" "" "$INSTDIR\$TargetFile" 0
SectionEnd
Section "Piano MIDI Files" SecMusicFiles
CreateDirectory "$MUSIC\Piano From Above"
SetOutPath "$MUSIC\Piano From Above"
File "Docs\Credits.txt"
CreateDirectory "$MUSIC\Piano From Above\1 Intermediate 1"
SetOutPath "$MUSIC\Piano From Above\1 Intermediate 1"
File "Music\1 Intermediate 1\Bach - Minuet in B-flat Major.mid"
File "Music\1 Intermediate 1\Bach - Minuet in F Major.mid"
File "Music\1 Intermediate 1\Bach - Minuet in G Major.mid"
File "Music\1 Intermediate 1\Bach - Minuet in G Minor.mid"
File "Music\1 Intermediate 1\Bach - Musette in D Major.mid"
File "Music\1 Intermediate 1\Chopin - Prelude in C Minor.mid"
File "Music\1 Intermediate 1\Clementie - Sonatina Op. 36, No. 1 1st Movement.mid"
File "Music\1 Intermediate 1\Schumann - First Sorrow.mid"
File "Music\1 Intermediate 1\Schumann - Humming Song.mid"
File "Music\1 Intermediate 1\Schumann - Melody.mid"
File "Music\1 Intermediate 1\Schumann - Sicilienne.mid"
File "Music\1 Intermediate 1\Schumann - Soldiers' March.mid"
File "Music\1 Intermediate 1\Schumann - The Happy Farmer.mid"
CreateDirectory "$MUSIC\Piano From Above\2 Intermediate 2"
SetOutPath "$MUSIC\Piano From Above\2 Intermediate 2"
File "Music\2 Intermediate 2\Bach - Invention 01.mid"
File "Music\2 Intermediate 2\Bach - Invention 04.mid"
File "Music\2 Intermediate 2\Bach - Invention 09.mid"
File "Music\2 Intermediate 2\Bach - Invention 15.mid"
File "Music\2 Intermediate 2\Beethoven - Fur Elise.mid"
File "Music\2 Intermediate 2\Beethoven - Moonlight Sonata 1st Movement.mid"
File "Music\2 Intermediate 2\Beethoven - Pathetique 2nd Movement.mid"
File "Music\2 Intermediate 2\Chopin - Prelude in A Major.mid"
File "Music\2 Intermediate 2\Chopin - Prelude in E Minor.mid"
File "Music\2 Intermediate 2\Mozart - Sonata Facile 1st Movement.mid"
File "Music\2 Intermediate 2\Mozart - Turkish March.mid"
File "Music\2 Intermediate 2\Schumann - Dreaming.mid"
File "Music\2 Intermediate 2\Schumann - Farmhand Rupert.mid"
File "Music\2 Intermediate 2\Schumann - Hunting Song.mid"
File "Music\2 Intermediate 2\Schumann - The Wild Horseman.mid"
CreateDirectory "$MUSIC\Piano From Above\3 Advanced"
SetOutPath "$MUSIC\Piano From Above\3 Advanced"
File "Music\3 Advanced\Bach - Prelude and Fugue in C Major.mid"
File "Music\3 Advanced\Bach - Prelude and Fugue in C Minor.mid"
File "Music\3 Advanced\Chopin - Black Key Etude.mid"
File "Music\3 Advanced\Chopin - Etude Op. 10, No. 1.mid"
File "Music\3 Advanced\Chopin - Fantaisie-Impromptu.mid"
File "Music\3 Advanced\Chopin - Funeral March.mid"
File "Music\3 Advanced\Chopin - Revolutionary Etude.mid"
File "Music\3 Advanced\Debussy - Clair de Lune.mid"
File "Music\3 Advanced\Godowsky - Study of Chopin Etude Op. 10, No. 1.mid"
File "Music\3 Advanced\Grieg - March of the Trolls.mid"
File "Music\3 Advanced\Joplin - Maple Leaf Rag.mid"
File "Music\3 Advanced\Joplin - The Entertainer.mid"
File "Music\3 Advanced\Liszt - Hungarian Rhapsody No. 2.mid"
File "Music\3 Advanced\Liszt - Love Dreams No. 3.mid"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecProgramFile ${LANG_ENGLISH} "Installs essential files needed to run Piano From Above."
LangString DESC_SecDirectX ${LANG_ENGLISH} "Updates DirectX to the June 2010 release. If you have a newer version, you will not be downgraded."
LangString DESC_SecStartMenu ${LANG_ENGLISH} "Adds links to your start menu for easy access."
LangString DESC_SecDesktop ${LANG_ENGLISH} "Adds a link to your desktop for easy access."
LangString DESC_SecMusicFiles ${LANG_ENGLISH} "Adds a selection of piano midi files to your Music folder."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecProgramFile} $(DESC_SecProgramFile)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDirectX} $(DESC_SecDirectX)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
!insertmacro MUI_DESCRIPTION_TEXT ${SecMusicFiles} $(DESC_SecMusicFiles)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
${If} ${RunningX64}
SetRegView 64
${EndIf}
SetShellVarContext current
; Remove registry keys
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Piano From Above"
DeleteRegKey HKCU "Software\Piano From Above"
;Remove files
Delete "$INSTDIR\*.*"
Delete "$SMPROGRAMS\Piano From Above\*.*"
Delete "$DESKTOP\Piano From Above.lnk"
Delete "$MUSIC\Piano From Above\Credits.*"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Bach - Minuet in B-flat Major.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Bach - Minuet in F Major.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Bach - Minuet in G Major.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Bach - Minuet in G Minor.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Bach - Musette in D Major.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Chopin - Prelude in C Minor.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Clementie - Sonatina Op. 36, No. 1 1st Movement.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - First Sorrow.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - Humming Song.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - Melody.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - Sicilienne.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - Soldiers' March.mid"
Delete "$MUSIC\Piano From Above\1 Intermediate 1\Schumann - The Happy Farmer.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Bach - Invention 01.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Bach - Invention 04.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Bach - Invention 09.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Bach - Invention 15.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Beethoven - Fur Elise.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Beethoven - Moonlight Sonata 1st Movement.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Beethoven - Pathetique 2nd Movement.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Chopin - Prelude in A Major.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Chopin - Prelude in E Minor.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Mozart - Sonata Facile 1st Movement.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Mozart - Turkish March.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Schumann - Dreaming.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Schumann - Farmhand Rupert.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Schumann - Hunting Song.mid"
Delete "$MUSIC\Piano From Above\2 Intermediate 2\Schumann - The Wild Horseman.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Bach - Prelude and Fugue in C Major.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Bach - Prelude and Fugue in C Minor.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Chopin - Black Key Etude.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Chopin - Etude Op. 10, No. 1.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Chopin - Fantaisie-Impromptu.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Chopin - Funeral March.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Chopin - Revolutionary Etude.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Debussy - Clair de Lune.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Godowsky - Study of Chopin Etude Op. 10, No. 1.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Grieg - March of the Trolls.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Joplin - Maple Leaf Rag.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Joplin - The Entertainer.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Liszt - Hungarian Rhapsody No. 2.mid"
Delete "$MUSIC\Piano From Above\3 Advanced\Liszt - Love Dreams No. 3.mid"
; Remove directories
RMDir "$INSTDIR"
RMDir "$SMPROGRAMS\Piano From Above"
RMDir "$MUSIC\Piano From Above\1 Intermediate 1"
RMDir "$MUSIC\Piano From Above\2 Intermediate 2"
RMDir "$MUSIC\Piano From Above\3 Advanced"
RMDir "$MUSIC\Piano From Above"
SectionEnd