RequestChoice >ENV:Choice "Welcome!" "Welcome to the DMSMaker! Choose an action" "Crunch" "Decrunch" "Repack" "View" "Test" "Quit"
if $Choice EQ 1
lab Dev
RequestFile >ENV:Cr DRAWERSONLY TITLE "Choose DEVICE to crunch" POSITIVE "Crunch" NEGATIVE "Return to menu"
if WARN
skip Start BACK
endif
if NOT EXISTS $Cr
echo "DEVICE does not exist! Choose again!"
delete >nil: env:cr
skip Dev BACK
endif
RequestChoice >ENV:Mode1 "Crunch Mode" "Choose degree of crunching" "Best" "None" "Heavy1" "Heavy2" "Return to menu"
if $Mode1 EQ 0
skip Start BACK
endif
if $Mode1 EQ 1
echo "BEST" >ENV:Mode
endif
if $Mode1 EQ 2
echo "NONE" >ENV:Mode
endif
if $Mode1 EQ 3
echo "HEAVY1" >ENV:Mode
endif
if $Mode1 EQ 4
echo "HEAVY2" >ENV:Mode
endif
RequestFile >ENV:CrSv TITLE "Save crunched file as..." ACCEPTPATTERN "#?.dms" FILE ".dms" POSITIVE "Save" NEGATIVE "Return to menu"
if WARN
skip Start BACK
endif
lab enk
RequestChoice >ENV:En "Encryption" "Do you wish to encrypt the FILE when saving?" "Yes" "No" "Return to menu"
if $En EQ 1
lab pa
set pass `RequestString "" "Type password:" INVISIBLE`
if "$pass" EQ "*$pass" ;Cancel was pressed
skip NoEnk
endif
set pass1 `RequestString "" "Verify password:" INVISIBLE`
if $pass1 EQ $pass
$DMS read $CrSv FROM $Cr CMODE $Mode ENCRYPT $Pass
if NOT ERROR
echo "File encrypted and crunched!"
endif
else
echo "Password incorrect!*nTry again!"
skip pa back
endif
endif
if $En EQ 0
skip Start BACK
endif
lab NoEnk
if $En EQ 2
$DMS read $CrSv FROM $Cr CMODE $Mode
endif
endif
if $Choice EQ 2
lab Dec
RequestFile >ENV:De TITLE "Choose FILE to decrunch" ACCEPTPATTERN "#?.dms" POSITIVE "Decrunch" NEGATIVE "Return to menu"
if WARN
skip Start BACK
endif
if NOT EXISTS $De
echo "FILE does not exist! Choose again!"
delete >nil: env:de
skip Dec BACK
endif
lab DecDev
RequestFile >ENV:DeDev TITLE "Choose DEVICE to decrunch TO" DRAWERSONLY POSITIVE "Write" NEGATIVE "Return to menu"
if WARN
skip Start BACK
endif
if NOT EXISTS $DeDev
echo "DEVICE does not exist! Choose again!"
delete >nil: env:dedev
skip DecDev BACK
endif
lab DeEnk
RequestChoice >ENV:DeEnc "De-Encrypt" "Was FILE encrypted when saved? If unsure, read General Info on View -*nif it says ENCRYPTED, it's encrypted. If it doesn't, it's not." "Yes" "No" "View" "Return to menu"
if $DeEnc EQ 0
skip Start BACK
endif
if $DeEnc EQ 1
lab pa1
set pas `RequestString "" "Type password:" INVISIBLE`
if "$pas" EQ "*$pas"
skip DeEnk back
endif
set pas1 `RequestString "" "Verify password:" INVISIBLE`
if $pas1 EQ $pas
echo "Password verified!"
$DMS write $De TO $DeDev DECRYPT $Pas
if NOT ERROR
echo "File decrypted and decrunched!"
else
echo "Incorrect password!*nTry again!"
skip pa1 back
endif
else
echo "Password incorrect!*nTry again!"
skip pa1 back
endif
endif
if $DeEnc EQ 2
$DMS write $De TO $DeDev
endif
if $DeEnc EQ 3
$DMS view $De
skip DeEnk BACK
endif
endif
if $Choice EQ 3
lab Rep
RequestFile >ENV:Re TITLE "Choose FILE to repack" ACCEPTPATTERN "#?.dms" POSITIVE "Repack" NEGATIVE "Return to menu" FILE ".dms"
if WARN
skip Start BACK
endif
if NOT EXISTS $Re
echo "File does not exist! Choose again!"
delete >nil: env:re
skip Rep BACK
endif
RequestChoice >ENV:Mode1 "Crunch Mode" "Choose degree of crunching" "Best" "None" "Heavy1" "Heavy2" "Return to menu"
if WARN
skip Start BACK
endif
if $Mode1 EQ 1
echo "BEST" >ENV:Mode
endif
if $Mode1 EQ 2
echo "NONE" >ENV:Mode
endif
if $Mode1 EQ 3
echo "HEAVY1" >ENV:Mode
endif
if $Mode1 EQ 4
echo "HEAVY2" >ENV:Mode
endif
RequestFile >ENV:CrSv TITLE "Save repacked file as..." ACCEPTPATTERN "#?.dms" FILE ".dms" POSITIVE "Save" NEGATIVE "Return to menu"
if WARN
skip Start BACK
endif
$DMS repack $Re TO $CrSv CMODE $Mode
endif
if $Choice EQ 4
lab View
RequestFile >ENV:V TITLE "Choose DMS FILE to view" POSITIVE "View" NEGATIVE "Return to menu" ACCEPTPATTERN "#?.dms" FILE ".dms"
if WARN
skip Start BACK
endif
if NOT EXISTS $V
echo "FILE does not exist! Choose again!"
delete >nil: env:v
skip View BACK
endif
$DMS view $V
endif
if $Choice EQ 5
lab Test
RequestFile >ENV:Tst TITLE "Choose FILE to test" ACCEPTPATTERN "#?.DMS" POSITIVE "Test" NEGATIVE "Return to menu" FILE ".dms"