@echo off
REM installrenew.bat
REM Renew Win/DOS Installation Batch
REM 06/2001 by Frank Wienberg, Olaf Kummer, Sven Offermann
IF "%~1" NEQ "" cd /d %1
if exist installrenew.bat goto DOIT
echo Please start installrenew.bat from its own directory!
goto END
:DOIT
echo @ECHO OFF > renew.bat
echo @ECHO OFF > makestub.bat
echo @ECHO OFF > compilestub.bat
echo @ECHO OFF > loadrenew.bat
echo @ECHO OFF > jcompile.bat
echo @ECHO OFF > renewexport.bat
cd ..\..
SET _BASEDIR=%cd%
echo %_BASEDIR%
cd bin\win
echo SET _BASEDIR=%_BASEDIR%>> renew.bat
echo SET _BASEDIR=%_BASEDIR%>> makestub.bat
echo SET _BASEDIR=%_BASEDIR%>> compilestub.bat
echo SET _BASEDIR=%_BASEDIR%>> loadrenew.bat
echo SET _BASEDIR=%_BASEDIR%>> jcompile.bat
echo SET _BASEDIR=%_BASEDIR%>> renewexport.bat
type setupfiles\setup.src >> renew.bat
type setupfiles\setup2-1.src >> makestub.bat
type setupfiles\setup2-1.src >> compilestub.bat
type setupfiles\setup2-1.src >> loadrenew.bat
type setupfiles\setup2-1.src >> jcompile.bat
type setupfiles\setup2-1.src >> renewexport.bat
echo REM The list of jar files below has been generated by installrenew.bat. > setupfiles\setup2-2.tmp
echo REM If it becomes out-of-date, please re-run the install script. >> setupfiles\setup2-2.tmp
cd ..\..\
echo CALL "%%_BASEDIR%%\bin\win\_rcphelp.bat" "%%_BASEDIR%%\loader.jar" >> bin\win\setupfiles\setup2-2.tmp
cd plugins
for %%F in (*.jar) do echo CALL "%%_BASEDIR%%\bin\win\_rcphelp.bat" "%%_BASEDIR%%\plugins\%%F" >> ..\bin\win\setupfiles\setup2-2.tmp
cd ..
cd libs\log4j
for %%F in (*.jar) do echo CALL "%%_BASEDIR%%\bin\win\_rcphelp.bat" "%%_BASEDIR%%\libs\log4j\%%F" >> ..\..\bin\win\setupfiles\setup2-2.tmp
cd ..\..
cd bin\win
type setupfiles\setup2-2.tmp >> makestub.bat
type setupfiles\setup2-2.tmp >> compilestub.bat
type setupfiles\setup2-2.tmp >> loadrenew.bat
type setupfiles\setup2-2.tmp >> jcompile.bat
type setupfiles\setup2-2.tmp >> renewexport.bat
del setupfiles\setup2-2.tmp
cd ..\..
cd libs\commonscli
for %%F in (*.jar) do echo CALL "%%_BASEDIR%%\bin\win\_rcphelp.bat" "%%_BASEDIR%%\libs\commonscli\%%F" >> ..\..\bin\win\renewexport.bat
cd ..\..
cd libs\freehep
for %%F in (*.jar) do echo CALL "%%_BASEDIR%%\bin\win\_rcphelp.bat" "%%_BASEDIR%%\libs\freehep\%%F" >> ..\..\bin\win\renewexport.bat
cd ..\..
cd bin\win
type setupfiles\setup2-3.src >> makestub.bat
type setupfiles\setup2-3.src >> compilestub.bat
type setupfiles\setup2-3.src >> loadrenew.bat
type setupfiles\setup2-3.src >> jcompile.bat
type setupfiles\setup2-3.src >> renewexport.bat
type setupfiles\setup3-1.src >> renew.bat
type setupfiles\setup3-2.src >> makestub.bat
type setupfiles\setup3-3.src >> compilestub.bat
type setupfiles\setup3-4.src >> loadrenew.bat
type setupfiles\setup3-5.src >> jcompile.bat
type setupfiles\setup3-6.src >> renewexport.bat

SET _REGBASEDIR=%_BASEDIR:\=\\%
echo REGEDIT4>addregistry.reg
echo.>>addregistry.reg
echo [HKEY_CLASSES_ROOT\.rnw]>>addregistry.reg
echo @="x-renew-net">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-net]>>addregistry.reg
echo @="Renew Petri net drawing">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-net\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-net\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-net.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.aip]>>addregistry.reg
echo @="x-renew-interactiondiagram">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-interactiondiagram]>>addregistry.reg
echo @="Renew interaction diagram">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-interactiondiagram\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-interactiondiagram\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-interactiondiagram.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.draw]>>addregistry.reg
echo @="x-renew-drawing">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-drawing]>>addregistry.reg
echo @="Renew simple drawing">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-drawing\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-drawing\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-drawing.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.sns]>>addregistry.reg
echo @="x-renew-sns">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-sns]>>addregistry.reg
echo @="Renew shadow net system">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-sns\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-sns\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-sns.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.rst]>>addregistry.reg
echo @="x-renew-state">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-state]>>addregistry.reg
echo @="Renew simulation state">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-state\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-state.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.pnml]>>addregistry.reg
echo @="pnml+xml">>addregistry.reg
echo [HKEY_CLASSES_ROOT\pnml+xml]>>addregistry.reg
echo @="Renew PNML net drawing">>addregistry.reg
echo [HKEY_CLASSES_ROOT\pnml+xml\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\pnml+xml\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-pnml+xml.ico">>addregistry.reg
echo [HKEY_CLASSES_ROOT\.net]>>addregistry.reg
echo @="x-renew-lola">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-lola]>>addregistry.reg
echo @="Renew Lola net drawing">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-lola\shell\open\command]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\loadrenew.bat \"%%1\"">>addregistry.reg
echo [HKEY_CLASSES_ROOT\x-renew-lola\DefaultIcon]>>addregistry.reg
echo @="%_REGBASEDIR%\\bin\\win\\icons\\application-x-renew-lola.ico">>addregistry.reg


echo REGEDIT4>removeregistry.reg
echo.>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.rnw]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-net]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.aip]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-interactiondiagram]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.draw]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-drawing]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.sns]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-sns]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.rst]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-state]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.pnml]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\pnml+xml]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\.net]>>removeregistry.reg
echo [-HKEY_CLASSES_ROOT\x-renew-lola]>>removeregistry.reg

type setupfiles\teardown.src >> renew.bat
type setupfiles\teardown.src >> makestub.bat
type setupfiles\teardown.src >> compilestub.bat
type setupfiles\teardown.src >> loadrenew.bat
type setupfiles\teardown.src >> jcompile.bat
echo Type renew or double-click renew.bat in
cd
echo to start Renew.
echo The batch file makestub.bat generates a Renew stub for a Java class.
echo The batch file compilestub.bat compiles a Renew stub.
echo The batch file jcompile.bat helps compiling java classes depending on 
echo Renew classes like net stubs.
echo The registry file addregistry.reg contains the registry entries to associate
echo Renew file types (.rnw, .draw, .aip, .sns) with the loadrenew.bat script.
echo You can perform this association by double clicking addregistry.reg.
echo With removeregistry.reg you can remove the corresponding entries from the 
echo registry. 
echo The loadrenew.bat script loads drawings into a running Renew application.
echo This uses by default the TCP port 65111 to transmit the drawing path to the 
echo running Renew instance. If you want to use a different port, just configure 
echo the property de.renew.loadServerPort in your .renew.properties file. If there
echo is no Renew application running, the script starts a regular Renew instance.
Pause
:END
