AGFile 1.5.1.0

By Tamaki on Dec 21, 2010

Screenshots

This is a fairly USELESS snippet unless you intend to use a few products from me. It's not necessary to have this simply because if you do not already have it, it will be included into any script that i release in which you will need it for.

If that is not the case, then it is here for you to download. The only thing this snippet does is save Install, Registration, and Product ID Information to agfile.ini

To install it, simply load it into your remotes and allow initialization, or restart your IRC client.

Current Version: 1.5.1.1

;AG File;

alias agperm {
  If ($1 == version) { return 1 }
  If ($1 == build) { return .5 }
  If ($1 == release) { return .1.1 }
  If ($1 == product_id) { return S001-1511 }
  If ($1 == title) { return AG_File }
  If ($1 == long) { return 1.5.1.1 }
  If ($1 == author) { return DJ_Bill_Enterprizes,_Inc. }
  If ($1 == description) { return AGFile - Registration system for AuthorityGamer scripts. }
  If ($1 == updateroot) { return www.authoritygamer.com }
  If ($1 == updatepath) { return /AG_File.txt }
}

on *:LOAD: {
  If ($readini(agfile.ini,agfile,installed) != yes) {
    If ($readini(agfile.ini,agfile,registered) != yes) { agfile register agfile $agperm(long) $agperm(title) $agperm(author) yes $agperm(updateroot) $agperm(updatepath) $agperm(description) }
    agfile install agfile $agperm(product_id)
  }
  Else {
    If ($readini(agfile.ini,agfile,version) != $agperm(long)) {
      agfile update agfile $agperm(long) $agperm(title) $agperm(product_id) $agperm(author) yes $agperm(updateroot) $agperm(updatepath) $agperm(description)
    }
  }
}

on *:START: {
  If ($readini(agfile.ini,agfile,installed) != yes) {
    If ($readini(agfile.ini,agfile,registered) != yes) { agfile register agfile $agperm(long) $agperm(title) $agperm(author) yes $agperm(updateroot) $agperm(updatepath) $agperm(description) }
    agfile install agfile $agperm(product_id)
  }
  Else {
    If ($readini(agfile.ini,agfile,version) != $agperm(long)) {
      agfile update agfile $agperm(long) $agperm(title) $agperm(product_id) $agperm(author) yes $agperm(updateroot) $agperm(updatepath) $agperm(description)
    }
  }
}

