-
Notifications
You must be signed in to change notification settings - Fork 4
/
logbookkonni_pi.nsi
262 lines (217 loc) · 9.04 KB
/
logbookkonni_pi.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
; Script generated by the HM NIS Edit Script Wizard.
!include nsDialogs.nsh
!include LogicLib.nsh
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "logbookkonni_pi"
!define PRODUCT_VERSION "1.1"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
XPStyle on
RequestExecutionLevel admin
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "LogbookKonni-Setup.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Czech.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\French.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Danish.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Polish.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Dutch.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Turkish.nlf"
; License data
; Not exactly translated, but it shows what's needed
/*LicenseLangString myLicenseData ${LANG_ENGLISH} ""
LicenseLangString myLicenseData ${LANG_DUTCH} ""
LicenseLangString myLicenseData ${LANG_FRENCH} ""
LicenseLangString myLicenseData ${LANG_GERMAN} ""
LicenseLangString myLicenseData ${LANG_KOREAN} ""
LicenseLangString myLicenseData ${LANG_RUSSIAN} ""
LicenseLangString myLicenseData ${LANG_SPANISH} ""
LicenseLangString myLicenseData ${LANG_SWEDISH} ""
LicenseLangString myLicenseData ${LANG_TRADCHINESE} ""
LicenseLangString myLicenseData ${LANG_SIMPCHINESE} ""
LicenseLangString myLicenseData ${LANG_SLOVAK} ""
LicenseData $(myLicenseData)
*/
;Name $(Name)
; Set one text for all languages (simply don't use a LangString)
CompletedText "LogbookKonni completed"
var hwnd
var Group1Radio1
var Group1Radio2
#InstallDir "$PROGRAMFILES\OpenCPN"
InstallDir ""
Page custom nsDialogsPage
Page directory
Page instfiles
Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
;LicenseText "Falls Sie alle Bedingungen des Abkommens akzeptieren, klicken Sie auf 'Annehmen'. Sie müssen die Lizenzvereinbarungen anerkennen um $(^Name) zu installieren."
;LicenseData "C:\Dokumente und Einstellungen\Konni.MICKY-6B710455C\Eigene Dateien\temp\Readme.txt"
LicenseForceSelection checkbox
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push English
Push ${LANG_DUTCH}
Push Dutch
Push ${LANG_FRENCH}
Push French
Push ${LANG_GERMAN}
Push German
Push ${LANG_POLISH}
Push Polish
Push ${LANG_TURKISH}
Push Turkish
Push ${LANG_SPANISH}
Push Spanish
; Push ${LANG_SWEDISH}
; Push Swedish
Push ${LANG_DANISH}
Push Danish
; Push ${LANG_TRADCHINESE}
; Push "Traditional Chinese"
; Push ${LANG_SIMPCHINESE}
; Push "Simplified Chinese"
Push ${LANG_CZECH}
Push Czech
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
FunctionEnd
Function nsDialogsPage
StrCpy $INSTDIR "$PROGRAMFILES\OpenCPN"
nsDialogs::Create 1018
Pop $0
GetFunctionAddress $0 OnBack
nsDialogs::OnBack $0
${NSD_CreateRadioButton} 60u 20% 40% 6% "Normal Installation"
Pop $Group1Radio1
${NSD_AddStyle} $Group1Radio1 ${WS_GROUP}
${NSD_OnClick} $Group1Radio1 RadioClick
${NSD_Check} $Group1Radio1
${NSD_CreateLabel} 75u 25% 75% 6% "$PROGRAMFILES\OpenCPN"
Pop $0
${NSD_CreateRadioButton} 60u 40% 40% 6% "Parallel Installation"
Pop $Group1Radio2
${NSD_OnClick} $Group1Radio2 RadioClick
${NSD_CreateLabel} 75u 45% 75% 6% "$PROGRAMFILES\OpenCPN 3.0.0"
Pop $0
nsDialogs::Show
FunctionEnd
Function RadioClick
Pop $hwnd
${If} $hwnd == $Group1Radio1
StrCpy $INSTDIR "$PROGRAMFILES\OpenCPN"
${ElseIf} $hwnd == $Group1Radio2
StrCpy $INSTDIR "$PROGRAMFILES\OpenCPN 3.0.0"
${EndIf}
FunctionEnd
Function OnBack
FunctionEnd
Section "DLL" SEC01
SetOutPath "$INSTDIR\plugins"
SetOverwrite on
File "C:\Program Files (x86)\OpenCPN\plugins\logbookkonni_pi.dll"
SectionEnd
Section "Languages" SEC02
SetOutPath "$INSTDIR\share\locale\cs\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\cs\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\de\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\de\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\fr\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\fr\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\es\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\es\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\da\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\da\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\pl\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\pl\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\nl\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\nl\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SetOutPath "$INSTDIR\share\locale\tr_TR\LC_MESSAGES\"
File "C:\Program Files (x86)\OpenCPN\share\locale\tr_TR\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
SectionEnd
Section "Layouts" SEC03
SetShellVarContext all
SetOutPath "$APPDATA\opencpn\plugins\logbook\data\HTMLLayouts"
File /r "C:\Users\Konni\Documents\Visual Studio 2010\Projects\opencpn\plugins\LogbookKonni_pi\data\HTMLLayouts\*.html"
SetOutPath "$APPDATA\opencpn\plugins\logbook\data\ODTLayouts"
File /r "C:\Users\Konni\Documents\Visual Studio 2010\Projects\opencpn\plugins\LogbookKonni_pi\data\ODTLayouts\*.odt"
SetOutPath "$APPDATA\opencpn\plugins\logbook\data\Clouds"
File /r "C:\Users\Konni\Documents\Visual Studio 2010\Projects\opencpn\plugins\LogbookKonni_pi\data\Clouds\*.jpg"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\plugins\uninst_logbookkonni_pi.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\plugins\uninst_logbookkonni_pi.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfull uninstalled."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Please close OpenCPN now, if it's running for a clean uninstall,$\nbut don't close this window.$\n$\nDo You like to uninstall $(^Name), all of it's components and data?All your logbooks are deleted !!" IDYES +2
Abort
FunctionEnd
Function un.RmLanguageFiles
Exch $R0 ; exclude file
Exch
Exch $R1 ; route dir
Push $R2
Push $R3
FindFirst $R3 $R2 "$R1\*.*"
IfErrors Exit
Top:
; StrCmp $R2 "." Next
StrCmp $R2 ".." Next
; StrCmp $R2 $R0 Next
IfFileExists "$R1\$R2\LC_MESSAGES\opencpn-logbookkonni_pi.mo" Del
#Goto Exit ;uncomment this to stop it being recursive (delete only one file)
Del:
; detailprint "$R1\$R2\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
Delete "$R1\$R2\LC_MESSAGES\opencpn-logbookkonni_pi.mo"
Next:
ClearErrors
FindNext $R3 $R2
IfErrors Exit
Goto Top
Exit:
FindClose $R3
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
Section Uninstall
SetShellVarContext all
RMDir /r $APPDATA\opencpn\plugins\logbook
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/OverviewGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/ServiceGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/RepairsGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/BuyPartsGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/NavGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/WeatherGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/MotorGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/CrewGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/WakeGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/Logbook/EquipGridColWidth
DeleteINISec $APPDATA\opencpn\opencpn.ini PlugIns/LogbookKonni
Push "$PROGRAMFILES\OpenCPN\share\locale"
Push "file to exclude"
Call un.RmLanguageFiles
; Delete "$PROGRAMFILES\opencpn-logbookkonni_pi.mo"
Delete $INSTDIR\logbookkonni_pi.dll
Delete $INSTDIR\uninst_logbookkonni_pi.exe
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose false
SectionEnd