@echo off
set xxxsrc=bin
if %1==install3 goto install3
if %1==install2 goto install2
if %1==install goto install1
if %1==remove goto remove
if %1==regir50 goto regir50
goto end

:install3
set xxxcount=3

set xxxmsg=Installing...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo.
echo %xxxmsg%
if not exist %xxxdst% mkdir %xxxdst%

xcopy /e /v /i /h /r /y "%xxxsrc%\CustomProfile" "%xxxdst%\CustomProfile">nul
echo 5%%
xcopy /e /v /i /h /r /y "%xxxsrc%\dialog_pic" "%xxxdst%\dialog_pic">nul
echo 10%%
xcopy /e /v /i /h /r /y "%xxxsrc%\event_viewer_pic" "%xxxdst%\event_viewer_pic">nul
echo 15%%
xcopy /e /v /i /h /r /y "%xxxsrc%\pic" "%xxxdst%\pic">nul
echo 20%%
xcopy /e /v /i /h /r /y "%xxxsrc%\player_pic" "%xxxdst%\player_pic">nul
echo 25%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_pic" "%xxxdst%\ptz_pic">nul
echo 30%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_plugin" "%xxxdst%\ptz_plugin">nul
echo 35%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Resource" "%xxxdst%\Resource">nul
echo 40%%
xcopy /e /v /i /h /r /y "%xxxsrc%\SmartSearchPic" "%xxxdst%\SmartSearchPic">nul
echo 45%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Web" "%xxxdst%\Web">nul
echo 50%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ocx" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.del" "%xxxdst%">nul
echo 55%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dil" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hm" "%xxxdst%">nul
echo 60%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hpf" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.mpf" "%xxxdst%">nul
echo 65%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.raw" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.wav" "%xxxdst%">nul
echo 70%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.yuv" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ini" "%xxxdst%">nul
echo 75%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.cur" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.avi" "%xxxdst%">nul
echo 80%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ico" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.exe" "%xxxdst%">nul
echo 90%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dll" "%xxxdst%">nul
echo 99%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.bmp" "%xxxdst%">nul

xcopy /v /r /y "temp\%xxxdst%\server.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Live.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Player.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\FilterGraph.ini" "%xxxdst%">nul
echo 100%%

:install2
set xxxcount=2

set xxxmsg=Installing...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo.
echo %xxxmsg%
if not exist %xxxdst% mkdir %xxxdst%

xcopy /e /v /i /h /r /y "%xxxsrc%\CustomProfile" "%xxxdst%\CustomProfile">nul
echo 5%%
xcopy /e /v /i /h /r /y "%xxxsrc%\dialog_pic" "%xxxdst%\dialog_pic">nul
echo 10%%
xcopy /e /v /i /h /r /y "%xxxsrc%\event_viewer_pic" "%xxxdst%\event_viewer_pic">nul
echo 15%%
xcopy /e /v /i /h /r /y "%xxxsrc%\pic" "%xxxdst%\pic">nul
echo 20%%
xcopy /e /v /i /h /r /y "%xxxsrc%\player_pic" "%xxxdst%\player_pic">nul
echo 25%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_pic" "%xxxdst%\ptz_pic">nul
echo 30%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_plugin" "%xxxdst%\ptz_plugin">nul
echo 35%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Resource" "%xxxdst%\Resource">nul
echo 40%%
xcopy /e /v /i /h /r /y "%xxxsrc%\SmartSearchPic" "%xxxdst%\SmartSearchPic">nul
echo 45%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Web" "%xxxdst%\Web">nul
echo 50%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ocx" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.del" "%xxxdst%">nul
echo 55%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dil" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hm" "%xxxdst%">nul
echo 60%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hpf" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.mpf" "%xxxdst%">nul
echo 65%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.raw" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.wav" "%xxxdst%">nul
echo 70%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.yuv" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ini" "%xxxdst%">nul
echo 75%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.cur" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.avi" "%xxxdst%">nul
echo 80%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ico" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.exe" "%xxxdst%">nul
echo 90%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dll" "%xxxdst%">nul
echo 99%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.bmp" "%xxxdst%">nul

xcopy /v /r /y "temp\%xxxdst%\server.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Live.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Player.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\FilterGraph.ini" "%xxxdst%">nul
echo 100%%

:install1
set xxxcount=1

:install

set xxxmsg=Installing...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo.
echo %xxxmsg%
if not exist %xxxdst% mkdir %xxxdst%

xcopy /e /v /i /h /r /y "%xxxsrc%\CustomProfile" "%xxxdst%\CustomProfile">nul
echo 5%%
xcopy /e /v /i /h /r /y "%xxxsrc%\dialog_pic" "%xxxdst%\dialog_pic">nul
echo 10%%
xcopy /e /v /i /h /r /y "%xxxsrc%\event_viewer_pic" "%xxxdst%\event_viewer_pic">nul
echo 15%%
xcopy /e /v /i /h /r /y "%xxxsrc%\pic" "%xxxdst%\pic">nul
echo 20%%
xcopy /e /v /i /h /r /y "%xxxsrc%\player_pic" "%xxxdst%\player_pic">nul
echo 25%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_pic" "%xxxdst%\ptz_pic">nul
echo 30%%
xcopy /e /v /i /h /r /y "%xxxsrc%\ptz_plugin" "%xxxdst%\ptz_plugin">nul
echo 35%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Resource" "%xxxdst%\Resource">nul
echo 40%%
xcopy /e /v /i /h /r /y "%xxxsrc%\SmartSearchPic" "%xxxdst%\SmartSearchPic">nul
echo 45%%
xcopy /e /v /i /h /r /y "%xxxsrc%\Web" "%xxxdst%\Web">nul
echo 50%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ocx" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.del" "%xxxdst%">nul
echo 55%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dil" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hm" "%xxxdst%">nul
echo 60%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.hpf" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.mpf" "%xxxdst%">nul
echo 65%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.raw" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.wav" "%xxxdst%">nul
echo 70%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.yuv" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ini" "%xxxdst%">nul
echo 75%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.cur" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.avi" "%xxxdst%">nul
echo 80%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.ico" "%xxxdst%">nul
xcopy /e /v /i /h /r /y "%xxxsrc%\*.exe" "%xxxdst%">nul
echo 90%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.dll" "%xxxdst%">nul
echo 99%%
xcopy /e /v /i /h /r /y "%xxxsrc%\*.bmp" "%xxxdst%">nul

xcopy /v /r /y "temp\%xxxdst%\server.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Live.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\Player.ini" "%xxxdst%">nul
xcopy /v /r /y "temp\%xxxdst%\FilterGraph.ini" "%xxxdst%">nul
echo 100%%

goto end

:remove
set xxxcount=3
set xxxmsg=Uninstalling...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo %xxxmsg%
if exist %xxxdst% rmdir /s /q "%xxxdst%"

set xxxcount=2
set xxxmsg=Uninstalling...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo %xxxmsg%
if exist %xxxdst% rmdir /s /q "%xxxdst%"

set xxxcount=1
set xxxmsg=Uninstalling...phase %xxxcount%
set xxxdst=bin%xxxcount%
echo %xxxmsg%
if exist %xxxdst% rmdir /s /q "%xxxdst%"

goto end

:regir50
if exist "%SystemRoot%\system32\ir50_32.dll" "%SystemRoot%\system32\regsvr32.exe" /s "%SystemRoot%\system32\ir50_32.dll"

:end
echo Done.
