echo off
echo -
echo -
echo -  Ten batch zainstaluje mape dla Mapsource
echo -
echo -  Mapa:  "Góry_17 v.2 *** Fenix 5X ***"
echo -   FID:  2017
echo -   PID:  1
echo -
echo -  Nacisnij Enter aby kontynuowaÄ‡ lub Ctrl-C aby zrezygnowac.
echo -
pause

if exist "%~dp0mapset.img" goto :INSTREG
echo Kompilacja mapy pogladowej.
if not exist "C:/Program Files/cGPSmapper/cgpsmapper.exe" goto :COMPPATH
"C:/Program Files/cGPSmapper/cgpsmapper.exe" "mapset.mp"
goto TESTMAP
:COMPPATH
cgpsmapper "mapset.mp"
:TESTMAP
if exist "%~dp0mapset.img" goto :INSTREG
echo Brak pliku: mapset.img, instalacja zaniechana.
pause
exit 1

:INSTREG
echo Dodanie kluczy do rejestru.

set KEY=HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource
if %PROCESSOR_ARCHITECTURE% == AMD64 goto key_ok
set KEY=HKLM\SOFTWARE\Garmin\MapSource
:key_ok

reg ADD %KEY%\FamiliesNT\FAMILY_2017 /v ID /t REG_BINARY /d E107 /f
if exist mapset_mdr.img (
	reg ADD %KEY%\FamiliesNT\FAMILY_2017 /v IDX /t REG_SZ /d "%~dp0mapset.mdx" /f
	reg ADD %KEY%\FamiliesNT\FAMILY_2017 /v MDR /t REG_SZ /d "%~dp0mapset_mdr.img" /f
)
reg ADD %KEY%\FamiliesNT\FAMILY_2017 /v TYP /t REG_SZ /d "%~dp0mapset.typ" /f
reg ADD %KEY%\FamiliesNT\FAMILY_2017\1 /v Loc /t REG_SZ /d "%~dp0\" /f
reg ADD %KEY%\FamiliesNT\FAMILY_2017\1 /v Bmap /t REG_SZ /d "%~dp0mapset.img" /f
reg ADD %KEY%\FamiliesNT\FAMILY_2017\1 /v Tdb /t REG_SZ /d "%~dp0mapset.tdb" /f
pause
exit 0
