Nsis Installer script update.
This commit is contained in:
parent
95bfe99e2e
commit
f54e2b8391
1 changed files with 77 additions and 0 deletions
77
webhelper.nsi
Normal file
77
webhelper.nsi
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
!include "MUI2.nsh"
|
||||||
|
|
||||||
|
Unicode true
|
||||||
|
Name "OGBG WebHelper"
|
||||||
|
OutFile "webhelper.exe"
|
||||||
|
InstallDir "X:\path\to\pubg\TslGame\Binaries\Win64"
|
||||||
|
RequestExecutionLevel admin
|
||||||
|
|
||||||
|
!define MUI_ABORTWARNING
|
||||||
|
!define MUI_LANGDLL_ALLLANGUAGES
|
||||||
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_KEY "Software\OGBG WebHelper"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||||
|
|
||||||
|
LangString InvalidDirMessage ${LANG_ENGLISH} "The selected directory does not contain TslGame.exe. Please select a valid directory."
|
||||||
|
LangString InvalidDirMessage ${LANG_SIMPCHINESE} "选择的目录中未找到 TslGame.exe,请选择有效目录。"
|
||||||
|
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function DirectoryValidate
|
||||||
|
IfFileExists "$INSTDIR\TslGame.exe" 0 +2
|
||||||
|
Return
|
||||||
|
MessageBox MB_OK|MB_ICONEXCLAMATION "$(InvalidDirMessage)"
|
||||||
|
Abort
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.DeleteRegKeyRecursive
|
||||||
|
Exch $0
|
||||||
|
|
||||||
|
ClearErrors
|
||||||
|
FindFirst $1 $2 "HKCR\$0\*"
|
||||||
|
StrCmp $1 "" 0 +3
|
||||||
|
FindClose $2
|
||||||
|
Goto done
|
||||||
|
|
||||||
|
loop:
|
||||||
|
Push "$0\$1"
|
||||||
|
Call un.DeleteRegKeyRecursive
|
||||||
|
FindNext $1 $2
|
||||||
|
IfErrors done
|
||||||
|
Goto loop
|
||||||
|
|
||||||
|
done:
|
||||||
|
FindClose $2
|
||||||
|
DeleteRegKey HKCR "$0"
|
||||||
|
Pop $0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Section "Install"
|
||||||
|
Call DirectoryValidate
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File /oname=helper.exe "x64\Debug\helper.exe"
|
||||||
|
|
||||||
|
WriteRegStr HKCR "ogbg" "URL Protocol" ""
|
||||||
|
WriteRegStr HKCR "ogbg" "" "OGBG WebHelper Protocol"
|
||||||
|
WriteRegStr HKCR "ogbg\shell\open\command" "" '"$INSTDIR\helper.exe" "%1"'
|
||||||
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
Delete "$INSTDIR\helper.exe"
|
||||||
|
DeleteRegKey /ifempty HKCR "pubggame"
|
||||||
|
Push "ogbg"
|
||||||
|
Call un.DeleteRegKeyRecursive
|
||||||
|
Exec '"$WINDIR\System32\cmd.exe" /C ping 127.0.0.1 -n 2 > nul & del /f /q "$INSTDIR\Uninstall.exe"'
|
||||||
|
SectionEnd
|
Loading…
Add table
Add a link
Reference in a new issue