HaaliReaderDesktop.nsi
上传用户:hmc_gdtv
上传日期:2013-08-04
资源大小:798k
文件大小:4k
源码类别:

Windows Mobile

开发平台:

Visual C++

  1. ; Default names
  2. !ifndef NAME
  3. !define NAME "Haali Reader"
  4. !endif
  5. !ifndef NSPNAME
  6. !define NSPNAME "HaaliReader"
  7. !endif
  8. !ifndef VENDOR
  9. !define VENDOR "Haali"
  10. !endif
  11. !ifndef VERSION
  12. !define VERSION "2.0"
  13. !endif
  14. Name "${NAME}"
  15. ; Use the new UI
  16. !include "MUI.nsh"
  17. !define MUI_ICON "${NSISDIR}ContribGraphicsIconswin-install.ico"
  18. !define MUI_UNICON "${NSISDIR}ContribGraphicsIconswin-uninstall.ico"
  19. ; The file to write
  20. OutFile "${NAME} v${VERSION} Setup.exe"
  21. ; The default installation directory
  22. InstallDir "$PROGRAMFILES${VENDOR}${NAME}"
  23. InstallDirRegKey HKLM "SOFTWARE${VENDOR}${NSPNAME}" "InstallDir"
  24. ; Insert MUI
  25. !insertmacro MUI_PAGE_WELCOME
  26. !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
  27. !insertmacro MUI_PAGE_DIRECTORY
  28. !insertmacro MUI_PAGE_INSTFILES
  29. !insertmacro MUI_PAGE_FINISH
  30. !insertmacro MUI_UNPAGE_WELCOME
  31. !insertmacro MUI_UNPAGE_CONFIRM
  32. !insertmacro MUI_UNPAGE_INSTFILES
  33. !insertmacro MUI_UNPAGE_FINISH
  34. !insertmacro MUI_LANGUAGE "English"
  35. ; first section, initialize
  36. Section ""
  37.   SetOutPath $INSTDIR
  38.   ; install unicows on win9x
  39.   ReadRegStr $0 HKLM "SOFTWAREMicrosoftWindows NTCurrentVersion" CurrentVersion
  40.   StrCmp $0 "" 0 nthere
  41.   File "....unicowsunicows.dll"
  42. nthere:
  43.   ; create an FB2 progid
  44.   WriteRegStr HKCR "FictionBook.2" "" "FictionBook"
  45.   WriteRegStr HKCR "FictionBook.2CurVer" "" "FictionBook.2"
  46.   ; create an FB2 filetype
  47.   WriteRegStr HKCR ".fb2" "" "FictionBook.2"
  48.   WriteRegStr HKCR ".fb2" "PerceivedType" "Text"
  49.   WriteRegStr HKCR ".fb2" "Content Type" "text/xml"
  50.   File /oname=HaaliReader.exe "HaaliReader.x86.U.exe"
  51.   CreateDirectory "$SMPROGRAMS${NAME}"
  52.   CreateShortCut "$SMPROGRAMS${NAME}Haali Reader.lnk" "$INSTDIRHaaliReader.exe" "" "$INSTDIRHaaliReader.exe" 0
  53.   CreateShortcut "$SMPROGRAMS${NAME}Haali Reader Dictionary.lnk" "$INSTDIRHaaliReader.exe" "-d" "$INSTDIRHaaliReader.exe" 0
  54.   ; register application
  55.   WriteRegStr HKCR "ApplicationsHaaliReader.exe" "FriendlyAppName" "Haali Reader"
  56.   WriteRegStr HKCR "ApplicationsHaaliReader.exeSupportedTypes" ".fb2" ""
  57.   WriteRegStr HKCR "ApplicationsHaaliReader.exeSupportedTypes" ".xml" ""
  58.   WriteRegStr HKCR "ApplicationsshellOpenCommand" "" '"$INSTDIRHaaliReader.exe" "%1"'
  59.   ; register verb
  60.   WriteRegStr HKCR "FictionBook.2shellOpenCommand" "" '"$INSTDIRHaaliReader.exe" "%1"'
  61.   ; Uninstall shortcut
  62.   CreateShortCut "$SMPROGRAMS${NAME}Uninstall.lnk" "$INSTDIRuninstall.exe" "" "$INSTDIRuninstall.exe" 0
  63.   ; Write the installation path into the registry
  64.   WriteRegStr HKLM "SOFTWARE${VENDOR}${NSPNAME}" "InstallDir" "$INSTDIR"
  65.   ; Uninstall info
  66.   WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstall${VENDOR}${NSPNAME}" "DisplayName" "${NAME} ${VERSION} (remove only)"
  67.   WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstall${VENDOR}${NSPNAME}" "UninstallString" '"$INSTDIRuninstall.exe"'
  68.   ; uninstall program
  69.   WriteUninstaller "uninstall.exe"
  70. SectionEnd
  71. Section "Uninstall"
  72.   ; remove registry keys
  73.   DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstall${VENDOR}${NSPNAME}"
  74.   DeleteRegKey HKLM "SOFTWARE${VENDOR}${NSPNAME}"
  75.   DeleteRegValue HKLM "SoftwareMicrosoftIE SetupDependentComponents" "FictionBook Editor"
  76.   ; remove applications
  77.   DeleteRegKey HKCR "ApplicationsFBE.exe"
  78.   ; remove verbs
  79.   DeleteRegKey HKCR "FictionBook.2shellOpen"
  80.   ; remove files
  81.   Delete "$INSTDIRHaaliReader.exe"
  82.   ; MUST REMOVE UNINSTALLER, too
  83.   Delete "$INSTDIRuninstall.exe"
  84.   ; remove shortcuts, if any.
  85.   Delete "$SMPROGRAMS${NAME}*.*"
  86.   ; remove directories used.
  87.   RMDir "$SMPROGRAMS${NAME}"
  88.   RMDir "$INSTDIR"
  89. SectionEnd
  90. ; eof