Csetup

By kibo on Oct 25, 2011

This is my connection manager, I used mainly MDX and DCX only an effect and Popups.dll.Comments are in Italian.

Aliases to include:

pop { tokenize 32 $dll($shortfn(dll\popups.dll),Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-) }
popups { return dll " $+ $mircdir $+ dll\POPUPS.DLL $+ " }
mdx { return dll " $+ $mircdir $+ DLL\mdx.dll $+ " }

and dcx_tools.mrc for DCX

;--------------------------
;Proscript ver 0.1 by kibo |
;--------------------------
;@rfs csetup

;Questo Programma gestisce le connessioni

;Alias

alias csetup { dialog -m csetup csetup }
alias aserv  { dialog -m adserv adserv }
alias xasetup { xdialog -a csetup +u 1000 }

;Dialog Csetup

dialog csetup {
  title "ProScript Server-Setup"
  size  -1 -1 174 128
  option dbu
  box "ProScript Server-Setup", 1, 1 0 172 111

  list 3, 9 9 155 72, size
  button "Esci", 4, 90 115 30 10, ok
  button "Collegati", 19, 55 115 30 10,
  text "Server:", 9, 20 99 21 8
  edit "", 10, 40 98 43 9, return autohs
  text "ProScript Server-Setup", 11, 56 85 74 8, disable
  box "", 12, 1 109 172 18
  text "Porta:", 14, 93 99 16 8
  edit "", 15, 110 98 22 9, return autohs
  list 18, 2 8 169 100, hide size
}

;Appena si apre la Dialog

on *:dialog:csetup:*:*: {
  if ($devent == init) {
    dcx Mark csetup csetup_cb

    $mdx SetMircVersion $version 
    $mdx MarkDialog $dname
    $mdx SetControlMDX $dname 3 listview report grid > DLL\views.mdx

    did -i $dname 3 1 headerdims 400:1
    did -i $dname 3 1 headertext + 0 Server

    xdialog -b csetup +tc

    ;Scriviamo i server base

    ;did -a $dname 3 irc.tin.it:6667
    ;did -a $dname 3 gamma.azzurra.org:6667 

    ;Carichiamo i dato da Server.txt

    %x = 1 | %y = $lines($shortfn($mircdir\Server.txt))
    :loop
    set %l $read -l $+ %x $shortfn($mircdir\Server.txt)
    did -a $dname 3 %l
    if (%x == %y) { goto fine }
    else { inc %x | goto loop }
    :fine
    xdialog -a csetup +v 1000
  }
  if ($devent == sclick) {
    if ($gettok($did($dname,3,1),1,32) = rclick) {
      if ($did == 3) {
        $popups New per 16 16
        $popups LoadImg per icon small 0,Images\Add.ico
        $popups LoadImg per icon small 0,Images\Cancel.ico
        $popups AddItem per end 1 1 Aggiungi Server $cr aserv
        $iif(($did(3).sel),$popups AddItem per end 2 2 Rimuovi Server  $cr rserve)
        Pop per $mouse.dx $mouse.dy
      }
    }
    if ($did == 19) {
      server $did(10).text $+ : $+ $did(15).text
    }

  }
  ;Doppio Click
  if ($devent == dclick) {
    if ($did = 3) {
      ;echo -s $did(3).seltext
      %z = $gettok($did(3).seltext,6-,32)
      %ip = $gettok(%z,1,58)
      %porta = $gettok(%z,2,58)
      ;echo -s %ip
      ;echo -s %porta
      did -r $dname 10
      did -r $dname 15     
      did -a $dname 10 %ip
      did -a $dname 15 %porta
    }
  }  

}

alias csetup_cb { }

;------------------------------------------------------------------------------------------

dialog adserv {
  title "ProScript -- Aggiungi Server"
  size -1 -1 102 36
  option dbu
  edit "", 1, 9 7 69 10
  edit "", 2, 9 23 29 10
  button "Aggiungi", 3, 49 24 45 8
  text "Server", 4, 10 0 24 6
  text "Porta", 5, 10 17 25 7
  button "Button", 6, 59 63 37 12, ok cancel
}

;--------------------------------------------------------------------------------------------
;Quando aggiungo un server non solo lo aggiunge alla lista ma aggiorna il file server.txt    |   
;con il nuovo server e porta  questo file servire successivamente per ricaricare il server   | 
;aggiunto all'interno della lista                                                            | 
;--------------------------------------------------------------------------------------------

on *:dialog:adserv:*:*:{
  if ($devent == sclick) { 
    if ($did = 3) {
      did -a csetup 3 $did(1).text $+ : $+ $did(2).text
      write server.txt $did(1).text $+ : $+ $did(2).text
      dialog -x adserv adserv
    }
  }
}

alias rserve  {  
  %x = 1
  %y = $did(3).lines
  %z = 2

  ;Stampa tutti i server

  ;echo -s 4STAMPO TUTTI I SERVER

  while (%x != %y) {
    ;echo -s $gettok($did(3,%z).text,6-,32)
    inc %z
    inc %x
  }

  ;Salva tutti i Server sul file Server2.txt tranne il Server selezionato
  ;il file si trova nella directory predefinita dello script
  ;p.s Bisogna prima resettare il file Server2.txt e poi ci si puo' scrivere
  ;la lista server,naturalmente escusa quella selezionata.

  %x = 2
  %y = $did(3).lines + 1
  %z = 2

  ;/echo -s 4STAMPO TUTTI I SERVER ESCLUSO $+ : $+ 8 $gettok($did(3).seltext,6-,32)

  ;Resetto il file prima di scriverlo usando il parametro -c
  /write -c Server2.txt

  while (%x != %y) {
    if (%x != $did(3).sel) {
      ;echo -s $gettok($did(3,%z).text,6-,32)
      /write Server2.txt $gettok($did(3,%z).text,6-,32)
    }
    inc %z
    inc %x
  }

  ;Cancelliamo la lista dei Server.txt

  write -c Server.txt

  ;Copiamo i Dati da Server2.txt a Server.txt

  %x = 1 | %y = $lines($shortfn($mircdir\Server2.txt))
  :loop
  set %l $read -l $+ %x $shortfn($mircdir\Server2.txt)
   write Server.txt %l
  if (%x == %y) { goto fine }
  else { inc %x | goto loop }
  :fine

  ;Riavvio il csetup

  dialog -x csetup csetup
  dialog -m csetup csetup

}

}

Comments

Sign in to comment.
VxD aka DEATHJ0KER   -  Oct 25, 2011

excellent kibo
I told you ... you're wrong to abandon the team ;)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.