Ooops
November 30, 2020, 01:55:40 AM

Author Topic: [bb] Read/Write Progress Meters by _PJ_ [ 1+ years ago ]  (Read 1219 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Read/Write Progress Meters by _PJ_ [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Read/Write Progress Meters
Author : _PJ_
Posted : 1+ years ago

Description : I Re-visited these old routines to make them a little more coherent.
They are mainly wrappers for the Read/Write functions including those for Peek/Poke (including Read/WriteBytes!) if you need to monitor progress on Bank handling too.

There's a simplistic example and some basic "user functions" to give you a head-start on how to use the functionality.

Currently the 'filter' process is pretty poor, just an Instr() call that isn't even case Insensitive, however, this again serves as a base from which to develop more complete solutions.


Code :
Code: BlitzBasic
  1. Global nPROGRESS_STREAM_CURRENT_BYTES%
  2. Global nPROGRESS_STREAM_MAXIMUM_BYTES%
  3.  
  4. Global nPROGRESS_DIR_MAXIMUM_BYTES%
  5. Global nPROGRESS_DIR_CURRENT_BYTES%
  6.  
  7. Global nPROGRESS_BANK_MAXIMUM_BYTES%
  8. Global nPROGRESS_BANK_CURRENT_BYTES%
  9.  
  10. Global nPROGRESS_STREAM_TIMESTAMP%
  11. Global nPROGRESS_BANK_TIMESTAMP%
  12. Global nPROGRESS_DIR_TIMESTAMP%
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. ; Example:
  23. Graphics 1024,768,32,6
  24. SetBuffer BackBuffer()
  25. Global sPath$=CurrentDir()
  26. Global sBlitzFilesOnly$=".bb"
  27.  
  28. Local hDir=hReadProgressDir(sPath,sBlitzFilesOnly)
  29. Local sStreamName$=NextFile(hDir)
  30. Local hStream
  31.  
  32. While (sStreamName<>"")
  33.         If (Right(sStreamName,1)<>".")
  34.                 hStream=hReadProgressStream(sPath+sStreamName,sBlitzFilesOnly)
  35.                 If (hStream)
  36.                         While (Not (Eof(hStream)))
  37.                                
  38.                                 ;Normally we might do something with this...
  39.                                 nReadByteProgress(hStream)
  40.                                
  41.                                 Cls
  42.                                
  43.                                 DisplayProgressBar(0,0,256,32,fProgressDirPercentage()*0.01,sPath+" ("+Str(Floor(fProgressDirPercentage()))+"%) "+sProgressDirTimeRemaining()+" : "+sStreamName+" Filtered: *"+sBlitzFilesOnly)
  44.                                 DisplayProgressBar(0,128,256,32,fProgressStreamPercentage()*0.01,sStreamName+" ("+Str(Floor(fProgressStreamPercentage()))+"%) "+sProgressStreamTimeRemaining())
  45.                                
  46.                                 Flip
  47.                                
  48.                                 If (bProgressDirComplete())
  49.                                         CloseFile hStream
  50.                                         Exit
  51.                                 End If
  52.                                
  53.                         Wend
  54.                         CloseFile hStream
  55.                 End If
  56.         End If
  57.         If (bProgressDirComplete()) Then Exit
  58.         sStreamName$=NextFile(hDir)
  59. Wend
  60.  
  61. CloseDir hDir
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ;User Functions
  76.  
  77. Function fCalculateRemainingTime#(Proportion#,BaselineTimestamp)
  78.         Local Duration#=(Float(MilliSecs()-BaselineTimestamp))
  79.         Local Rate#=1.0/Float(Proportion/Duration#)
  80.         Return Rate*(1.0-Proportion)
  81. End Function
  82.  
  83. Function DisplayProgressBar(X%,Y%,Width%,Height%,fProportion#,Txt$)
  84.         Color 255,255,255
  85.         Rect X,Y,Width,Height,0
  86.        
  87.         Text X,Y+Height*1.5,Txt$
  88.        
  89.         Color 255,0,0
  90.         Rect X+1,Y+1,Width-2,Height-2,1
  91.        
  92.         Color 0,255,0
  93.         Rect X+1,Y+1,fProportion*(Width-2),Height-2,1
  94. End Function
  95.  
  96. Function TimeText$(Milliseconds)
  97.         Local RemainText$=""
  98.         Milliseconds=(Milliseconds*0.001)
  99.         If (Milliseconds>60.0)
  100.                 If (Milliseconds>3600.0)
  101.                         If (Milliseconds>86400.0)
  102.                                 If (Milliseconds>604800.0)
  103.                                         RemainText=RemainText+Str(Int(Floor(Milliseconds/604800.0)))+" Weeks, "
  104.                                         Milliseconds=Milliseconds Mod 604800
  105.                                 End If
  106.                                 RemainText=RemainText+Str(Int(Floor(Milliseconds/86400.0)))+" Days, "
  107.                                 Milliseconds=Milliseconds Mod 86400
  108.                         End If
  109.                         RemainText=RemainText+Str(Int(Floor(Milliseconds/3600.0)))+" Hours, "
  110.                         Milliseconds=Milliseconds Mod 3600
  111.                 End If
  112.                 RemainText=RemainText+Str(Int(Floor(Milliseconds/60.0)))+" Minutes, and "
  113.                 Milliseconds=Milliseconds Mod 60.0
  114.         End If
  115.         RemainText=RemainText+Str(Int(Ceil(Milliseconds)))+" Seconds remaining"
  116.         Return RemainText
  117. End Function
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. ;Functions     
  144.  
  145. Function SetStreamByteLimit(nLimit%)
  146.         nPROGRESS_STREAM_MAXIMUM_BYTES=nLimit
  147. End Function
  148.  
  149. Function SetDirByteLimit(nLimit%)
  150.         nPROGRESS_DIR_MAXIMUM_BYTES=nLimit
  151. End Function
  152.  
  153. Function SetBankByteLimit(nLimit%)
  154.         nPROGRESS_BANK_MAXIMUM_BYTES=nLimit
  155. End Function
  156.  
  157. ;--
  158.  
  159. Function SetProgressStreamBytePosition(nBytes%)
  160.         nPROGRESS_STREAM_CURRENT_BYTES=nBytes
  161. End Function
  162.  
  163. Function SetProgressStreamPercent(fPercent#)
  164.         nPROGRESS_STREAM_CURRENT_BYTES=Int((Float(nPROGRESS_STREAM_MAXIMUM_BYTES)*0.01*fPercent))
  165. End Function
  166.  
  167. Function SetProgressDir(nBytes%)
  168.         nPROGRESS_DIR_CURRENT_BYTES=nBytes
  169. End Function
  170.  
  171. Function SetProgressDirPercent(fPercent#)
  172.         nPROGRESS_DIR_CURRENT_BYTES=Int((Float(nPROGRESS_DIR_MAXIMUM_BYTES)*0.01*fPercent))
  173. End Function
  174.  
  175. Function SetProgressBank(nBytes%)
  176.         nPROGRESS_BANK_CURRENT_BYTES=nBytes
  177. End Function
  178.  
  179. Function SetProgressBankPercent(fPercent#)
  180.         nPROGRESS_BANK_CURRENT_BYTES=Int((Float(nPROGRESS_BANK_MAXIMUM_BYTES)*0.01*fPercent))
  181. End Function
  182.  
  183. ;--
  184.  
  185. Function hCreateBankProgress(nBankSize%)
  186.         Local hReturn%=CreateBank(nBankSize)
  187.         nPROGRESS_BANK_MAXIMUM_BYTES=nBankSize
  188.         nPROGRESS_BANK_CURRENT_BYTES=0
  189.         nPROGRESS_BANK_TIMESTAMP=MilliSecs()
  190. End Function
  191.  
  192. ;--
  193.  
  194. Function ResizeBankProgress(hBank,nSize%)
  195.         nPROGRESS_BANK_MAXIMUM_BYTES=nSize
  196.         ResizeBank hBank,nSize
  197. End Function
  198.  
  199. ;--
  200.  
  201. Function ResetProgressStream()
  202.         nPROGRESS_STREAM_CURRENT_BYTES=0
  203. End Function
  204.  
  205. Function ResetProgressDir()
  206.         nPROGRESS_DIR_CURRENT_BYTES=0
  207. End Function
  208.  
  209. Function ResetProgressBank()
  210.         nPROGRESS_BANK_CURRENT_BYTES=0
  211. End Function
  212.  
  213. ;--
  214.  
  215. Function ProgressStreamSkip()
  216.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_MAXIMUM_BYTES
  217. End Function
  218.  
  219. Function ProgressDirSkip()
  220.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_MAXIMUM_BYTES
  221.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_MAXIMUM_BYTES
  222. End Function
  223.  
  224. Function ProgressBankSkip()
  225.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_MAXIMUM_BYTES
  226. End Function
  227.  
  228. ;--
  229.  
  230. Function bProgressStreamComplete%()
  231.         Return (nPROGRESS_STREAM_CURRENT_BYTES>=nPROGRESS_STREAM_MAXIMUM_BYTES)
  232. End Function
  233.  
  234. Function bProgressDirComplete%()
  235.         Return (nPROGRESS_DIR_CURRENT_BYTES>=nPROGRESS_DIR_MAXIMUM_BYTES)
  236. End Function
  237.  
  238. Function bProgressBankComplete%()
  239.         Return (nPROGRESS_BANK_CURRENT_BYTES>=nPROGRESS_BANK_MAXIMUM_BYTES)
  240. End Function
  241.  
  242. ;--
  243.  
  244. Function hReadProgressDir%(sDirPath$,sFilter$=".")
  245.         nPROGRESS_DIR_CURRENT_BYTES=0
  246.         nPROGRESS_DIR_MAXIMUM_BYTES=0
  247.         nPROGRESS_STREAM_CURRENT_BYTES=0
  248.         nPROGRESS_STREAM_MAXIMUM_BYTES=0
  249.         nPROGRESS_DIR_TIMESTAMP=MilliSecs()
  250.         Local hReturn%=0
  251.         If (FileType(sDirPath)=2)
  252.                 hReturn=ReadDir(sDirPath)              
  253.                 If (hReturn)
  254.                         If (Right(sDirPath,1)<>"") Then sDirPath=sDirPath+""
  255.                         Local sFile$=NextFile(hReturn)
  256.                         Local sFilePath$
  257.                         While (sFile<>"")
  258.                                 sFilePath=sDirPath+sFile
  259.                                 If ((FileType(sFilePath)=1) And (Instr(sFilePath,sFilter)))
  260.                                         nPROGRESS_DIR_MAXIMUM_BYTES=nPROGRESS_DIR_MAXIMUM_BYTES+FileSize(sDirPath+sFile)
  261.                                 End If
  262.                                 sFile=NextFile(hReturn)
  263.                         Wend
  264.                         CloseDir hReturn
  265.                 End If
  266.         End If
  267.         If (hReturn)
  268.                 Return ReadDir(sDirPath)
  269.         End If
  270. End Function
  271.  
  272. Function hReadProgressStream%(sStreampath$,sFilter$=".")
  273.         Local hReturn%=0
  274.        
  275.         If ((FileType(sStreampath)=1) And (Instr(sStreampath,sFilter)))
  276.                 nPROGRESS_STREAM_MAXIMUM_BYTES=FileSize(sStreampath)
  277.                 nPROGRESS_STREAM_CURRENT_BYTES=0
  278.                 nPROGRESS_STREAM_TIMESTAMP=MilliSecs()
  279.                 hReturn=ReadFile(sStreampath)
  280.         End If
  281.         Return hReturn
  282. End Function
  283.  
  284. Function hOpenProgressStream%(sStreampath$,sFilter$=".")
  285.         Local hReturn%=0
  286.        
  287.         If ((FileType(sStreampath)=1) And (Instr(sStreampath,sFilter)))
  288.                 nPROGRESS_STREAM_MAXIMUM_BYTES=FileSize(sStreampath)
  289.                 nPROGRESS_STREAM_CURRENT_BYTES=0
  290.                 nPROGRESS_STREAM_TIMESTAMP=MilliSecs()
  291.                 hReturn=OpenFile(sStreampath)
  292.         End If
  293.         Return hReturn
  294. End Function
  295.  
  296. ;--
  297.  
  298. Function sReadProgressLine$(hStreamHandle)
  299.         Local sReturn$=ReadLine(hStreamHandle)
  300.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+Len(sReturn)+2    ;Add 2 for line length short bytes
  301.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+Len(sReturn)+2  ;Add 2 for line length short bytes
  302.         Return sReturn
  303. End Function
  304.  
  305. Function nReadProgressInt%(hStreamHandle)
  306.         Local nReturn%=ReadInt(hStreamHandle)
  307.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+4
  308.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+4
  309.         Return nReturn
  310. End Function
  311.  
  312. Function nReadShortProgress(hStreamhandle)
  313.         Local nReturn%=ReadShort(hStreamhandle)
  314.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+2
  315.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+2
  316.         Return nReturn
  317. End Function
  318.  
  319. Function sReadStringProgress$(hStreamhandle)
  320.         Local sReturn$=ReadString(hStreamhandle)
  321.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+Len(sReturn)+2    ;Add 2 for line length short bytes
  322.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+Len(sReturn)+2  ;Add 2 for line length short bytes
  323.         Return sReturn
  324. End Function
  325.  
  326. Function fReadFloatProgress#(hStreamhandle)
  327.         Local fReturn#=ReadFloat(hStreamhandle)
  328.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+4
  329.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+4
  330.         Return fReturn
  331. End Function
  332.  
  333. Function nReadByteProgress%(hStreamhandle)
  334.         Local nReturn=ReadByte(hStreamhandle)
  335.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+1
  336.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+1
  337.         Return nReturn
  338. End Function
  339.  
  340. Function ReadBytesStreamProgress(hBankhandle,hStreamhandle,nOffset,nCount);Use this function when Progress meter refers to STREAM
  341.         ReadBytes hBankhandle,hStreamhandle,nOffset,nCount
  342.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+nCount
  343.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+nCount
  344. End Function
  345.  
  346. Function ReadBytesBankProgress(hBankhandle,hStreamhandle,nCount);Use this function when Progress meter refers to BANK
  347.         ReadBytes hBankhandle,hStreamhandle,nPROGRESS_BANK_CURRENT_BYTES,nCount
  348.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+nCount
  349. End Function
  350.  
  351. Function nPeekByteProgress%(hBank%)
  352.         Local nReturn%=PeekByte(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  353.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+1
  354.         Return nReturn
  355. End Function
  356.  
  357. Function nPeekIntProgress%(hBank%)
  358.         Local nReturn%=PeekInt(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  359.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+4
  360.         Return nReturn
  361. End Function
  362.  
  363. Function fPeekFloatProgress%(hBank%)
  364.         Local fReturn#=PeekFloat(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  365.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+4
  366.         Return fReturn
  367. End Function   
  368.  
  369. Function nPeekShortProgress%(hBank%,nOffset%)
  370.         Local nReturn%=PeekShort(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  371.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+2
  372.         Return nReturn
  373. End Function   
  374.  
  375. Function sPeekStringProgress$(hBank%)
  376.         ;Strings read from banks must end at a Null terminator
  377.         Local sString$=""
  378.         Local Byte=PeekByte(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  379.         While (Byte)
  380.                 sString=sString+Chr(Byte)
  381.                 nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+1
  382.                 Byte=PeekByte(hBank,nPROGRESS_BANK_CURRENT_BYTES)
  383.         Wend   
  384.         Return sString
  385. End Function
  386.  
  387. ;--
  388.  
  389. Function WriteLineProgress$(hStreamhandle,sLine$)
  390.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+Len(sLine)+2; Add Chr(13)+Chr(10) for Linefeed & CarriageReturn
  391.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+Len(sLine)+2; Add Chr(13)+Chr(10) for Linefeed & CarriageReturn
  392.         WriteLine hStreamhandle,sLine
  393. End Function
  394.  
  395. Function WriteIntProgress%(hStreamhandle,nInt%)
  396.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+4
  397.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+4
  398.         WriteInt hStreamhandle,nInt
  399. End Function
  400.  
  401. Function WriteShortProgress%(hStreamhandle,nShort%)
  402.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+2
  403.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+2
  404.         WriteShort hStreamhandle,nShort
  405. End Function
  406.  
  407. Function WriteStringProgress$(hStreamhandle,sString$)
  408.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+Len(sString)+2    ;Add 2 for line length short bytes
  409.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+Len(sString)+2  ;Add 2 for line length short bytes
  410.         WriteString hStreamhandle,sString
  411. End Function
  412.  
  413. Function WriteFloatProgress%(hStreamhandle,fFloat#)
  414.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+4
  415.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+4
  416.         WriteFloat hStreamhandle,fFloat
  417. End Function
  418.  
  419. Function WriteByteProgress%(hStreamhandle,nInt%)
  420.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+1
  421.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+1
  422.         WriteByte hStreamhandle,nInt Mod 256
  423. End Function
  424.  
  425. ;--
  426.  
  427. Function WriteBytesStreamProgress(hBank, hStreamHandle,nOffset,nCount)
  428.         WriteBytes hBank,hStreamHandle,nOffset,nCount
  429.         nPROGRESS_STREAM_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+nCount
  430.         nPROGRESS_DIR_CURRENT_BYTES=nPROGRESS_DIR_CURRENT_BYTES+nCount
  431. End Function
  432.  
  433. Function WriteBytesBankProgress(hBank, hStreamHandle,nOffset,nCount)
  434.         WriteBytes hBank,hStreamHandle,nOffset,nCount
  435.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_STREAM_CURRENT_BYTES+nCount
  436. End Function
  437.  
  438. ;--
  439.  
  440. Function PokeByteProgress(hBank%,nOffset%,nByte%)
  441.         PokeByte hBank,nPROGRESS_BANK_CURRENT_BYTES,nByte
  442.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+1
  443. End Function
  444.  
  445. Function PokeIntProgress(hBank%,nOffset%,nInt%)
  446.         PokeInt hBank,nPROGRESS_BANK_CURRENT_BYTES,nInt
  447.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+4
  448. End Function
  449.  
  450. Function PokeFloatProgress(hBank%,nOffset%,fFloat%)
  451.         PokeFloat hBank,nPROGRESS_BANK_CURRENT_BYTES,fFloat
  452.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+4
  453. End Function
  454.  
  455. Function PokeShortProgress(hBank%,nShort%)
  456.         PokeShort hBank,nPROGRESS_BANK_CURRENT_BYTES,nShort
  457.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+2
  458. End Function
  459.  
  460. Function PokeStringProgress(hBank,sString$)
  461.         ;Strings sent to banks do not include Length ShortBytes, but instead have a null terminator
  462.         Local Iter
  463.         Local Byte
  464.         Local Count=Len(sString)+nPROGRESS_BANK_CURRENT_BYTES
  465.        
  466.         For Iter=nPROGRESS_BANK_CURRENT_BYTES To Count
  467.                 Byte=Asc(Mid(sString,Iter,1))
  468.                 PokeByte hBank,Iter,Byte
  469.         Next
  470.         nPROGRESS_BANK_CURRENT_BYTES=nPROGRESS_BANK_CURRENT_BYTES+1;Add terminator
  471.         PokeByte hBank,nPROGRESS_BANK_CURRENT_BYTES,0
  472. End Function
  473.  
  474. ;--
  475.  
  476. Function fProgressStreamPercentage#()
  477.         Return fPercentage(nPROGRESS_STREAM_CURRENT_BYTES,nPROGRESS_STREAM_MAXIMUM_BYTES)
  478. End Function
  479.  
  480. Function fProgressDirPercentage#()
  481.         Return fPercentage(nPROGRESS_DIR_CURRENT_BYTES,nPROGRESS_DIR_MAXIMUM_BYTES)
  482. End Function
  483.  
  484. Function fProgressBankPercentage#()
  485.         Return fPercentage(nPROGRESS_BANK_CURRENT_BYTES,nPROGRESS_BANK_MAXIMUM_BYTES)
  486. End Function
  487.  
  488. ;--
  489.  
  490. Function sProgressStreamTimeRemaining$()
  491.         Local Time#=fCalculateRemainingTime(fProgressStreamPercentage()*0.01,nPROGRESS_STREAM_TIMESTAMP)
  492.         Return TimeText(Time#)
  493. End Function
  494.  
  495. Function sProgressDirTimeRemaining$()
  496.         Local Time#=fCalculateRemainingTime(fProgressDirPercentage()*0.01,nPROGRESS_DIR_TIMESTAMP)
  497.         Return TimeText(Time#)
  498. End Function
  499.  
  500. Function sProgressBankTimeRemaining$()
  501.         Local Time#=fCalculateRemainingTime(fProgressBankPercentage()*0.01,nPROGRESS_BANK_TIMESTAMP)
  502.         Return TimeText(Time#)
  503. End Function
  504.  
  505. Function fPercentage#(nFraction%,nMaximum%)
  506.         If (nFraction=nMaximum)  Then Return 100.0
  507.         If (nFraction)*(nMaximum)
  508.                 Return Float(nFraction)/Float(nMaximum)*100.0
  509.         End If
  510.         Return 0.0
  511. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal