haalireaderdesktop.nsi
来自「俄罗斯人开发的大名鼎鼎的Pocket Pc 阅读器haaliread的源代码,v」· NSI 代码 · 共 116 行
NSI
116 行
; Default names
!ifndef NAME
!define NAME "Haali Reader"
!endif
!ifndef NSPNAME
!define NSPNAME "HaaliReader"
!endif
!ifndef VENDOR
!define VENDOR "Haali"
!endif
!ifndef VERSION
!define VERSION "2.0"
!endif
Name "${NAME}"
; Use the new UI
!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
; The file to write
OutFile "${NAME} v${VERSION} Setup.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\${VENDOR}\${NAME}"
InstallDirRegKey HKLM "SOFTWARE\${VENDOR}\${NSPNAME}" "InstallDir"
; Insert MUI
!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_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
; first section, initialize
Section ""
SetOutPath $INSTDIR
; install unicows on win9x
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 nthere
File "..\..\unicows\unicows.dll"
nthere:
; create an FB2 progid
WriteRegStr HKCR "FictionBook.2" "" "FictionBook"
WriteRegStr HKCR "FictionBook.2\CurVer" "" "FictionBook.2"
; create an FB2 filetype
WriteRegStr HKCR ".fb2" "" "FictionBook.2"
WriteRegStr HKCR ".fb2" "PerceivedType" "Text"
WriteRegStr HKCR ".fb2" "Content Type" "text/xml"
File /oname=HaaliReader.exe "HaaliReader.x86.U.exe"
CreateDirectory "$SMPROGRAMS\${NAME}"
CreateShortCut "$SMPROGRAMS\${NAME}\Haali Reader.lnk" "$INSTDIR\HaaliReader.exe" "" "$INSTDIR\HaaliReader.exe" 0
CreateShortcut "$SMPROGRAMS\${NAME}\Haali Reader Dictionary.lnk" "$INSTDIR\HaaliReader.exe" "-d" "$INSTDIR\HaaliReader.exe" 0
; register application
WriteRegStr HKCR "Applications\HaaliReader.exe" "FriendlyAppName" "Haali Reader"
WriteRegStr HKCR "Applications\HaaliReader.exe\SupportedTypes" ".fb2" ""
WriteRegStr HKCR "Applications\HaaliReader.exe\SupportedTypes" ".xml" ""
WriteRegStr HKCR "Applications\shell\Open\Command" "" '"$INSTDIR\HaaliReader.exe" "%1"'
; register verb
WriteRegStr HKCR "FictionBook.2\shell\Open\Command" "" '"$INSTDIR\HaaliReader.exe" "%1"'
; Uninstall shortcut
CreateShortCut "$SMPROGRAMS\${NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${VENDOR}\${NSPNAME}" "InstallDir" "$INSTDIR"
; Uninstall info
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VENDOR}${NSPNAME}" "DisplayName" "${NAME} ${VERSION} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VENDOR}${NSPNAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
; uninstall program
WriteUninstaller "uninstall.exe"
SectionEnd
Section "Uninstall"
; remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VENDOR}${NSPNAME}"
DeleteRegKey HKLM "SOFTWARE\${VENDOR}\${NSPNAME}"
DeleteRegValue HKLM "Software\Microsoft\IE Setup\DependentComponents" "FictionBook Editor"
; remove applications
DeleteRegKey HKCR "Applications\FBE.exe"
; remove verbs
DeleteRegKey HKCR "FictionBook.2\shell\Open"
; remove files
Delete "$INSTDIR\HaaliReader.exe"
; MUST REMOVE UNINSTALLER, too
Delete "$INSTDIR\uninstall.exe"
; remove shortcuts, if any.
Delete "$SMPROGRAMS\${NAME}\*.*"
; remove directories used.
RMDir "$SMPROGRAMS\${NAME}"
RMDir "$INSTDIR"
SectionEnd
; eof
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?