Subversion Repositories Games.Chess Giants

Rev

Rev 55 | Blame | Last modification | View Log | Download | RSS feed

!include "MUI2.nsh"
!include "FileFunc.nsh"

!define PRODUCT_NAME "Chess Giants"
!define PUBLISHER "Pierre-Marie Baty"
!define PUBLISHER_WEBSITE "http://www.pmbaty.com/chess/"
!define INSTALLER_SRC "C:\Users\Pierre-Marie Baty\Documents\Mes projets\Chess Giants"

Name "${PRODUCT_NAME}"
OutFile "C:\Users\Pierre-Marie Baty\Documents\Mes projets\www.pmbaty.com\chess\Chess Giants Installer.exe"
BrandingText "${PRODUCT_NAME} by ${PUBLISHER} - ${PUBLISHER_WEBSITE}"

SetCompressor lzma
RequestExecutionLevel user

AllowRootDirInstall true
InstallDir "$LOCALAPPDATA\${PRODUCT_NAME}"

!define MUI_ICON "${INSTALLER_SRC}\resource\installer.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}\resource\installer.bmp"
!define MUI_ABORTWARNING

!insertmacro MUI_PAGE_LICENSE "${INSTALLER_SRC}\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
AutoCloseWindow true

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

Section ""
        SetOutPath "$INSTDIR"

        File /r "${INSTALLER_SRC}\data"
        File /r "${INSTALLER_SRC}\engines"
        File /r "${INSTALLER_SRC}\helpfiles"
        File /r "${INSTALLER_SRC}\themes"
        File "${INSTALLER_SRC}\*.pgn"
        File "${INSTALLER_SRC}\${PRODUCT_NAME}.exe"
        File "${INSTALLER_SRC}\${PRODUCT_NAME}.exe.manifest"
        File "${INSTALLER_SRC}\Chess Giants (English).html"
        File "${INSTALLER_SRC}\Chess Giants (French).html"
        File "${INSTALLER_SRC}\config.ini"
        File "${INSTALLER_SRC}\materials.cfg"
        File "${INSTALLER_SRC}\d3dx9_42.dll"
        File "${INSTALLER_SRC}\msvcr90.dll"

        CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "" "" "" "" "Start a chess game"
        CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
        CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "" "" "" "" "Start a chess game"
        CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Documentation (English).lnk" "$INSTDIR\Chess Giants (English).html" "" "" "" "" "" "Read the software documentation in English"
        CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Documentation (Français).lnk" "$INSTDIR\Chess Giants (French).html" "" "" "" "" "" "Read the software documentation in French"

        WriteRegStr HKCU "Software\Classes\.pgn" "" "ChessGiantsPGN"
        WriteRegStr HKCU "Software\Classes\ChessGiantsPGN" "" "Portable Game Notation"
;       WriteRegStr HKCU "Software\Classes\ChessGiantsPGN\DefaultIcon" "" "$INSTDIR\${PRODUCT_NAME}.exe,1"
        WriteRegStr HKCU "Software\Classes\ChessGiantsPGN\shell\open\command" "" '"$INSTDIR\${PRODUCT_NAME}.exe" "%1"'

        WriteRegStr HKCU "Software\Classes\.fen" "" "ChessGiantsFEN"
        WriteRegStr HKCU "Software\Classes\ChessGiantsFEN" "" "Forsyth-Edwards Notation"
;       WriteRegStr HKCU "Software\Classes\ChessGiantsFEN\DefaultIcon" "" "$INSTDIR\${PRODUCT_NAME}.exe,1"
        WriteRegStr HKCU "Software\Classes\ChessGiantsFEN\shell\open\command" "" '"$INSTDIR\${PRODUCT_NAME}.exe" "%1"'

        WriteUninstaller $INSTDIR\uninstall.exe
        WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
        WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}.exe,0"
        WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
        WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
        WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PUBLISHER}"
        WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1
        WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1
        ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
        IntFmt $0 "0x%08X" $0
        WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "EstimatedSize" "$0"

        Exec '"$WINDIR\explorer.exe" "$INSTDIR\${PRODUCT_NAME}.exe"'
SectionEnd

Section "Uninstall"
        DeleteRegKey HKCU "Software\Classes\.pgn"
        DeleteRegKey HKCU "Software\Classes\ChessGiantsPGN"
        DeleteRegKey HKCU "Software\Classes\.fen"
        DeleteRegKey HKCU "Software\Classes\ChessGiantsFEN"

        Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
        RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}"
        RMDir /r "$INSTDIR"

        DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
SectionEnd