Shady?
2008-09-13 15:34:40
NEW VERSION IS OUT:
Well, seeing as no one replyed, i remade this:
Var
Download: TStringArray;
Downloaded: Array[0..10] Of String;
IHI, Files: Integer;
currentver, currentversion: string;
const
thisversion = 98;
Procedure DownloadFiles;
Begin
For IHI := 0 To High(Download) Do
Begin
Downloaded[ihi] := GetPage('http://scarreflection.googlecode.com/svn/trunk/' + Download[ihi]);
WriteLn(download[ihi]);
End;
End;
Procedure Install;
Begin
For Ihi := 0 To High(Download) Do
Begin
Files := RewriteFile(AppPath + '\Includes\SRL\SRL\Reflection\' + Download[ihi], False);
WriteFileString(Files, Downloaded[ihi]);
CloseFile(Files);
End;
End;
Procedure UpdateReflection;
begin
Download := ['Changelog.txt', 'Characters.Scar', 'Core.scar',
'Depreciated.scar', 'Hooks.Scar', 'Objects.Scar', 'README.txt',
'Reflection.Scar', 'Walking.Scar', 'Items.scar'];
currentver := GetPage('http://scarreflection.googlecode.com/svn/trunk/');
currentversion := Between('<title>Revision ', ': /trunk', currentver);
WriteLn('Our current version is: '+inttostr(thisversion)+' and the latest version is: '+currentversion);
If (thisversion = strtoint(currentversion)) then
begin
WriteLn('We got the latest Reflection !');
exit;
end else
begin
DownloadFiles;
Install;
WriteLn('Latest Reflection Downloaded, please restart the script!');
TerminateScript;
end;
end;
Now, how to use it: First Reflection Devs should add a new file to the reflection folder called "Updater.scar" with the above code, and remember to change "thisversion = 98;" in the constants.
Now, in "Reflection.scar" should be added this:
{.Include SRL\SRL\Reflection\Updater.Scar}And that's all with the setup, now we should call the procedure "UpdateReflection;" somewhere in our script, as it will check wether we have the last version or not.If you like this, please at least reply? lol.