alias agfile {
  If ($1 == register) {
    If (!$9) { echo -a Registration failed! Missing proper registration codes. | halt }
    writeini agfile.ini $2 version $3
    writeini agfile.ini $2 title $replace($4,$chr($asc(_)),$chr(32))
    writeini agfile.ini $2 author $replace($5,$chr($asc(_)),$chr(32))
    writeini agfile.ini $2 description $9-
    writeini agfile.ini $2 updateable $6
    writeini agfile.ini $2 registered yes
    writeini agfile.ini $2 update_root $7
    writeini agfile.ini $2 update_path $8
  }
  If ($1 == install) {
    If (!$3) { echo -a Installation failed! Missing proper registration codes. | halt }
    If ($readini(agfile.ini,$2,registered) != yes) { echo -a Installation failed! $2 has not been registered yet! | halt }
    writeini agfile.ini $2 product_id $3
    writeini agfile.ini $2 installation_id $+($encode($3, m), -, $asctime(ddmmyyHHnnss))
    writeini agfile.ini $2 installed_date $asctime(ddmmmyyyy)
    writeini agfile.ini $2 installed_time $asctime(hh:nn:ss TT)
    writeini agfile.ini $2 updated_date $asctime(ddmmmyyyy)
    writeini agfile.ini $2 updated_time $asctime(hh:nn:ss TT)
    writeini agfile.ini $2 installed yes
    write agfile.txt $2
  }
  If ($1 == update) {
    If (!$10) { echo -a Update failed! Missing proper registration codes. | halt }
    If ($readini(agfile.ini,$2,installed) != yes) { echo -a Update failed! $2 has not been installed yet! | halt }
    writeini agfile.ini $2 version $3
    writeini agfile.ini $2 title $replace($4,$chr($asc(_)),$chr(32))
    writeini agfile.ini $2 product_id $5
    writeini agfile.ini $2 installation_id $+($encode($5, m), -, $asctime(ddmmyyHHnnss))
    writeini agfile.ini $2 author $replace($6,$chr($asc(_)),$chr(32))
    writeini agfile.ini $2 updateable $7
    writeini agfile.ini $2 update_root $8
    writeini agfile.ini $2 update_path $9
    writeini agfile.ini $2 description $10-
    writeini agfile.ini $2 updated_date $asctime(ddmmmyyyy)
    writeini agfile.ini $2 updated_time $asctime(hh:nn:ss TT)
  }
  If ($1 == uninstall) {
    If (!$2) { echo -a Uninstall failed! Missing proper registration codes. | halt }
    remini agfile.ini $2
    write -ds $+ $2 agfile.txt
  }
  If ($1 == checkinstall) {
    did -a install 11 Checking for completion...
    If ($readini(agfile.ini,status,installing) != yes) {
      did -a install 11 Complete!
      did -v install 13
      unset %installtimer
    }
    Else {
      inc %installtimer
      If (%installtimer > 3) {
        did -a install 11 Installation failed!
      }
      Else {
        did -a install 11 Continuing installation...
        .timer 1 3 agfile checkinstall
      }
    }
  }
  If ($1 == checkupdate) {
    did -a update 11 Checking for completion..
    If ($readini(agfile.ini,status,updating) != yes) {
      did -a update 11 Complete!
      did -v update 13
      unset %updatetimer
    }
    Else {
      inc %updatetimer
      If (%updatetimer > 3) {
        did -a update 11 Installation failed!
      }
      Else {
        did -a update 11 Continuing update...
        .timer 1 3 agfile checkupdate
      }
    }
  }
  If ($1 == info) {
    If (!$2) { echo -a Please provide a CAC for informational display | halt }
    echo -a $replace($readini(agfile.ini,$2,title),$chr($asc(_)),$chr(32)) Information
    echo -a Description: $readini(agfile.ini,$2,description) Author: $replace($readini(agfile.ini,$2,author),$chr($asc(_)),$chr(32))
    echo -a Version: $readini(agfile.ini,$2,version)
    echo -a Installed on: $agind($2) at $agint($2)
    echo -a Last Updated on: $agupd($2) at $agupt($2)
    echo -a Product ID: $agpid($2) Installation ID: $agiid($2)
    echo -a -EOF-
  }
  If ($1 == checkforupdate) {
    If ($readini(agfile.ini,$2,registered) != yes) { echo -a File isn't registered yet! Please register the file before trying to update it. | halt }
    If (!$readini(agfile.ini,$2,update_root)) { echo -a Can not find the update root. | halt }
    If (!$readini(agfile.ini,$2,update_path)) { echo -a Can not find the update path. | halt }
    checkforupdate $2
  }
}

alias checkforupdate {
  If (!$1) { echo -a Missing checkforupdate codes. | halt }
  If ($sock(checkforupdate)) { sockclose checkforupdate }
  writeini agfile.ini checkforupdate current $1
  sockopen checkforupdate $readini(agfile.ini,$1,update_root) 80
}

on *:sockopen:checkforupdate: {
  sockwrite -n checkforupdate GET $readini(agfile.ini,$readini(agfile.ini,checkforupdate,current),update_path) HTTP/1.1
  sockwrite -n checkforupdate HOST $readini(agfile.ini,$readini(agfile.ini,checkforupdate,current),update_root) $+ $str($crlf,2)
  .timer 1 10 sockclose checkforupdate
}

on *:sockread:checkforupdate: {
  If ($sockerr) { echo -a Error | halt }
  Else {
    sockread %temp
    If ($noqt("Current Version") isin %temp) {
      If ($right(%temp,-17) != $agversion($readini(agfile.ini,checkforupdate,current))) {
        echo -a Your version is not currently up to date. We are going to open a webpage for you to download the latest version: $right(%temp,-17)
        .timer 1 3 run $readini(agfile.ini,$readini(agfile.ini,checkforupdate,current),update_root) $+ $readini(agfile.ini,$readini(agfile.ini,checkforupdate,current),update_path)
        sockclose checkforupdate
      }
      Else {
        echo -a Your version is currently up to date.
        sockclose checkforupdate
      }
      If ($dialog(update)) { dialog -x update }
    }
  }
}

on *:TEXT:!agfile*:? {
  If (%agfile == on) { halt }
  set -u3 %agfile on
  If ($2 == version) {
    .msg $nick $readini(agfile.ini,$3,version)
  }
  If ($2 == product_id) {
    .msg $nick $readini(agfile.ini,$3,product_id)
  }
  If ($2 == installation_id) {
    .msg $nick $readini(agfile.ini,$3,installation_id)
  }
  If ($2 == author) {
    .msg $nick $readini(agfile.ini,$3,author)
  }
  If ($2 == description) {
    .msg $nick $readini(agfile.ini,$3,description)
  }
}

alias install {
  If (!$1) { echo -a Missing /install codes! | halt }
  Else {
    If ($readini(agfile.ini,$1,registered) != yes) { echo -a Can not install because service is not registered! Try typing / $+ $1 register | halt }
    If ($readini(agfile.ini,$1,installed) == yes) { echo -a Already installed! | halt }
    set %install $1
    If ($dialog(install) == install) { dialog -x install }
    dialog -md install install
  }
}

alias update {
  If (!$1) { echo -a Missing /update codes! | halt }
  Else {
    If ($readini(agfile.ini,$1,registered) != yes) { echo -a Can not install because service is not registered! Try typing / $+ $1 register | halt }
    If ($readini(agfile.ini,$1,installed) != yes) { echo -a Already installed! | halt }
    set %update $1
    If ($dialog(update) == update) { dialog -x update }
    dialog -md update update
  }
}

alias agversion { return $readini(agfile.ini,$1,version) }
alias agpid { return $readini(agfile.ini,$1,product_id) }
alias agiid { return $readini(agfile.ini,$1,installation_id) }
alias agind { return $readini(agfile.ini,$1,installed_date) }
alias agint { return $readini(agfile.ini,$1,installed_time) }
alias agupd { return $readini(agfile.ini,$1,updated_date) }
alias agupt { return $readini(agfile.ini,$1,updated_time) }

dialog install {
  title Install Guide
  option dbu
  size -1 -1 251 201
  text "Title", 1, 10 10 20 10
  text "", 2, 40 10 200 10, right
  text "Description", 3, 10 30 30 10
  /*
  Description is always 137 characters max. 60 on the first line and 77 on the following one.
  */
  text "123456798012345678901234567890123456789012345678901234567890", 4, 50 30 190 10, right
  text "12345679801234567890123456789012345678901234567890123456789012345678901234567", 5, 10 39 240 10
  text "Version", 6, 10 59 20 10
  text "1234567890", 7, 30 59 210 10, right
  button "Check for Updates", 8, 10 68 231 10, disable
  button "Install", 9, 10 79 231 10
  button "Show Details", 10, 10 90 50 10
  list 11, 10 90 231 91, hide
  button "Cancel", 12, 10 181 30 10, cancel
  button "Finish", 13, 50 181 30 10, hide
}

on *:DIALOG:install:*:*: {
  If ($devent == init) {
    did -ra install 2 $readini(agfile.ini,%install,title)
    did -ra install 4 $left($readini(agfile.ini,%install,description), 60)
    did -ra install 5 $right($readini(agfile.ini,%install,description), -60)
    If ($readini(agfile.ini,%install,updateable) == yes) { did -e install 8 }
    did -ra install 7 $readini(agfile.ini,%install,version)
  }
  If ($devent == sclick) {
    If ($did == 8) {
      did -rab install 8 Please wait while we check for updates...
      did -b install 9,10,12
      agfile checkforupdate %install
    }
    If ($did == 9) {
      did -ra install 9 Please wait while we install $did(2) for you...
      did -b install 8,9
      did -a install 11 Installing $did(2) $+ ...
      writeini agfile.ini status installing yes
      %install install
      .timer 1 3 agfile checkinstall
    }
    If ($did == 10) {
      did -h install 10
      did -v install 11
    }
    If ($did == 13) {
      dialog -x install
      dialog -dmv %install %install
    }
  }
}

dialog update {
  title Update Guide
  option dbu
  size -1 -1 251 201
  text "Title", 1, 10 10 20 10
  text "", 2, 40 10 200 10, right
  text "Description", 3, 10 30 30 10
  /*
  Description is always 137 characters max. 60 on the first line and 77 on the following one.
  */
  text "123456798012345678901234567890123456789012345678901234567890", 4, 50 30 190 10, right
  text "12345679801234567890123456789012345678901234567890123456789012345678901234567", 5, 10 39 240 10
  text "Version", 6, 10 59 20 10
  text "1234567890", 7, 30 59 210 10, right
  button "Check for Updates", 8, 10 68 231 10, disable
  button "Update", 9, 10 79 231 10
  button "Show Details", 10, 10 90 50 10
  list 11, 10 90 231 91, hide
  button "Cancel", 12, 10 181 30 10, cancel
  button "Finish", 13, 50 181 30 10, hide
}

on *:DIALOG:update:*:*: {
  If ($devent == init) {
    did -ra update 2 $readini(agfile.ini,%update,title)
    did -ra update 4 $left($readini(agfile.ini,%update,description), 60)
    did -ra update 5 $right($readini(agfile.ini,%update,description), -60)
    If ($readini(agfile.ini,%update,updateable) == yes) { did -e update 8 }
    did -ra update 7 $readini(agfile.ini,%update,version)
  }
  If ($devent == sclick) {
    If ($did == 8) {
      did -rab update 8 Please wait while we check for updates...
      did -b update 9,10,12
      agfile checkforupdate %update
    }
    If ($did == 9) {
      did -ra update 9 Please wait while we update $did(2) for you...
      did -b update 8,9
      did -a update 11 Updating $did(2) $+ ...
      writeini agfile.ini status updating yes
      %update update
      .timer 1 3 agfile checkupdate
    }
    If ($did == 10) {
      did -h update 10
      did -v update 11
    }
    If ($did == 13) {
      dialog -x update
      dialog -dmv %update %update
    }
  }
}

alias re { $1- }

Comments

Sign in to comment.
Tamaki   -  Nov 02, 2012

Since I now maintain a web server, all my updates for scripts (including this one) will be hosted there. For more information, send me a message on here.

The directory will be listed in scripts that are update-able via the AG File console.

 Respond  
Tamaki   -  Apr 18, 2011

Almost bit the dust there, fixed a minor error where it wouldn't open the right page...but it's all good now ^_^ enjoy :P

 Respond  
Tamaki   -  Apr 18, 2011

BTW! If you use Check for Update and it gives you a weird error, like can't find root or path...it's because you have an out-dated version of the script you're trying to update. As in, you can use the Check for Update with that script unless you manually update it via this website. Sorry about that, but after you update it to the version that works with the AGFile, Check for Update should work. I'll be updating all my worth-while scripts over the next couple of days so bear with me.

 Respond  
Tamaki   -  Apr 18, 2011

Finally figured out sockets. Check for Update works now! :D
I'm gonna upload some screen shots soon...hopefully.

 Respond  
Tamaki   -  Jan 31, 2011

still looking for people to help out with sockets should they be interested, i'd like to get this finished before i get deployed :P

 Respond  
Tamaki   -  Dec 25, 2010

sure, come to my server plz :D irc.authoritygamer.com

 Respond  
IllogicTC   -  Dec 25, 2010

I'm good at messing up sockets.

Am I in?

 Respond  
blackvenomm666   -  Dec 22, 2010

might be better if you find someone who is good at sockets that will help you rather than say if they want to help ya. i suggest napa182 or fordlawnmower.

 Respond  
Tamaki   -  Dec 21, 2010

BTW!!! Check for update doesn't work yet, but if anyone would be interested in helping me with sockets (because i can't figure them out) please contact me at jason@authoritygamer.com

 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.