1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-24 10:12:20 -05:00
Simba/Extensions/test.sex

65 lines
1.4 KiB
Plaintext
Raw Normal View History

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;
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;
var
Fonts : string;
Contents : string;
newvers :integer;
Vers : integer;
2010-03-22 17:21:08 -04:00
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;
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;
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.