@echo off

REM Solution: dca100007
REM DATE:     2019-08-27

::Stop IIS server, so that dlls can be overwritten
echo Stop IIS Server...
iisreset /stop

::Start copying files


call:install_object  BackupDCA33_dca100007,py37_main.exe,py

call:install_object BackupDCA33_dca100007,ViewLog.asp,web\ConversionBuild
call:install_object BackupDCA33_dca100007,SettingInfo.asp,web\ConversionBuild
call:install_object BackupDCA33_dca100007,ShowMOControl.asp,web\ConversionObjects
call:install_object BackupDCA33_dca100007,About.htm,web
call:install_object BackupDCA33_dca100007,iddwprocess.asp,Web\DDImport_Baan
call:install_object BackupDCA33_dca100007,iddwone.asp,Web\DDImport_Baan
call:install_object BackupDCA33_dca100007,querybldr.asp,Web\DDImport_Legacy
call:install_object BackupDCA33_dca100007,BBCA20IDDLOADER.dll,bin
call:install_object BackupDCA33_dca100007,BBCA20XMLGenerator.dll,bin
call:install_object BackupDCA33_dca100007,BBCA20MappingObjects.dll,bin
call:install_object BackupDCA33_dca100007,BBCA20LGYMappingObjects.dll,bin
call:install_object BackupDCA33_dca100007,DDImport_Baan.pyc,py\Lib\DCAPackage
call:install_object BackupDCA33_dca100007,SharedLibrary.pyc,py\Lib\DCAPackage
call:install_object BackupDCA33_dca100007,enrich_db_with_xml.pyc,bin
call:install_object BackupDCA33_dca100007,MetaDataFrame.asp,Web\Applications
call:install_object BackupDCA33_dca100007,MetaDataTree.asp,Web\Applications
call:install_object BackupDCA33_dca100007,MetaDetail.asp,Web\Applications
call:install_object BackupDCA33_dca100007,ADetails.asp,Web\Applications
call:install_object BackupDCA33_dca100007,filesperapp.asp,Web\Applications
call:install_object BackupDCA33_dca100007,ShowTablefields.asp,Web\Applications
call:install_object BackupDCA33_dca100007,SearchCriteria.asp,Web\Search
call:install_object BackupDCA33_dca100007,PrintConvObjRep.asp,Web\Search
call:install_object BackupDCA33_dca100007,iBCAUtilities20.exe,bin
call:install_object BackupDCA33_dca100007,BBCA20DBOptions.exe,bin
call:install_object BackupDCA33_dca100007,DCA_Database_Patch.sql,bin
call:install_object BackupDCA33_dca100007,ExpMO1.asp,Web\ExportImportMappingRules
call:install_object BackupDCA33_dca100007,ChangePassword.asp,web
call:install_object BackupDCA33_dca100007,Login.asp,web
call:install_object BackupDCA33_dca100007,BBCA20ScriptGenerator.dll,bin
call:install_object BackupDCA33_dca100007,BBCA20DefaultMapGen.dll,bin



echo Start IIS Server...
iisreset /start
echo Patch complete. System ready to use...


goto:eof

:install_object
REM Par1: SolutionBackupName
REM Par2: Object
REM Par3: ObjectPath

set des=%~1
set object=%~2
set objectext=%~x2
set objectpath=%~3

echo Installing PATCH: %object%

REM unRegister first in case a .dll
IF "%objectext%"==".dll" regsvr32 /u /s "..\%objectpath%\%object%"

IF NOT EXIST "..\%des%" md "..\%des%" >nul
IF NOT EXIST "..\%des%\%objectpath%" md "..\%des%\%objectpath%" >nul

move "..\%objectpath%\%object%"  "..\%des%\%objectpath%\." 2> nul
copy "%objectpath%\%object%" "..\%objectpath%\."

REM Register in case a .dll
IF "%objectext%"==".dll" regsvr32 /s "..\%objectpath%\%object%"

REM Install py main
IF "%object%"=="py37_main.exe" (
  del /Q "..\%objectpath%\python*.*"  >nul
  del /Q "..\%objectpath%\vcruntime*.*" >nul
  del /S /Q "..\%objectpath%\DLLs\*.*" >nul
  del /S /Q "..\%objectpath%\Lib\*.*" >nul
  call "..\%objectpath%\py37_main.exe" -y >nul
  echo Y|del "..\%objectpath%\py37_main.exe"
)

goto:eof


