You more or less repeated my post, but whatever.
Now, with the one that check the Mysql database, how would I go about doing that exactly? I still want to keep the RGSS encrypted.
Let's say we have an background file, map1, map2 nad mmapinfos that are 'updatabe'. Now, we can do two things. 1. let these be organized by a mysql database or 2. let these be organized by an textfile.
We start with number 2. First make a file in the server directory called: Versions.txt (any other extension is fine). Now you place in the folowing text:
MapInfos.rxdata Data\\ 3
Map001.rxdata Data\\ 1
Map002.rxdata Data\\ 2
Background.png Graphics\\Titles\\ 2
This is just an example, I choose to separate the Filename, Destination and Version with a space, but you could use any other character, or format. This is just the idea. Now, have the same file be placed in the games Directory. Now I have a ruby server, so I would download the versions file from the client, and then:
files = {}
update = []
# Load Server Versions
# Open file
file = File.open("Updater\Versions.txt", "r");
# Get lines
data = newest.readlines;
# Close File
file.close;
# Get Files that can be updated
data.split("\n").each { |part| part = file.split(" "); files[file[0]] << [file[1],file[2]] }
# Load Client Versions (Array)
# Get current File versions
current = get_client_versions();
# Check Similarities
# Get to update
current.each { |file| next if not files.has_key?(file);
update << file if file[2] < files[file][2] }
# Update
send_client_update();
I hope you get my point. It simply checks for each file the evrsions, compares them, and if they do not match, send down, whether its trough and UPD or TCP, HTTP or FTP socket layer is, the files and update them accordingly. With save_data(file[1] + file[2]). You could hide the versions file in the rgssad with exemplia gratia load_data("Data\Versions.rxdata") or something similar, so you can load the file from the archive.
For the mysql, I used a table with these rows:
I simply connected to the database, and got the table, where version is higher then the clients version. Then for each version, add the FILES to an array. This measn that in that version, those FILES where updated, and in the end, you have all the files. Then use array.unique to filter doubles, and use the same emothd as above with the file version.