2010-03-22 17:21:08 -04:00
|
|
|
program new;
|
|
|
|
|
|
|
|
procedure init;
|
|
|
|
begin;
|
|
|
|
Writeln('init your extension here');
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure free;
|
|
|
|
begin
|
|
|
|
Writeln('Free your extension here');
|
|
|
|
end;
|
|
|
|
|
2010-04-05 07:56:20 -04:00
|
|
|
function GetNumbers(const str : string) : string;
|
|
|
|
var
|
|
|
|
i : integer;
|
|
|
|
begin;
|
|
|
|
for i := 1 to length(str) do
|
|
|
|
case str[i] of
|
|
|
|
'0'..'9': result := result + str[i];
|
|
|
|
end;
|
|
|
|
end;
|
2010-03-22 17:21:08 -04:00
|
|
|
procedure Attach;
|
2010-04-05 07:56:20 -04:00
|
|
|
var
|
|
|
|
Fonts : string;
|
|
|
|
Contents : string;
|
|
|
|
newvers :integer;
|
|
|
|
Vers : integer;
|
2010-03-22 17:21:08 -04:00
|
|
|
begin;
|
2010-04-05 07:56:20 -04:00
|
|
|
Vers := StrToIntDef(Settings.GetKeyValueDef('FontVersion','-1'),-1);
|
|
|
|
newvers := strtointdef(GetNumbers(getpage('http://simba.villavu.com/bin/Fonts/Version')),-1);
|
|
|
|
if newVers > vers then
|
|
|
|
begin;
|
|
|
|
Writeln('Updating your fonts!');
|
|
|
|
fonts := GetPage('http://simba.villavu.com/bin/Fonts/Fonts.tar.bz2');
|
|
|
|
if DecompressBZip2(Fonts,Contents,4096) then
|
|
|
|
UnTarEx(Contents,FontPath,true);
|
|
|
|
Settings.SetKeyValue('FontVersion',inttostr(newvers));
|
|
|
|
end;
|
2010-03-22 17:21:08 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
Procedure Detach;
|
|
|
|
begin
|
|
|
|
Writeln('Your extension has ben disabled, do stuff here');
|
|
|
|
end;
|
|
|
|
|
|
|
|
//Called to retrieve the name of your extension
|
|
|
|
function GetName : string;
|
|
|
|
begin;
|
2010-04-05 07:56:20 -04:00
|
|
|
result := 'Font updater example';
|
2010-03-22 17:21:08 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
//Called to retrieve the version of your extension
|
|
|
|
function GetVersion : string;
|
|
|
|
begin;
|
|
|
|
result := '1.1b';
|
|
|
|
end;
|
|
|
|
begin
|
|
|
|
end.
|