@echo off
REM ##############################################
echo Deleting firewall rules (old names).
netsh advfirewall firewall delete rule name=NxFilter_53_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_80_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_443_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_19002_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_19003_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_19004_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP19004_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_19003_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_19004_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP19004_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_1813_in > NUL
REM ##############################################
echo Deleting firewall rules (new names).
netsh advfirewall firewall delete rule name=NxFilter_UDP_53_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_80_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_443_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_19002_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_19003_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_19004_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_19003_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_TCP_19004_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP_19004_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP_19004_out > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP_1813_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP_67_in > NUL
netsh advfirewall firewall delete rule name=NxFilter_UDP_68_out > NUL
REM ##############################################
set BPATH=%~dp0
cd %BPATH%
cd ..
REM ##############################################
set /p APPNAME=<conf\appname
net stop %APPNAME%
nxwrapper.exe remove
cd bin