!include "MUI2.nsh"

!define MUI_ICON "Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "Contrib\Graphics\UGX\banner.bmp"

!define MUI_PAGE_HEADER_TEXT "Welcome to the Boiii Application Setup"
!define MUI_PAGE_HEADER_SUBTEXT "Follow the instructions to install Boiii Application."

!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose the folder in which to install Boiii Application."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Installation Folder"

!define MUI_FINISHPAGE_NOAUTOCLOSE

; Set the default installation directory
InstallDir $PROGRAMFILES\BoiiiApplication

; Welcome page
!insertmacro MUI_PAGE_WELCOME

; Directory page
!insertmacro MUI_PAGE_DIRECTORY

; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

; Finish page
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Name "Boiii Application"
OutFile "BoiiiInstaller.exe"
ShowInstDetails show
ShowUnInstDetails show

Icon "${MUI_ICON}"
BrandingText "Boiii Application Setup"

Var Dialog
Var CreateShortcut

Function MyFinishPageLeave
    ${NSD_GetState} $CreateShortcut $0
    StrCpy $CreateShortcut $0
FunctionEnd

Section "Main Application" SecMain
    SetOutPath $INSTDIR
    File "boiii.exe"
SectionEnd

Section "LocalAppData Files" SecData
    SetOutPath $LOCALAPPDATA\boiii
    File /r "boiii\*.*"
SectionEnd

Section "Create Desktop Shortcut"
    ${If} $CreateShortcut == ${BST_CHECKED}
        CreateShortcut "$DESKTOP\Boiii.lnk" "$INSTDIR\boiii.exe"
    ${EndIf}
SectionEnd

Section "Uninstall"
    Delete $INSTDIR\boiii.exe
    Delete "$DESKTOP\Boiii.lnk"
    RMDir /r $LOCALAPPDATA\boiii
    RMDir $INSTDIR
SectionEnd
