FOnline Development > Tools

FOUpdaterEx [v0.2.1]

(1/2) > >>

Wipe:
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: ---<crc> <size> <filename> [options]
--- End code ---
Defines file which should be checked during update. 'options' part is optional,  uses same names as SDK UpdateServer, separated by comma.


--- Code: ---config <variable> <value>
--- End code ---
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: ---updater <size> <filename> <version>
--- End code ---
[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.

Gob:
Very nice :). Maybe if I had the src I could remake it in vb.net , which would me easier to understand for others.

Wipe:

--- Quote from: Gob 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.

--- End quote ---
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).

Gob:
So when will you release the code for it?

jan0s1k:
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) ---#!/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

--- End code ---
Or if you prefer to wget it, then it's here: http://jan0s1k.fode.eu/fonline/updater.sh

Navigation

[0] Message Index

[#] Next page

Go to full version