mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 14:23:51 +02:00
* Initial .NET8 Upgrade * Initial GitHub Actions Cleanup * Fix Desktop Notifications * Fix throw warning * Upgrade vunerable transative nuget packages * Fix warnings with registry overflow * Adjust async/await usage for configRepository * Fix TTS voice name and app auto start * Install .NET 8 with setup I regret NSIS * Remove no longer needed System/MS references (included in dotnet sdk) * Surpress stackalloc in loop warning, that code scares me. * Removed unused SharpDX packages * Ignore WebClient warning, hopefully this project doesn't move past NET 8 * Fixed terrifying code * GenerateAssemblyInfo * Trimmed editor config to only silence warning. * Fix open webpage * Fix updater --------- Co-authored-by: DubyaDude <ushafiq141@gmail.com> Co-authored-by: Natsumi <cmcooper123@hotmail.com>
225 lines
6.9 KiB
NSIS
225 lines
6.9 KiB
NSIS
;--------------------------------
|
|
;Plugins
|
|
;https://nsis.sourceforge.io/ApplicationID_plug-in
|
|
;https://nsis.sourceforge.io/ShellExecAsUser_plug-in
|
|
;https://nsis.sourceforge.io/NsProcess_plugin
|
|
;https://nsis.sourceforge.io/Inetc_plug-in
|
|
|
|
;--------------------------------
|
|
;Version
|
|
|
|
!define PRODUCT_VERSION "1.0.0.0"
|
|
!define VERSION "1.0.0.0"
|
|
VIProductVersion "${PRODUCT_VERSION}"
|
|
VIFileVersion "${VERSION}"
|
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
|
VIAddVersionKey "ProductName" "VRCX"
|
|
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
|
|
VIAddVersionKey "LegalCopyright" "Copyright vrcx-team, pypy, natsumi"
|
|
VIAddVersionKey "FileDescription" "Friendship management tool for VRChat"
|
|
|
|
;--------------------------------
|
|
;Include Modern UI
|
|
|
|
!include "MUI2.nsh"
|
|
!include "FileFunc.nsh"
|
|
!include "LogicLib.nsh"
|
|
|
|
;--------------------------------
|
|
;General
|
|
|
|
Unicode True
|
|
Name "VRCX"
|
|
OutFile "VRCX_Setup.exe"
|
|
InstallDir "$PROGRAMFILES64\VRCX"
|
|
InstallDirRegKey HKLM "Software\VRCX" "InstallDir"
|
|
RequestExecutionLevel admin
|
|
ShowInstDetails show
|
|
|
|
;--------------------------------
|
|
;Variables
|
|
|
|
VAR upgradeInstallation
|
|
|
|
;--------------------------------
|
|
;Interface Settings
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
;--------------------------------
|
|
;Icons
|
|
|
|
!define MUI_ICON "../VRCX.ico"
|
|
!define MUI_UNICON "../VRCX.ico"
|
|
|
|
;--------------------------------
|
|
;Pages
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "..\LICENSE"
|
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
;------------------------------
|
|
; Finish Page
|
|
|
|
; Checkbox to launch VRCX.
|
|
!define MUI_FINISHPAGE_RUN
|
|
!define MUI_FINISHPAGE_RUN_TEXT "Launch VRCX"
|
|
!define MUI_FINISHPAGE_RUN_FUNCTION launchVRCX
|
|
|
|
; Checkbox to create desktop shortcut.
|
|
!define MUI_FINISHPAGE_SHOWREADME
|
|
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create desktop shortcut"
|
|
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createDesktopShortcut
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
!insertmacro MUI_UNPAGE_FINISH
|
|
|
|
;--------------------------------
|
|
;Languages
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
;--------------------------------
|
|
;Macros
|
|
|
|
;--------------------------------
|
|
;Functions
|
|
|
|
Function dirPre
|
|
StrCmp $upgradeInstallation "true" 0 +2
|
|
Abort
|
|
FunctionEnd
|
|
|
|
Function .onInit
|
|
StrCpy $upgradeInstallation "false"
|
|
|
|
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX" "UninstallString"
|
|
StrCmp $R0 "" done
|
|
|
|
; If VRCX is already running, display a warning message
|
|
StrCpy $1 "VRCX.exe"
|
|
nsProcess::_FindProcess "$1"
|
|
Pop $R1
|
|
${If} $R1 = 0
|
|
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "VRCX is still running. $\n$\nClick `OK` to kill the running process or `Cancel` to cancel this installer." /SD IDOK IDCANCEL cancel
|
|
nsExec::ExecToStack "taskkill /IM VRCX.exe"
|
|
${EndIf}
|
|
|
|
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "VRCX is already installed. $\n$\nClick `OK` to upgrade the existing installation or `Cancel` to cancel this upgrade." /SD IDOK IDCANCEL cancel
|
|
Goto next
|
|
cancel:
|
|
Abort
|
|
next:
|
|
StrCpy $upgradeInstallation "true"
|
|
done:
|
|
FunctionEnd
|
|
|
|
Function CheckAndInstallDotNet
|
|
nsExec::ExecToStack /OEM 'cmd /c dir "%windir%\system32" | dotnet --list-runtimes | find /c /i "Microsoft.NETCore.App 8"'
|
|
Pop $0
|
|
Pop $1
|
|
StrCpy $2 $1 1
|
|
StrCmp $2 "1" 0 version_not_found
|
|
goto version_found
|
|
version_not_found:
|
|
inetc::get "https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe" $TEMP\dotnet-runtime-win-x64.exe
|
|
ExecWait "$TEMP\dotnet-runtime-win-x64.exe /install /quiet /norestart"
|
|
Delete "$TEMP\dotnet-runtime-win-x64.exe"
|
|
version_found:
|
|
FunctionEnd
|
|
|
|
Function createDesktopShortcut
|
|
CreateShortcut "$DESKTOP\VRCX.lnk" "$INSTDIR\VRCX.exe"
|
|
FunctionEnd
|
|
|
|
Function launchVRCX
|
|
SetOutPath $INSTDIR
|
|
ShellExecAsUser::ShellExecAsUser "" "$INSTDIR\VRCX.exe" ""
|
|
FunctionEnd
|
|
|
|
;--------------------------------
|
|
;Installer Sections
|
|
|
|
Section "Install" SecInstall
|
|
|
|
StrCmp $upgradeInstallation "true" 0 noupgrade
|
|
DetailPrint "Uninstall previous version..."
|
|
ExecWait '"$INSTDIR\Uninstall.exe" /S _?=$INSTDIR'
|
|
Delete $INSTDIR\Uninstall.exe
|
|
Goto afterupgrade
|
|
|
|
noupgrade:
|
|
|
|
afterupgrade:
|
|
|
|
ReadRegStr $R0 HKLM "SOFTWARE\Classes\Installer\Dependencies\Microsoft.VS.VC_RuntimeMinimumVSU_amd64,v14" "Version"
|
|
IfErrors 0 VSRedistInstalled
|
|
|
|
inetc::get "https://aka.ms/vs/17/release/vc_redist.x64.exe" $TEMP\vcredist_x64.exe
|
|
ExecWait "$TEMP\vcredist_x64.exe /install /quiet /norestart"
|
|
Delete "$TEMP\vcredist_x64.exe"
|
|
VSRedistInstalled:
|
|
|
|
Call CheckAndInstallDotNet
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
File /r /x *.log /x *.pdb "..\bin\x64\Release\*.*"
|
|
|
|
WriteRegStr HKLM "Software\VRCX" "InstallDir" $INSTDIR
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX" "DisplayName" "VRCX"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX" "DisplayIcon" "$\"$INSTDIR\VRCX.ico$\""
|
|
|
|
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
|
IntFmt $0 "0x%08X" $0
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX" "EstimatedSize" "$0"
|
|
|
|
CreateShortCut "$SMPROGRAMS\VRCX.lnk" "$INSTDIR\VRCX.exe"
|
|
ApplicationID::Set "$SMPROGRAMS\VRCX.lnk" "VRCX"
|
|
|
|
WriteRegStr HKCU "Software\Classes\vrcx" "" "URL:vrcx"
|
|
WriteRegStr HKCU "Software\Classes\vrcx" "FriendlyTypeName" "VRCX"
|
|
WriteRegStr HKCU "Software\Classes\vrcx" "URL Protocol" ""
|
|
WriteRegExpandStr HKCU "Software\Classes\vrcx\DefaultIcon" "" "$INSTDIR\VRCX.ico"
|
|
WriteRegStr HKCU "Software\Classes\vrcx\shell" "" "open"
|
|
WriteRegStr HKCU "Software\Classes\vrcx\shell\open" "FriendlyAppName" "VRCX"
|
|
WriteRegStr HKCU "Software\Classes\vrcx\shell\open\command" "" '"$INSTDIR\VRCX.exe" /uri="%1" /params="%2 %3 %4"'
|
|
|
|
${If} ${Silent}
|
|
SetOutPath $INSTDIR
|
|
ShellExecAsUser::ShellExecAsUser "" "$INSTDIR\VRCX.exe" ""
|
|
${EndIf}
|
|
|
|
SectionEnd
|
|
|
|
;--------------------------------
|
|
;Uninstaller Section
|
|
|
|
Section "Uninstall"
|
|
; If VRCX is already running, display a warning message and exit
|
|
StrCpy $1 "VRCX.exe"
|
|
nsProcess::_FindProcess "$1"
|
|
Pop $R1
|
|
${If} $R1 = 0
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "VRCX is still running. Cannot uninstall this software.$\nPlease close VRCX and try again." /SD IDOK
|
|
Abort
|
|
${EndIf}
|
|
|
|
RMDir /r "$INSTDIR"
|
|
|
|
DeleteRegKey HKLM "Software\VRCX"
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCX"
|
|
DeleteRegKey HKCU "Software\Classes\vrcx"
|
|
|
|
${IfNot} ${Silent}
|
|
Delete "$SMPROGRAMS\VRCX.lnk"
|
|
Delete "$DESKTOP\VRCX.lnk"
|
|
${EndIf}
|
|
SectionEnd
|