home *** CD-ROM | disk | FTP | other *** search
/ napalm.napnet.hu / 2015-02-12.napalm.napnet.hu.tar / napalm.napnet.hu / programok / kommunikacio / mpp700.exe / nGZIPn.mrc < prev    next >
Text File  |  2003-05-13  |  3KB  |  112 lines

  1. ; nGZIPn.DLL sample (c) 2001 Necroman - necroman@europe.com, #mIRC @ Undernet
  2.  
  3. on *:start: {
  4.   ;  if ($version < 5.8) { ;echo -a Sorry - this sample needs mIRC 5.8x | .disable #nGZIPn }
  5.   ;  elseif ($isfile(nGZIPn.dll) == $false) { ;echo -a Sorry - this sample needs GZIP.DLL in the ' $+ $mircdir $+ ' folder | .disable #nGZIPn }
  6.   ;  else {
  7.   ;    ;echo -a Found $dll(nGZIPn,version,0) 
  8.   ;    ;echo -a Type /gz to start the sample
  9.   .enable #nGZIPn
  10.   ;  }
  11.  }
  12.  
  13. #ngzipn on
  14.  
  15.   alias gz { dialog -md nGZIPn nGZIPn }
  16.  
  17.   alias -l nGZIPn { return $dll(nGZIPn,zip,$1-) }
  18.   alias -l gunzip { return $dll(nGZIPn,unzip,$left($1-,-3)) }
  19.  
  20.   alias -l list_dir {
  21.     did -r nGZIPn 50,90
  22.     var %files = $findfile($did(nGZIPn,20),*.*,0,1,did -ia nGZIPn $iif($right($1-,3) == .gz,90,50) $nopath($1-))
  23.   }
  24.  
  25.   on *:dialog:nGZIPn:init:0:{
  26.     did -ra nGZIPn 20 $mircdir
  27.     list_dir  
  28.   }
  29.  
  30.   on *:dialog:nGZIPn:sclick:*:{
  31.  
  32.     ;compressed files  
  33.     if ($did == 50) {
  34.       did -u nGZIPn 90
  35.       var %c = $did(50,0).sel, %size = 0, %d = %c
  36.       while %c {
  37.         var %file = $did(20) $+ $did(50,$did(50,%c).sel)
  38.         %size = %size + $file(%file).size   
  39.         dec %c
  40.       }
  41.       did -ra nGZIPn 100 %size bytes in %d file(s)    
  42.     }
  43.  
  44.     ;uncompressed files
  45.     if ($did == 90) {
  46.       did -u nGZIPn 50
  47.       var %c = $did(90,0).sel, %size = 0, %d = %c
  48.       while %c {
  49.         var %file = $did(20) $+ $did(90,$did(90,%c).sel)
  50.         %size = %size + $file(%file).size   
  51.         dec %c
  52.       }
  53.       did -ra nGZIPn 100 %size bytes in %d file(s)    
  54.     }
  55.  
  56.     ;choose directory
  57.     if ($did == 30) {
  58.       var %dir = $sdir($did(20))    
  59.       if %dir { did -ra nGZIPn 20 %dir }
  60.       list_dir
  61.     }
  62.  
  63.     ;compress
  64.     if ($did == 60) {
  65.       var %c = 1, %d = $did(50,0).sel 
  66.       while (%c <= %d) {
  67.         var %file = $did(20) $+ $did(50,$did(50,%c).sel)
  68.         did -ra nGZIPn 100 Zipping file: %file
  69.         if ($true != $nGZIPn(%file)) { did -ra nGZIPn 100 Unable to zip: %file | break }    
  70.         inc %c
  71.       }
  72.       list_dir
  73.       did -ra nGZIPn 100 %d file(s) zipped OK
  74.     }
  75.  
  76.     ;decompress
  77.     if ($did == 70) {
  78.       var %c = 1, %d = $did(90,0).sel
  79.       while (%c <= %d) {
  80.         var %file = $did(20) $+ $did(90,$did(90,%c).sel)
  81.         did -ra nGZIPn 100 Unzipping file: %file
  82.         if ($true != $gunzip(%file)) { did -ra nGZIPn 100 Unable to unzip: %file | break }    
  83.         inc %c
  84.       }
  85.       list_dir
  86.       did -ra nGZIPn 100 %d file(s) unzipped OK
  87.     }
  88.   }
  89.  
  90.   ;Dialog Grabber 5.82 - date: 29.01.2001
  91.   ;(c) 2000 Necroman - necroman@europe.com, irc://irc.undernet.org/mIRC
  92.  
  93.   dialog nGZIPn {
  94.     title "nGZIPn Sample"
  95.     size -1 -1 273 127
  96.     option dbu
  97.     text "Current folder", 10, 6 6 108 6, group
  98.     edit "", 20, 6 16 228 10, autohs
  99.     button "...", 30, 240 16 24 10
  100.     text "Uncompressed files", 40, 6 32 57 6, group
  101.     list 50, 6 42 114 71, sort, extsel, size, hsbar, vsbar
  102.     button ">>", 60, 126 55 21 19
  103.     button "<<", 70, 126 81 21 19
  104.     text "Compressed files", 80, 153 32 60 6, group
  105.     list 90, 153 42 114 71, sort, extsel, size, hsbar, vsbar
  106.     text "Ready", 100, 6 117 261 10, group
  107.     button "fake1", 110, 510 3 9 6, ok
  108.     button "fake2", 120, 510 3 9 6, default
  109.   }
  110.  
  111.   #nGZIPn end
  112.