Skip to content

Commit a704220

Browse files
committed
Add NSI installer script
This should provide more consistency on future releases and a better usage of the capabilities of the NSIS script language, foregoing of the zip based installer
1 parent cedd019 commit a704220

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

UWPHook.nsi

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
############################################################################################
2+
# NSIS Installation Script created by NSIS Quick Setup Script Generator v1.09.18
3+
# Entirely Edited with NullSoft Scriptable Installation System
4+
# by Vlasis K. Barkas aka Red Wine [email protected] Sep 2006
5+
############################################################################################
6+
#
7+
# Edited by Briano 🤔
8+
#
9+
############################################################################################
10+
11+
!define APP_NAME "UWPHook"
12+
!define COMP_NAME "Briano"
13+
!define WEB_SITE "https://briano.dev"
14+
!define VERSION "2.7.00.00"
15+
!define COPYRIGHT "Briano � 2020"
16+
!define DESCRIPTION "The easy way to add UWP and XGP games to Steam"
17+
!define LICENSE_TXT "C:\Users\Brian\Documents\GitHub\UWPHook\README.md"
18+
!define INSTALLER_NAME "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook.exe"
19+
!define MAIN_APP_EXE "UWPHook.exe"
20+
!define INSTALL_TYPE "SetShellVarContext current"
21+
!define REG_ROOT "HKCU"
22+
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
23+
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
24+
25+
!define REG_START_MENU "Start Menu Folder"
26+
27+
var SM_Folder
28+
29+
######################################################################
30+
31+
VIProductVersion "${VERSION}"
32+
VIAddVersionKey "ProductName" "${APP_NAME}"
33+
VIAddVersionKey "CompanyName" "${COMP_NAME}"
34+
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
35+
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
36+
VIAddVersionKey "FileVersion" "${VERSION}"
37+
38+
######################################################################
39+
40+
SetCompressor ZLIB
41+
Name "${APP_NAME}"
42+
Caption "${APP_NAME}"
43+
OutFile "${INSTALLER_NAME}"
44+
BrandingText "${APP_NAME}"
45+
XPStyle on
46+
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
47+
InstallDir "$PROGRAMFILES\Briano\UWPHook"
48+
49+
######################################################################
50+
51+
!include "MUI.nsh"
52+
53+
!define MUI_ABORTWARNING
54+
!define MUI_UNABORTWARNING
55+
56+
!insertmacro MUI_PAGE_WELCOME
57+
58+
!ifdef LICENSE_TXT
59+
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
60+
!endif
61+
62+
!insertmacro MUI_PAGE_DIRECTORY
63+
64+
!ifdef REG_START_MENU
65+
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "UWPHook"
66+
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
67+
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
68+
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
69+
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
70+
!endif
71+
72+
!insertmacro MUI_PAGE_INSTFILES
73+
74+
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}"
75+
!insertmacro MUI_PAGE_FINISH
76+
77+
!insertmacro MUI_UNPAGE_CONFIRM
78+
79+
!insertmacro MUI_UNPAGE_INSTFILES
80+
81+
!insertmacro MUI_UNPAGE_FINISH
82+
83+
!insertmacro MUI_LANGUAGE "English"
84+
85+
######################################################################
86+
87+
Section -MainProgram
88+
${INSTALL_TYPE}
89+
SetOverwrite ifnewer
90+
SetOutPath "$INSTDIR"
91+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\MaterialDesignColors.dll"
92+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\MaterialDesignThemes.Wpf.dll"
93+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\MaterialDesignThemes.Wpf.xml"
94+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Microsoft.Management.Infrastructure.dll"
95+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\SharpSteam.dll"
96+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Management.Automation.dll"
97+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Management.Automation.xml"
98+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\UWPHook.exe"
99+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\UWPHook.exe.config"
100+
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\VDFParser.dll"
101+
SectionEnd
102+
103+
######################################################################
104+
105+
Section -Icons_Reg
106+
SetOutPath "$INSTDIR"
107+
WriteUninstaller "$INSTDIR\uninstall.exe"
108+
109+
!ifdef REG_START_MENU
110+
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
111+
CreateDirectory "$SMPROGRAMS\$SM_Folder"
112+
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
113+
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
114+
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
115+
116+
!ifdef WEB_SITE
117+
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
118+
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
119+
!endif
120+
!insertmacro MUI_STARTMENU_WRITE_END
121+
!endif
122+
123+
!ifndef REG_START_MENU
124+
CreateDirectory "$SMPROGRAMS\UWPHook"
125+
CreateShortCut "$SMPROGRAMS\UWPHook\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
126+
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
127+
CreateShortCut "$SMPROGRAMS\UWPHook\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
128+
129+
!ifdef WEB_SITE
130+
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
131+
CreateShortCut "$SMPROGRAMS\UWPHook\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
132+
!endif
133+
!endif
134+
135+
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
136+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
137+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
138+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
139+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
140+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
141+
142+
!ifdef WEB_SITE
143+
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
144+
!endif
145+
SectionEnd
146+
147+
######################################################################
148+
149+
Section Uninstall
150+
${INSTALL_TYPE}
151+
Delete "$INSTDIR\MaterialDesignColors.dll"
152+
Delete "$INSTDIR\MaterialDesignThemes.Wpf.dll"
153+
Delete "$INSTDIR\MaterialDesignThemes.Wpf.xml"
154+
Delete "$INSTDIR\Microsoft.Management.Infrastructure.dll"
155+
Delete "$INSTDIR\SharpSteam.dll"
156+
Delete "$INSTDIR\System.Management.Automation.dll"
157+
Delete "$INSTDIR\System.Management.Automation.xml"
158+
Delete "$INSTDIR\UWPHook.exe"
159+
Delete "$INSTDIR\UWPHook.exe.config"
160+
Delete "$INSTDIR\VDFParser.dll"
161+
Delete "$INSTDIR\uninstall.exe"
162+
!ifdef WEB_SITE
163+
Delete "$INSTDIR\${APP_NAME} website.url"
164+
!endif
165+
166+
RmDir "$INSTDIR"
167+
168+
!ifdef REG_START_MENU
169+
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
170+
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
171+
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk"
172+
!ifdef WEB_SITE
173+
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk"
174+
!endif
175+
Delete "$DESKTOP\${APP_NAME}.lnk"
176+
177+
RmDir "$SMPROGRAMS\$SM_Folder"
178+
!endif
179+
180+
!ifndef REG_START_MENU
181+
Delete "$SMPROGRAMS\UWPHook\${APP_NAME}.lnk"
182+
Delete "$SMPROGRAMS\UWPHook\Uninstall ${APP_NAME}.lnk"
183+
!ifdef WEB_SITE
184+
Delete "$SMPROGRAMS\UWPHook\${APP_NAME} Website.lnk"
185+
!endif
186+
Delete "$DESKTOP\${APP_NAME}.lnk"
187+
188+
RmDir "$SMPROGRAMS\UWPHook"
189+
!endif
190+
191+
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
192+
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
193+
SectionEnd
194+
195+
######################################################################

0 commit comments

Comments
 (0)