Skip to content

Commit

Permalink
installer
Browse files Browse the repository at this point in the history
  • Loading branch information
andro2157 authored Jun 12, 2021
1 parent 744d6be commit 4e47344
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@echo off
title Discord Token Protector Installer
echo ==========================================================
echo Discord Token Protector Installer
echo Dev build.
echo By Andro24
echo ==========================================================
echo.

set "workingPath=%APPDATA%\DiscordTokenProtector\"

if exist "%workingPath%\DiscordTokenProtector.exe" goto oldInstall
if exist "%workingPath%\glfw3.dll" goto oldInstall
if exist "%workingPath%\ProtectionPayload.dll" goto oldInstall

call :checkExists DiscordTokenProtector.exe
call :checkExists glfw3.dll
call :checkExists ProtectionPayload.dll

call :install
echo Installation complete!
:end
pause
exit

:oldInstall
echo An old installation has been detected.
echo Would you like to (R)emove it or (U)pdate it?
choice /C RU
if %errorlevel%==1 call :removeOld
if %errorlevel%==2 call :update
goto end

:install
if not exist "%workingPath%" md "%workingPath%"
echo Copying new files...
copy DiscordTokenProtector.exe "%workingPath%\DiscordTokenProtector.exe"
copy glfw3.dll "%workingPath%\glfw3.dll"
copy ProtectionPayload.dll "%workingPath%\ProtectionPayload.dll"
echo Done.
echo.
exit /b

:update
call :removeOld
call :install
exit /b

:removeOld
echo Removing old versions...
call :removeOld "%workingPath%\DiscordTokenProtector.exe"
call :removeOld "%workingPath%\glfw3.dll"
call :removeOld "%workingPath%\ProtectionPayload.dll"
echo Done.
echo.
exit /b

REM arg : filepath
:removeOld
if exist %1 (
del %1>nul
echo Detected an old installation of %1. Removed.
)
exit /b
REM arg : filepath
:checkExists
if not exist %1 (
echo %1 is missing. Please redownload it.
exit
)
exit /b

0 comments on commit 4e47344

Please sign in to comment.