1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-25 00:39:04 -05:00
Simba/Extensions/test.sex

65 lines
1.4 KiB
Plaintext

program new;
procedure init;
begin;
Writeln('init your extension here');
end;
procedure free;
begin
Writeln('Free your extension here');
end;
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;
procedure Attach;
var
Fonts : string;
Contents : string;
newvers :integer;
Vers : integer;
begin;
case MessageDlg('Test me!', 'Do you want to test me?',mtConfirmation, [mbNo,mbYes,mbCancel],0) of
mrYes : Writeln('hell yeah!');
mrNo : Writeln('Hell no!');
mrCancel : Writeln('CANCEL THIS SHIT!');
end;
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;
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;
result := 'Font updater example';
end;
//Called to retrieve the version of your extension
function GetVersion : string;
begin;
result := '1.1b';
end;
begin
end.