echo off
echo -
echo -
echo -  This batch will install map for Mapsource
echo -
echo -  Map:  "US Airspace with Sfc Class E"
echo -  FID:  800
echo -  PID:  1
echo -
echo -  Press Enter to continue or Ctrl-C to abort.
echo -
pause

if exist "%~dp0US Airspace with Sfc Class E.img" goto :INSTREG
echo File missing: US Airspace with Sfc Class E.img, aborting install.
pause
exit 1

:INSTREG
echo Adding registry keys.

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%\Families\FAMILY_800 /v ID /t REG_BINARY /d 2003 /f
if exist "%~dp0US Airspace with Sfc Class E_mdr.img" (
	reg ADD %KEY%\Families\FAMILY_800 /v IDX /t REG_SZ /d "%~dp0US Airspace with Sfc Class E.mdx" /f
	reg ADD %KEY%\Families\FAMILY_800 /v MDR /t REG_SZ /d "%~dp0US Airspace with Sfc Class E_mdr.img" /f
)
reg ADD %KEY%\Families\FAMILY_800 /v TYP /t REG_SZ /d "%~dp010320.TYP" /f
reg ADD %KEY%\Families\FAMILY_800\1 /v Loc /t REG_SZ /d "%~dp0\" /f
reg ADD %KEY%\Families\FAMILY_800\1 /v Bmap /t REG_SZ /d "%~dp0US Airspace with Sfc Class E.img" /f
reg ADD %KEY%\Families\FAMILY_800\1 /v Tdb /t REG_SZ /d "%~dp0US Airspace with Sfc Class E.tdb" /f
pause
exit 0
