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
|
; Define your application name
!define APPNAME "QNapi"
!define APPVER "0.2.3"
!define APPNAMEANDVERSION "${APPNAME} ${APPVER}"
!include "MUI2.nsh"
!include "nsProcess.nsh"
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\${APPNAME}"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "${APPNAME}-${APPVER}-setup.exe"
SetCompressor LZMA
!define MUI_ICON qnapi-drive.ico
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\qnapi.exe"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "QNapi" Section1
${nsProcess::KillProcess} "qnapi.exe" $R0
${nsProcess::Unload}
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File /r "out\*"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\qnapi.exe"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SectionEnd
Section -FinishSection
; clean up registry keys from qnapi <= 0.1.7
DeleteRegKey HKCR ASFFile\shell\qnapi-pobierz
DeleteRegKey HKCR AVIFile\shell\qnapi-pobierz
DeleteRegKey HKCR divxfile\shell\qnapi-pobierz
DeleteRegKey HKCR mkvfile\shell\qnapi-pobierz
DeleteRegKey HKCR mpegfile\shell\qnapi-pobierz
DeleteRegKey HKCR mpgfile\shell\qnapi-pobierz
DeleteRegKey HKCR RealPlayer.RA.6\shell\qnapi-pobierz
DeleteRegKey HKCR RealPlayer.RAM.6\shell\qnapi-pobierz
DeleteRegKey HKCR RealPlayer.RM.6\shell\qnapi-pobierz
DeleteRegKey HKCR RealPlayer.RMVB.6\shell\qnapi-pobierz
DeleteRegKey HKCR rmvbfile\shell\qnapi-pobierz
DeleteRegKey HKCR WMP11.AssocFile.ASF\shell\qnapi-pobierz
DeleteRegKey HKCR WMP11.AssocFile.AVI\shell\qnapi-pobierz
DeleteRegKey HKCR WMP11.AssocFile.MPEG\shell\qnapi-pobierz
DeleteRegKey HKCR WMP11.AssocFile.WMV\shell\qnapi-pobierz
DeleteRegKey HKCR WMVFile\shell\qnapi-pobierz
WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKCR SystemFileAssociations\.asf\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.asf\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.avi\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.avi\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.divx\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.divx\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.mkv\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.mkv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.mov\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.mov\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.mp4\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.mp4\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.mpeg\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.mpeg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.mpg\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.mpg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.ogg\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.ogg\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.ogm\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.ogm\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.ogv\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.ogv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.rm\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.rm\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.rmvb\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.rmvb\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
WriteRegStr HKCR SystemFileAssociations\.wmv\shell\qnapi "" 'Pobierz napisy z QNapi...'
WriteRegStr HKCR SystemFileAssociations\.wmv\shell\qnapi\command "" '"$INSTDIR\qnapi.exe" "%1"'
SectionEnd
;Uninstall section
Section Uninstall
${nsProcess::KillProcess} "qnapi.exe" $R0
${nsProcess::Unload}
DeleteRegKey HKCR SystemFileAssociations\.asf\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.avi\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.divx\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.mkv\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.mov\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.mp4\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.mpeg\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.mpg\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.ogg\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.ogm\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.ogv\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.rm\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.rmvb\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.wmv\shell\qnapi
DeleteRegKey HKCR SystemFileAssociations\.asf\shell\qnapi
;Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
; Delete self
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
; Clean up test
; Remove remaining directories
RMDir "$SMPROGRAMS\${APPNAME}"
RMDir /r "$INSTDIR\"
SectionEnd
; eof
|