@ECHO off

IF     "%1"=="-help" GOTO SYNTAXERR 
IF     "%1"=="" GOTO SYNTAXERR 

infusb %1 %2 %3 %4 %5 %6 %7 %8 %9

echo.
echo Infinity USB returned %errorlevel%
echo.
echo.

if %errorlevel%==13 GOTO ERROREE
if %errorlevel%==12 GOTO ERRORINT
if %errorlevel%==11 GOTO ERRORFLASH
if %errorlevel%==10 GOTO ERRORCARD
if %errorlevel%==7 GOTO READERR
if %errorlevel%==6 GOTO NoRESTORE
if %errorlevel%==5 GOTO NOHW
if %errorlevel%==4 GOTO SYNTAXERR
if %errorlevel%==3 GOTO NOCARD
if %errorlevel%==2 GOTO VERIFYERR
if %errorlevel%==1 GOTO OK
if %errorlevel%==0 GOTO OK


:ERROREE
echo Error - Could not load file for ext. eeprom.
GOTO END

:ERRORINT
echo Error - Could not load file for int. eeprom.
GOTO END

:ERRORFLASH
echo Error - Could not load file for flash.
GOTO END

:ERRORCARD
echo Error - Error selecting card.
GOTO END

:NOHW
echo Error - No Infinity USB hardware connected.
GOTO END

:READERR
echo Error - Error reading card
GOTO END

:NORESTORE
echo Error - Could not restore file (probably due to readprotection)
GOTO END

:SYNTAXERR
echo.
echo Valid parameters are:
echo.
echo -hidden 			: Executes commands while Infinity USB is not displayed, must be used with -write switch
echo -card:cardname   		: Selects card. For instance goldcard or funcard
echo -flash:filename  		: Selects file to load for flash
echo -int:filename    		: Selects file to load for int. eeprom
echo -ext:filename   		: Selects file to load for ext. eeprom
echo -write			: Writes the selected files to the selected card
echo.
echo Only for Infinity USB Phoenix
echo -phoenix			: Enables phoenix mode, must be used with the -frq and -polarity commands
echo -frq:frequency		: (3.58 | 3.68 | 6.00) Chooses frequency, must be used with the -phoenix and -polarity commands
echo -polarity:resetpolarity	: (phoenix | smartmouse) Chooses resetpolarity, must be used with the -phoenix and -frq commands
echo -disablephoenix		: Disables Phoenix mode, ignores all other commands
echo.
echo Error codes:
echo.
echo 0			: OK
echo 1			: OK
echo 2			: Verification failed when writing card
echo 3			: No card or card was removed
echo 4			: Syntax error
echo 5			: No hardware connected
echo 6			: Error restore not possible
echo 7			: Error occured during read
echo 10			: Error selecting card using the -card switch
echo 11			: Error loading flash file using the -flash switch
echo 12			: Error loading int. eeprom file using the -int switch
echo 13			: Error loading ext. eeprom file using the -ext switch
echo.
GOTO END

:VERIFYERR
echo Error - Verification failed. Try cleaning the contacts, the card may have bad locations.
GOTO END

:NOCARD
echo Error - No card is inserted
GOTO END

:ok
echo Done

:end