home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PCBOARD
/
DWNLDCD.ZIP
/
DWNLDCD.PPS
< prev
next >
Wrap
Text File
|
1994-01-03
|
8KB
|
181 lines
;*****************************************************************************
;* DOWNLOAD.PPE v0.50 *
;* PCBOARD 15.1 Download Counter *
;* *
;* Written by Steven Hauswirth *
;* Written in PCBoard Programming Language *
;* *
;* "The Power Palace BBS" *
;* Node 1 - 312-594-0643 - [14.4 v32b] - 80386/40 *
;* *
;* This PPE is a full screen download counter that informs the user how *
;* many files, bytes, et cetera they have flagged for download. *
;*****************************************************************************
IF (!ANSION()) THEN
PRINT "Enter the filename to Download (Enter)=none"
GOTO EXIT
ENDIF
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Declare Variable Types │
;└───────────────────────────────────────────────────────────────────────────┘
STRING TEMP, Y, FILE_NAME, FILE_NUM, FILE_SIZE, FILE_MIN, FILE_SEC, FLAG_FILE
STRING NO_TIME, FREE_FILE
INTEGER COUNT, LOOP, BAT_TIME, BAT_MIN, BAT_SEC, SPEED, SPEED2
INTEGER TEMP1, TEMP2, TEMP3
IF (PCBNODE() = 0) THEN
LET FLAG_FILE = GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\FLIST."
ELSE
LET FLAG_FILE = GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\FLIST."+STRING(PCBNODE())
ENDIF
LET FILE_NUM = 0
TEMP1 = 0
TEMP2 = 0
TEMP3 = 0
LET Y = 1
LET LOOP = 1
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Check to see if they have NOT flagged any files yet for download, or if │
;│ the user has decided not to download the flagged files. │
;└───────────────────────────────────────────────────────────────────────────┘
FOPEN 1,FLAG_FILE,O_RD,S_DN
FDEFIN 1
FSEEK 1,0,SEEK_SET(0)
FOR LOOP = 1 TO 100000
FSEEK 1,66,SEEK_CUR(1)
FDREAD FILE_NAME,13
IF (FERR(1)) BREAK
FSEEK 1,50,SEEK_CUR(1)
NEXT
COUNT = LOOP
IF (LOOP != 1) WAIT
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Display the header of the dispay │
;└───────────────────────────────────────────────────────────────────────────┘
PRINTLN ""
PRINTLN "!|1K|*"
PRINTLN "@CLS@@X0A ┌────────────────────────────────────────────────────────────────────────────┐"
PRINTLN " │ @X09░▒▓█@X1B Statistics for the last 10 files in your batch @X09█▓▒░@X0A │"
PRINTLN " │ │"
PRINTLN " │ @X0BNum Filename Size Transfer Time Free No Time @X0A│"
PRINTLN " │ @X0D──── ──────────── ────────── ─────────────── ──── ─────── @X0A│"
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Since there are files already flagged for download. Find out how many. │
;│ If there are more then 10 then position display to only display the last │
;│ ten of them. │
;└───────────────────────────────────────────────────────────────────────────┘
FSEEK 1,0,SEEK_SET(0)
IF (COUNT>10) THEN
FOR LOOP = 1 TO (COUNT-10)
FSEEK 1,129,SEEK_CUR(1)
NEXT
ELSE COUNT = 10
ENDIF
LET Y = COUNT-9
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Display the file name, bytes, and transfer time for all the files flagged │
;└───────────────────────────────────────────────────────────────────────────┘
FOR LOOP= 1 TO COUNT
FSEEK 1,66,SEEK_CUR(1)
FDREAD FILE_NAME,13
IF (FERR(1)) BREAK
FDREAD TEMP,4
TEMP = TRIM(TEMP," ")
TEMP1 = ASC(LEFT(TEMP,1))
IF (LEN(TEMP)>1) TEMP2 =256*ASC(MID(TEMP,2,1))
IF (LEN(TEMP)=3) TEMP3 =65536*ASC(RIGHT(TEMP,1))
FILE_SIZE = TEMP1+TEMP2+TEMP3
TEMP2 = 0
TEMP3 = 0
FDREAD TEMP,3
TEMP = TRIM(TEMP," ")
TEMP1 = ASC(LEFT(TEMP,1))
IF (LEN(TEMP)>1) TEMP2 =256*ASC(MID(TEMP,2,1))
IF (LEN(TEMP)=3) TEMP3 =65536*ASC(RIGHT(TEMP,1))
FILE_SEC = TEMP1+TEMP2+TEMP3
FSEEK 1,9,SEEK_CUR(1)
FDREAD FREE_FILE,1
FDREAD NO_TIME,1
FSEEK 1,32,SEEK_CUR(1)
FILE_MIN = STRING(S2I(FILE_SEC,10)/60)
FILE_SEC = STRING(S2I(FILE_SEC,10)-(S2I(FILE_MIN,10)*60))
PRINT " │@X0B"+LEFT(" ",6-LEN(Y))+STRING(Y)+LEFT(" ",16-LEN(FILE_NAME))+"@X0F"
PRINT FILE_NAME+LEFT(" ",14-LEN(FILE_SIZE))
PRINT FILE_SIZE+LEFT(" ",8-LEN(FILE_MIN))
PRINT FILE_MIN+" @X07min@X0F"+LEFT(" ",3-LEN(STRING(FILE_SEC)))+STRING(FILE_SEC)+" @X07sec "
IF (ASC(FREE_FILE)=1) THEN
PRINT "@X0CY"
ELSE PRINT "@X0EN"
ENDIF
PRINT " "
IF (ASC(NO_TIME)=1) THEN
PRINT "@X0CY"
ELSE PRINT "@X0C@X0EN"
ENDIF
ANSIPOS 79,5+LOOP
PRINTLN "@X0A│"
ANSIPOS 1,6+LOOP
INC Y
NEXT
;┌────────────────────────────────────────────────────────────────────────────┐
;│ Display with blank lines to fill the screen to ten file placements listed │
;└────────────────────────────────────────────────────────────────────────────┘
:CONT
FOR LOOP = LOOP TO 10
PRINTLN " @X0A│@X0B"+LEFT(" ",6-LEN(Y))+STRING(Y)+" @X0F0 0 @X07min @X0F0 @X07sec @X0A│"
INC Y
NEXT
:BACK
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Display the footer of the dispay │
;└───────────────────────────────────────────────────────────────────────────┘
PRINTLN " │ │"
PRINTLN " │ @X09░▒▓█@X1B Statistics for the ENTIRE batch @X09█▓▒░@X0A │"
PRINTLN " │ │"
PRINT " │ @X07Files: @X0F@FFILES:3@ @X07Size (bytes): @X0F@FBYTES:12@ @X07Estimated time: @X0F"
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Calculate the BATCH transfer time from the BATCH bytes listed on screen │
;│ taking into account local logons and error correcting modems. │
;└───────────────────────────────────────────────────────────────────────────┘
LET FILE_NUM = TRIM(SCRTEXT(14,19,2,FALSE)," ")
LET BAT_TIME = S2I(TRIM(SCRTEXT(33,19,12,FALSE)," "),10)
IF (ONLOCAL()) THEN
SPEED=0.09*(READLINE(PCBDAT(),53))
ELSE
SPEED = CARRIER()/10
IF (ERRCORRECT()) THEN
SPEED = SPEED * 1.05
ELSE SPEED = .96*SPEED
ENDIF
ENDIF
SPEED2 = SPEED*60
BAT_MIN = BAT_TIME/SPEED2
BAT_SEC = (BAT_TIME/SPEED)-(BAT_MIN*60)
PRINT STRING(BAT_MIN)+" @X07min"+" @X0F"+STRING(BAT_SEC)+" @X07sec@X0A"
ANSIPOS 79,19
PRINTLN "│"
PRINTLN " └────────────────────────────────────────────────────────────────────────────┘"
PRINTLN " @X07Enter @X0Ffilename @X07on line above, or (@X0CENTER@X07) alone to continue"
;┌───────────────────────────────────────────────────────────────────────────┐
;│ Position cursor on the screen and ask for file name. Then stuff it into │
;│ keyboard buffer and exit │
;└───────────────────────────────────────────────────────────────────────────┘
IF (S2I(FILE_NUM,10)>9) FILE_NUM = 9
ANSIPOS 13,6+FILE_NUM
LET FILE_NAME = ""
INPUTSTR "_",file_name+"*?",@X07,12,MASK_FILE(),UPCASE
ANSIPOS 1,21
FILE_NAME=TRIM(FILE_NAME," ")
IF (LEN(file_name) = 0) file_name = CHR(13)
KBDSTUFF file_name
:EXIT
END