alias blog {  
  if !$dialog(blog) { .dialog -m  blog blog }
  else { return }
}

dialog blog {
  title "..: SohbetSen Cafe - Log Okuyucu :.."
  size -1 -1 485 232
  list 1, 2 6 312 220, size
  box "Log Dosya Bilgisi", 9, 315 2 168 152
  text "Oluşturulma Zamanı", 10, 322 30 140 13
  text "Son Değiştirme Zamanı:", 11, 322 70 140 13
  text "Dosya Büyüklüğü", 12, 322 110 140 13
  box "Log İşlemi", 13, 315 167 168 58
  text "", 14, 322 45 155 13
  text "", 15, 322 85 155 13
  text "", 16, 322 125 155 13
  button "Göster", 17, 332 190 45 21, flat
  button "Sil", 18, 379 190 45 21, flat
  button "Kapat", 19, 426 190 45 21, ok, flat
}

on 1:DIALOG:blog:*:*: {
  if ($devent == init) { 
  { Splay $mircdirSohbetSen\sounds\Menu.wav }
    mdx.
    mdx SetColor $dname 1,9,10,11,12,13,14,15,16,17,18,19 text 200
    mdx SetFont $dname 1,9,10,11,12,13,14,15,16,17,18,19 12 500 verdana
    set %blog.dir $logdir
    blog.finddir
  }
  if ($devent == sclick) { 
    if ($did == 1) {   
      if (*.log iswm $did(blog,1,$did(blog,1).sel).seltext) {
        did -r blog 14,15,16
        var %blog.arquivo $+(%blog.dir,$did(blog,1,$did(blog,1).sel).seltext)
        did -a blog 14 $asctime($file(%blog.arquivo).ctime)
        did -a blog 15 $asctime($file(%blog.arquivo).mtime)
        did -a blog 16 $bytes($file(%blog.arquivo),k).suf
      }
    }
    if ($did == 17) {  window @log | loadbuf -rp @log $+(",%blog.dir,$$did(blog,1,$did(blog,1).sel).seltext,") }
    if ($did == 18) {  .remove $+(",%blog.dir,$$did(blog,1,$did(blog,1).sel).seltext,") | did -d blog 1 $did(blog,1).sel  }
    if ($did == 21) { window @log | loadbuf -rp @log $+(",%blog.dir,$$did(blog,1,$did(blog,1).sel).seltext,") }
  }
  if ($devent == dclick) { 
  }
}


alias as1 {
  if ($1) {
    if ($left($1,1) == *) {
      var %r $1-
      goto 2
    }
    var %r $+(*,$1-)
    :2
    if ($right($1-,1) == *) {
      var %r [ %r ]
      goto 3
    }
    var %r $+(%r,*)
    :3
    return %r
  }
  return *
}

alias blog.findfile1 {
  did -r blog 1
  window -hs @logview
  window -hs @logview1
  set %blog 0
  :comeco
  inc %blog
  tokenize 32 $findfile(%blog.dir,%blog.nome,%blog)
  var %blog1 $wildtok($1-,*,0,92) 
  var %blog3 $+(1-,[ [  $calc(%blog1 - 1) ] ])
  var %blog2 $+($gettok($1-,[ [ %blog3 ] ],92),\)
  if (%blog2) {
    if (%blog2 == %blog.dir) && (%blog.text != *) {
      filter -p $+(",$1-,") @logview1 %blog.text
      if ($filtered) {
        did -r blog 1
        aline @logview $remove($1,%blog.dir)
        goto comeco
      }
      goto comeco
    }
    if (%blog2 == %blog.dir) {
      aline @logview $remove($1,%blog.dir)
      goto comeco
    }
  }
  if ($line(@logview,1)) {
    set %blog 1
    did -a blog 1 [..]
    while ($line(@logview,%blog)) {
      did -a blog 1 $line(@logview,%blog)
      inc %blog
    }
  }
  else {
    did -a blog 1 [..]
    did -a blog 1 Dosya adı Geçersiz, bulunamadı.
  }
  set %blog.busca CURIOSO!!!
  window -c @logview1
  window -c @logview
}
alias blog.finddir {
  var %blog 0 
  if (%blog.dir != $logdir) {
    did -a blog 1 [..]
  }
  :comeco
  inc %blog
  tokenize 32 $finddir(%blog.dir,*,%blog)
  var %blog1 $wildtok($1-,*,0,92) 
  var %blog3 $+(1-,[ [  $calc(%blog1 - 1) ] ])
  var %blog2 $+($gettok($1-,[ [ %blog3 ] ],92),\)
  if (%blog2 == %blog.dir) {
    did -a blog 1 $+([,$remove($1-,%blog.dir),])
    goto comeco
  }
  blog.findfile
}
alias blog.findfile {
  window -sh @logview
  var %blog 0 
  :comeco
  inc %blog
  tokenize 32 $findfile(%blog.dir,*.log,%blog)
  var %blog1 $wildtok($1-,*,0,92) 
  var %blog3 $+(1-,[ [  $calc(%blog1 - 1) ] ])
  var %blog2 $+($gettok($1-,[ [ %blog3 ] ],92),\)
  if (%blog2 == %blog.dir) {
    aline @logview $remove($1-,%blog.dir)
    goto comeco
  }
  var %blog 1
  while ($line(@logview,%blog)) {
    did -a blog 1 $line(@logview,%blog)
    inc %blog
  }
  window -c @logview
}
