@echo off

:: Set INSTALLDIR
set INSTALLDIR="D:\TWS4"

IF NOT EXIST %INSTALLDIR% set INSTALLDIR="%ProgramFiles%\TWS4"
IF NOT EXIST %INSTALLDIR% set INSTALLDIR="%ProgramFiles(x86)%\TWS4"
IF NOT EXIST %INSTALLDIR% (

	echo TWS4 install directory not found
	pause
	exit
)

:: Go to the script path

cd /D %~dp0

:: Set Patch Version
set PATCH_VERSION=4.3.1821.110vad
set PATCH_ADDON_VERSION=431950.r1441

echo -----------------------------------------
echo            PATCH %PATCH_VERSION%
echo         PATCH %PATCH_ADDON_VERSION%
echo -----------------------------------------
echo.
pause

echo.
echo ------------------ APPLYING PATCH ...
echo.

:: Copy files
xcopy "%CD%\data\*" %INSTALLDIR%\ /S /Y /Q

::Change version
ChangeVersion XmlServer %INSTALLDIR% %PATCH_VERSION%
ChangeVersion XmlAddon %INSTALLDIR% %PATCH_ADDON_VERSION%

echo.
echo ------------------ PATCH APPLIED
echo.

pause
