I want to check for a file via http then check on line one for a version number and compare it to the $Pref::Version one. One line two of the http file, it'll be the file to download IF it's older then $Pref::Version. Any help appreaciated.
function updateGame()
{
%gameUpdater = new HTTPObject(gameUpdater);
%gameUpdater.FilePath = "~/updates/" @ $updateFile;
%gameUpdater.get("JookScript.googlepages.com:80","/BRLatestVersion.txt");
if( isFile(%FilePath) && !%append)
{
%FileClearer = new FileObject();
%FileClearer.openForWrite(%FilePath);
%FileClearer.close();
%FileClearer.delete();
}
}
function getLatestVersion::onLine(%this, %line)
{
if(firstWord(%line)) $= "Version")
{
%latestVersion = restWords(%line);
if($pref::BuildingResort::currentVersion < %latestVersion)
{
getLatestVersion.update();
}
}
}
function getLatestVersion::update(%this, %line, %)
{
if( isFile(%FilePath) && !%append)
{
%FileClearer = new FileObject();
%FileClearer.openForWrite(%FilePath);
%FileClearer.close();
%FileClearer.delete();
}
%File=new FileObject();
%File.openForAppend(%this.FilePath);
%File.writeLine(%line);
%File.close();%File.delete();
}