@echo off
if "%1"=="-getinfo" goto appinfo
if exist log_os\LogOS_is_running goto startscr
goto error
:startscr
color 07
mode 150,45
bg font 6
bg cursor 1
title Image viewer for Log OS
cls
Echo.
Echo Image viewer
Echo.
Echo 1. Select image
Echo 2. Return to Log OS
Echo.
set /p number=Enter number:
if "%number%"=="1" goto path
if "%number%"=="2" goto exitfile
goto startscr
:path
cls
Echo.
Echo Enter BMP file to load (without *.bmp)
Echo.
set /p pathname=
set xangle=1
set yangle=1
set zoom=100
bg cursor 0
bg font 0
mode 300,90
:insertbmp
cls
mode 300,90
insertbmp /p:%pathname%.bmp /x:%xangle% /y:%yangle% /z:%zoom%
bg _kbd
set key=%errorlevel%
ping localhost -n 1 >nul
if "%key%"=="400" set key=0&mode 300,90&goto setyde
if "%key%"=="396" set key=0&mode 300,90&goto setye
if "%key%"=="371" set key=0&mode 300,90&goto setxde
if "%key%"=="370" set key=0&mode 300,90&goto setxe
if "%key%"=="335" set key=0&mode 300,90&goto setyd
if "%key%"=="332" set key=0&mode 300,90&goto setxd
if "%key%"=="330" set key=0&mode 300,90&goto setx
if "%key%"=="327" set key=0&mode 300,90&goto sety
if "%key%"=="45" set key=0&mode 300,90&goto setzoomhypt
if "%key%"=="43" set key=0&mode 300,90&goto setzoomplus
if not "%key%"=="0" set key=0&mode 300,90&goto startscr
goto insertbmp

:sety
set /a yangle=%yangle%-1
if "%yangle%"=="0" set yangle=1
goto insertbmp

:setyd
set /a yangle=%yangle%+1
goto insertbmp

:setx
set /a xangle=%xangle%-1
if "%xangle%"=="0" set xangle=1
goto insertbmp

:setxd
set /a xangle=%xangle%+1
goto insertbmp

:setye
set /a yangle=%yangle%-5
if "%yangle%"=="0" set yangle=1
goto insertbmp

:setyde
set /a yangle=%yangle%+5
goto insertbmp

:setxe
set /a xangle=%xangle%-5
if "%xangle%"=="0" set xangle=1
goto insertbmp

:setxde
set /a xangle=%xangle%+5
goto insertbmp

:setzoomplus
set /a zoom=%zoom%+1
goto insertbmp

:setzoomhypt
set /a zoom=%zoom%-1
if "%zoom%"=="0" set zoom=1
goto insertbmp

:exitfile
set "number="
set "pathname="
set "errorlevel="
set "xangle="
set "yangle="
set "zoom="
set "key="
exit


:appinfo
echo %2. Image viewer for Log OS (version 1.1)
echo.   Description: Allows you to view images in *.bmp format
exit /b

:error
Echo.
Echo This application can only be run inside Log OS.
Echo.
pause
exit