All pastes #206636 Raw Edit

flashfxpscript

public text v1 · immutable
#206636 ·published 2006-10-17 14:26 UTC
rendered paste body
ALIAS flashfxp {
  var %check = $flashfxp.info(misc,dir)
  if (ER_flashfxp* iswm %check) {
    /flashfxp.set
    set %check $flashfxp.info(misc,dir)
    if (ER_flashfxp* iswm %check) return
  }
  if ($1 == speed) .flashfxp.out Constant Datastream off FXP $flashfxp.info(fx,spe) Upload $flashfxp.info(up,spe) Download $flashfxp.info(do,spe) $logo
  elseif ($1 == average) .flashfxp.out Average Datastream off FXP $flashfxp.info(fx,ave) Upload $flashfxp.info(up,ave) Download $flashfxp.info(do,ave) $logo
  elseif ($1 == upload) .flashfxp.out Upload Statistics Total Amount $flashfxp.info(up,amo) $logo
  elseif ($1 == download) .flashfxp.out Download Statistics Total Amount $flashfxp.info(do,amo) $logo
  elseif ($1 == fxp) .flashfxp.out FXP Statistics Total Amount $flashfxp.info(fx,amo) $logo
  else flashfxp.out $lt $c(1) $+ FlashFXP Stats $rt $c(2) $+ Upload $lt $c(1) $+ $flashfxp.info(up,amo) $rt $c(2) $+ Download $lt $c(1) $+ $flashfxp.info(do,amo) $rt $c(2) $+ Total $lt $c(1) $+ $flashfxp.info(misc,total) $rt $logo
}
ALIAS -l flashfxp.out $iif($active ischan || $query($active) || $chat($active),say ,echo -ae * FlashFXP stats:) $1-



ALIAS flashfxp.set {
  var %dir = $iif($isdir($1-),$1-,$sdir($iif($1,$1-,c:\) ,Select your FlashFXP directory:, Select))
  if (%dir) && ($isfile(%dir $+ stats.dat)) set %flashfxp::dir %dir
  else .flashfxp.error directory or stats.dat not found $+(",%dir,")
}
ALIAS flashfxp.info {
  ;parameter and file error checking
  if (!$isid) return
  if (!$1) return ER_flashfxp Invalid parameters
  var %file = $+(%flashfxp::dir,$iif($right(%flashfxp::dir,1) != \,\),stats.dat)
  if (!$isfile(%file)) return ER_flashfxp stats.dat not found

  ;caching information if needed
  if (!%flashfxp::time) set -u5 %flashfxp::time $calc(($left($readini(%file,n,#Total#,LR),5) -25569) *86400)
  if (!%flashfxp::date) set -u5 %flashfxp::date $asctime(%flashfxp::time,dd.mm.yy)
  if (!%flashfxp::bytes_Fxp) set -u5 %flashfxp::bytes_Fxp $readini(%file,#total#,X)
  if (!%flashfxp::bytes_Upload) set -u5 %flashfxp::bytes_Upload $readini(%file,#total#,FU)
  if (!%flashfxp::bytes_Download) set -u5 %flashfxp::bytes_Download $readini(%file,#total#,FD)
  if (!%flashfxp::bytes_Total) set -u5 %flashfxp::bytes_Total $calc(%flashfxp::bytes_Fxp + %flashfxp::bytes_Upload + %flashfxp::bytes_Download)

  ;Gathering information and returning it
  if (up* iswm $1) {
    if (spe* iswm $2) return $round($calc((%flashfxp::bytes_Upload /1024) / ($ctime - %flashfxp::time)),2) KB/sec
    elseif (ave* iswm $2) return $round($calc((%flashfxp::bytes_Upload /1024^2) / (($ctime - %flashfxp::time) /86400)),2) MB/Day
    elseif (amo* iswm $2) return $round($calc(%flashfxp::bytes_Upload /1024^ $iif(%flashfxp::bytes_Upload >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Upload >= 1000000000,GB,MB)
    else return $lt $c(1) $+ FlashFXP Stats $rt $c(2) $+ Total Uploaded $lt $c(1) $+ $round($calc(%flashfxp::bytes_Upload / 1024^ $iif(%flashfxp::bytes_Upload >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Upload >= 1000000000,GB,MB) $rt $logo
  }
  elseif (do* iswm $1) {
    if (spe* iswm $2) return $round($calc((%flashfxp::bytes_Download /1024) / ($ctime - %flashfxp::time)),2) KB/sec
    elseif (ave* iswm $2) return $round($calc((%flashfxp::bytes_Download /1024^2) / (($ctime - %flashfxp::time) /86400)),2) MB/Day
    elseif (amo* iswm $2) return $round($calc(%flashfxp::bytes_Download /1024^ $iif(%flashfxp::bytes_Download >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Download >= 1000000000,GB,MB)
    else return $lt $c(1) $+ FlashFXP Stats $rt $c(2) $+ Total Downloaded $lt $c(1) $+ $round($calc(%flashfxp::bytes_Download / 1024^ $iif(%flashfxp::bytes_Download >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Download >= 1000000000,GB,MB) $rt $logo
  }
  elseif (fx* iswm $1) {
    if (spe* iswm $2) return $round($calc((%flashfxp::bytes_Fxp /1024) / ($ctime - %flashfxp::time)),2) KB/sec
    elseif (ave* iswm $2) return $round($calc((%flashfxp::bytes_Fxp /1024^2) / (($ctime - %flashfxp::time) /86400)),2) MB/Day
    elseif (amo* iswm $2) return $round($calc(%flashfxp::bytes_Fxp /1024^ $iif(%flashfxp::bytes_Fxp >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Fxp >= 1000000000,GB,MB)
    else return Speed: $round($calc((%flashfxp::bytes_Fxp /1024) / ($ctime - %flashfxp::time)),2) KB/sec Average: $round($calc((%flashfxp::bytes_Fxp /1024^2) / (($ctime - %flashfxp::time) /86400)),2) MB/Day Amount: $round($calc(%flashfxp::bytes_Fxp / 1024^ $iif(%flashfxp::bytes_Fxp >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Fxp >= 1000000000,GB,MB)
  }
  elseif (mi* iswm $1) {
    if ($2 == date) return %flashfxp::date
    elseif ($2 == time) return $asctime(%flashfxp::time,HH:nn:ss)
    elseif ($2 == file) return %file
    elseif ($2 == total) return $round($calc(%flashfxp::bytes_Total /1024^ $iif(%flashfxp::bytes_Total >= 1000000000,3,2)),2) $iif(%flashfxp::bytes_Total >= 1000000000,GB,MB)
    elseif ($2 == author) return dJabba
    elseif ($2 == version) return version 0.3
    elseif ($2 == dir) || ($2 == path) return %flashfxp::dir
    else return FlashFXP Plugin By ImaFia
  }
}
ALIAS -l flashfxp.error $iif($active ischan || $query($active) || $chat($active),echo -a,echo -ae) * /FlashFXP: error, $1-