Author Topic: FOUpdaterEx [v0.2.1]  (Read 13417 times)

Offline Wipe

  • Rotator
  • Random is god
FOUpdaterEx [v0.2.1]
« on: September 28, 2012, 04:36:30 pm »
FOUPDATER

FOUpdater is small application, that can be used as a replacement of original Updater which comes with FOnline SDK. Unlike original version, this one allows to define more than one source of files to update with ability to randomize such list (what makes creating very primitive mirror system possible).

Program was originally written for NSIS and used only HTTP protocol; it's been rewritten now from scratch, as i couldn't look at this code anymore and wanted to write something more readable :] Updating game files thru HTTP, and providing additional info about them is still taken as major FOUpdater feature but nothing stop anyone from using it on servers which uses default UpdateServer only - both version of its protocol are supported.

For people who still like command-line tools (hey, it's me), console version is prepared :)

UPDATE SOURCE TYPES

Each update source is defined as URI-like string which defines how it should be handled and address of end-point (with addtional info in case of STREAM source, see below)
<sourceType>://<sourceAddress>/

STREAM
stream://<server>/<port>/<version>/
Traditional source of updates for FOnline serves, since SDK release.
'port' and 'version' are optional; default values: port = 4040, version = 1

HTTP
http://<url>/
First, and most supported update type for FOUpdater, using following syntax:

Code: [Select]
<crc> <size> <filename> [options]Defines file which should be checked during update. 'options' part is optional,  uses same names as SDK UpdateServer, separated by comma.

Code: [Select]
config <variable> <value>Any time FOUpdater encounter such line, "Updater" section of FOnline.cfg (or file defined with /config switch) is automagically updated with given values. That way, adding new mirrors is possible without forcing user to change config every time it's done. Only adding/overwriting entries is possible.

Code: [Select]
updater <size> <filename> <version>[TODO]

See also FOUpdater.php included in package, which isn't best php on earth but does its job on creating files list in two ways: used internally by FOUpdater and bit more human-friendly form.
Example: http://fonline2238.net/update/

CONFIG FILE

(required) Source[ID]=<address>
Defines one or more sources which will be used to update files. ID has to start from 0, next sources must have ID greater by one (for example, having only Source0 and Source2 will make Source2 ignored). Maximum ID can be 4294967295.
If for some reason first source is not available (or application failed to download any file from it), next one is checked until list ends.

(optional) RandomSource=<0/1>
If set to '1', randomizes sources list.

(optional) Run=<executable>,<text>
              Run=<executable>
If present, after pressing one of buttons <executable> is started.

COMMAND LINE

/autoexit
--autoxeit
Closes FOUpdater after checking all files

/config:<filename>
--config:<filename>
Defines which file should be used to read/save configuration. Default: FOnline.cfg

/source:<address>
--source:<address>
Defines single source address which will be used to check for files, uses same format as Source* in config file. Best if used together with HTTP source, application can serve then as (very) minimalistic installer.

DOWNLOAD

Current version
http://fonline2238.net/~wipe/sdk/FOUpdaterEx-0.2.1.zip

KNOWN ISSUES

  • Non-english filenames may be saved with wrong name or make application stuck. (found by Sybil, stream://46.165.192.91/4040/1/)

CHANGELOG

v0.2.1 - rewritten to C#, .NET 2.0
v0.1.3 - added translation table
v0.1.2 - first public release

TODO

  • Project
    • Get rid of bugs :)
    • Prepare/finish additional tools.
    • Clean and release source.
  • Core
    • FTP as possible source. (HTTP fork)
    • ??? Custom UpdateServer, merging functionality of Stream and HTTP sources.
    • ??? Allow to translate any text used without need of recompilation (stored in .cfg file?)
  • Application
    • Prevent possible problems when total size of files to update is >= 2GB.
    • HTTP/FTP:
      • Inform user when new version of updater is available; check done locally (per server) instead global one.
Games are meant to be created, not played...

Offline Gob

  • The Good
Re: FOUpdaterEx [v0.2.1]
« Reply #1 on: September 28, 2012, 08:58:38 pm »
Very nice :). Maybe if I had the src I could remake it in vb.net , which would me easier to understand for others.

Offline Wipe

  • Rotator
  • Random is god
Re: FOUpdaterEx [v0.2.1]
« Reply #2 on: September 28, 2012, 09:20:06 pm »
Very nice :). Maybe if I had the src I could remake it in vb.net , which would me easier to understand for others.
Yay! I was waiting for first source-related post! :D
I'm going to publish source once i finish documenting it (/// ftw), it's actually only thing which stops me from doing it now... so, have faith, it's "close future", not "soon". But before it happen - i've separated whole FOUpdater code into single, independent FOUpdaterClient class, what - i hope - should help others to use it as part of their own applications (like launchers etc).
Games are meant to be created, not played...

Offline Gob

  • The Good
Re: FOUpdaterEx [v0.2.1]
« Reply #3 on: November 14, 2012, 01:23:17 pm »
So when will you release the code for it?

Offline jan0s1k

  • If it bleeds we can kill it...
    • Chosen Soldiers
Re: FOUpdaterEx [v0.2.1]
« Reply #4 on: March 21, 2013, 02:37:04 pm »
If anyone is using this updater for their server, recently I've made updater for linux. You need to have perl with String::CRC32 to use it. It's first version, it doesn't support config file, multiple servers, "ignore" and "always" yet, but I'll make it later as well.
Code: (bash) [Select]
#!/bin/sh
# bash FOUpdater
# by jan0s1k
VERSION="0.1.0"
SERVER="http://fonline2238.net/update/"
FOD=$(pwd)
wget -O index "$SERVER" --user-agent="FOUpdater/$VERSION"
LINES=`cat index | wc -l`
for i in `seq 1 $LINES`
do
 FILE=`cat index | awk "NR==$i" |awk '{print $3;}'`
 CRC=`cat index | awk "NR==$i" |awk '{print $1;}'`
 NOREWRI=`cat index | awk "NR==$i" |awk '{print $4;}'`
 if [ ! -f $FOD/$FILE ] && [ $CRC != 'updater' ] && [ $CRC != 'config' ]
 then
  wget $SERVER/$FILE --force-directories -nH
 else
  if [ $CRC != 'updater' ] && [ $CRC != 'config' ] && [ $CRC != `perl -e 'use String::CRC32; open(file,$ARGV[0]); $crc=$
  then
   wget -O $FILE $SERVER/$FILE
  fi
 fi
done
Or if you prefer to wget it, then it's here: http://jan0s1k.fode.eu/fonline/updater.sh
« Last Edit: March 21, 2013, 02:46:02 pm by jan0s1k »


Offline Wipe

  • Rotator
  • Random is god
Re: FOUpdaterEx [v0.2.1]
« Reply #5 on: April 05, 2013, 11:52:31 pm »
So when will you release the code for it?
Now. It's still not documented as good i'd want, but maybe someone will survive reading mah code and maybe even catch current bugs :)

https://github.com/wipe2238/FOUpdaterEx
Games are meant to be created, not played...

Offline Gob

  • The Good
Re: FOUpdaterEx [v0.2.1]
« Reply #6 on: April 06, 2013, 05:29:42 pm »
Oh nice, I'm going to have fun with this.