Debian Codegraph @

win32/QNapi-setup.nsi

raw
1 ; Define your application name
2 !define APPNAME "QNapi"
3 !define APPVER "0.2.3"
4 !define APPNAMEANDVERSION "${APPNAME} ${APPVER}"
5
6 !include "MUI2.nsh"
7 !include "nsProcess.nsh"
8
9 ; Main Install settings
10 Name "${APPNAMEANDVERSION}"
11 InstallDir "$PROGRAMFILES\${APPNAME}"
12 InstallDirRegKey HKLM "Software\${APPNAME}" ""
13 OutFile "${APPNAME}-${APPVER}-setup.exe"
14
15 SetCompressor LZMA
16
17 !define MUI_ICON qnapi-drive.ico
18 !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
19 !define MUI_HEADERIMAGE
20 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
21 !define MUI_ABORTWARNING
22 !define MUI_FINISHPAGE_RUN "$INSTDIR\qnapi.exe"
23
24 !insertmacro MUI_PAGE_WELCOME
25 !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
26 !insertmacro MUI_PAGE_DIRECTORY
27 !insertmacro MUI_PAGE_INSTFILES
28 !insertmacro MUI_PAGE_FINISH
29
30 !insertmacro MUI_UNPAGE_CONFIRM
31 !insertmacro MUI_UNPAGE_INSTFILES
32
33 !insertmacro MUI_LANGUAGE "Polish"
34 !insertmacro MUI_RESERVEFILE_LANGDLL
35
36 Section "QNapi" Section1
37
38 ${nsProcess::KillProcess} "qnapi.exe" $R0
39 ${nsProcess::Unload}
40
41 ; Set Section properties
42 SetOverwrite on
43
44 ; Set Section Files and Shortcuts
45 SetOutPath "$INSTDIR\"
46
47 File /r "out\*"
48
49 CreateDirectory "$SMPROGRAMS\${APPNAME}"
50 CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\qnapi.exe"
51 CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
52
53 SectionEnd
54
55 Section -FinishSection
56
57 ; clean up registry keys from qnapi <= 0.1.7
58 DeleteRegKey HKCR ASFFile\shell\qnapi-pobierz
59 DeleteRegKey HKCR AVIFile\shell\qnapi-pobierz
60 DeleteRegKey HKCR divxfile\shell\qnapi-pobierz
61 DeleteRegKey HKCR mkvfile\shell\qnapi-pobierz
62 DeleteRegKey HKCR mpegfile\shell\qnapi-pobierz
63 DeleteRegKey HKCR mpgfile\shell\qnapi-pobierz
64 DeleteRegKey HKCR RealPlayer.RA.6\shell\qnapi-pobierz
65 DeleteRegKey HKCR RealPlayer.RAM.6\shell\qnapi-pobierz
66 DeleteRegKey HKCR RealPlayer.RM.6\shell\qnapi-pobierz
67 DeleteRegKey HKCR RealPlayer.RMVB.6\shell\qnapi-pobierz
68 DeleteRegKey HKCR rmvbfile\shell\qnapi-pobierz
69 DeleteRegKey HKCR WMP11.AssocFile.ASF\shell\qnapi-pobierz
70 DeleteRegKey HKCR WMP11.AssocFile.AVI\shell\qnapi-pobierz
71 DeleteRegKey HKCR WMP11.AssocFile.MPEG\shell\qnapi-pobierz
72 DeleteRegKey HKCR WMP11.AssocFile.WMV\shell\qnapi-pobierz
73 DeleteRegKey HKCR WMVFile\shell\qnapi-pobierz
74
75
76 WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
77 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
78 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
79 WriteUninstaller "$INSTDIR\uninstall.exe"
80
81
82 WriteRegStr HKCR SystemFileAssociations\.asf\shell\qnapi "" 'Pobierz napisy z QNapi...'
83 WriteRegStr HKCR SystemFileAssociations\.asf\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
84 WriteRegStr HKCR SystemFileAssociations\.avi\shell\qnapi "" 'Pobierz napisy z QNapi...'
85 WriteRegStr HKCR SystemFileAssociations\.avi\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
86 WriteRegStr HKCR SystemFileAssociations\.divx\shell\qnapi "" 'Pobierz napisy z QNapi...'
87 WriteRegStr HKCR SystemFileAssociations\.divx\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
88 WriteRegStr HKCR SystemFileAssociations\.mkv\shell\qnapi "" 'Pobierz napisy z QNapi...'
89 WriteRegStr HKCR SystemFileAssociations\.mkv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
90 WriteRegStr HKCR SystemFileAssociations\.mov\shell\qnapi "" 'Pobierz napisy z QNapi...'
91 WriteRegStr HKCR SystemFileAssociations\.mov\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
92 WriteRegStr HKCR SystemFileAssociations\.mp4\shell\qnapi "" 'Pobierz napisy z QNapi...'
93 WriteRegStr HKCR SystemFileAssociations\.mp4\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
94 WriteRegStr HKCR SystemFileAssociations\.mpeg\shell\qnapi "" 'Pobierz napisy z QNapi...'
95 WriteRegStr HKCR SystemFileAssociations\.mpeg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
96 WriteRegStr HKCR SystemFileAssociations\.mpg\shell\qnapi "" 'Pobierz napisy z QNapi...'
97 WriteRegStr HKCR SystemFileAssociations\.mpg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
98 WriteRegStr HKCR SystemFileAssociations\.ogg\shell\qnapi "" 'Pobierz napisy z QNapi...'
99 WriteRegStr HKCR SystemFileAssociations\.ogg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
100 WriteRegStr HKCR SystemFileAssociations\.ogm\shell\qnapi "" 'Pobierz napisy z QNapi...'
101 WriteRegStr HKCR SystemFileAssociations\.ogm\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
102 WriteRegStr HKCR SystemFileAssociations\.ogv\shell\qnapi "" 'Pobierz napisy z QNapi...'
103 WriteRegStr HKCR SystemFileAssociations\.ogv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
104 WriteRegStr HKCR SystemFileAssociations\.rm\shell\qnapi "" 'Pobierz napisy z QNapi...'
105 WriteRegStr HKCR SystemFileAssociations\.rm\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
106 WriteRegStr HKCR SystemFileAssociations\.rmvb\shell\qnapi "" 'Pobierz napisy z QNapi...'
107 WriteRegStr HKCR SystemFileAssociations\.rmvb\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
108 WriteRegStr HKCR SystemFileAssociations\.wmv\shell\qnapi "" 'Pobierz napisy z QNapi...'
109 WriteRegStr HKCR SystemFileAssociations\.wmv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
110
111 SectionEnd
112
113 ;Uninstall section
114 Section Uninstall
115
116 ${nsProcess::KillProcess} "qnapi.exe" $R0
117 ${nsProcess::Unload}
118
119 DeleteRegKey HKCR SystemFileAssociations\.asf\shell\qnapi
120 DeleteRegKey HKCR SystemFileAssociations\.avi\shell\qnapi
121 DeleteRegKey HKCR SystemFileAssociations\.divx\shell\qnapi
122 DeleteRegKey HKCR SystemFileAssociations\.mkv\shell\qnapi
123 DeleteRegKey HKCR SystemFileAssociations\.mov\shell\qnapi
124 DeleteRegKey HKCR SystemFileAssociations\.mp4\shell\qnapi
125 DeleteRegKey HKCR SystemFileAssociations\.mpeg\shell\qnapi
126 DeleteRegKey HKCR SystemFileAssociations\.mpg\shell\qnapi
127 DeleteRegKey HKCR SystemFileAssociations\.ogg\shell\qnapi
128 DeleteRegKey HKCR SystemFileAssociations\.ogm\shell\qnapi
129 DeleteRegKey HKCR SystemFileAssociations\.ogv\shell\qnapi
130 DeleteRegKey HKCR SystemFileAssociations\.rm\shell\qnapi
131 DeleteRegKey HKCR SystemFileAssociations\.rmvb\shell\qnapi
132 DeleteRegKey HKCR SystemFileAssociations\.wmv\shell\qnapi
133 DeleteRegKey HKCR SystemFileAssociations\.asf\shell\qnapi
134
135
136 ;Remove from registry...
137 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
138 DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
139
140 ; Delete self
141 Delete "$INSTDIR\uninstall.exe"
142
143 ; Delete Shortcuts
144 Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
145 Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
146
147 ; Clean up test
148
149 ; Remove remaining directories
150 RMDir "$SMPROGRAMS\${APPNAME}"
151 RMDir /r "$INSTDIR\"
152
153 SectionEnd
154
155 ; eof