SRL Archive - Extensions

SRL and Reflection Updaters


Sex

2010-12-31 02:03:18

It'd be cool to have an option to automatically update with no user interaction..

KingKong

2010-12-31 02:05:43

After updating, it could maybe show a pop up message/dialog box saying successfully updated?

Phran6

2010-12-31 02:10:28

it doesnt already have it in: view -> extention ??

http://villavu.com/forum/showthread.php?t=57883

take a look in the extention part for setup this

KingKong

2010-12-31 02:18:24

I mean, after it automatically updates without user interaction.

Sex

2010-12-31 02:33:56

I could make this right now too :p. I'll do so for my own use, and if you guys want to add it in or whatever you can do that.

Frement

2010-12-31 02:59:10

Could you PM it to me after you have done it? :)

Shuttleu

2010-12-31 03:01:28

whats wrong with the current autoupdaters?
if need be, just change the current ones to suit your own needs

~shut

Frement

2010-12-31 03:02:29

I hate it when it prompts for update, should be fully automatic IMO.

Sex

2010-12-31 04:13:46

Well, I'm on it right now, however I created a whole new extension :p.

Edit: http://villavu.com/forum/showthread.php?p=764148#post764148

Gu3st...

2010-12-31 09:52:27

srl.sex:
program SRLUpdater;
var
started: Boolean;
Timer : TTimer;
Updating : boolean;
LocalP,LocalS,OnlineP,OnlineS: Integer;


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 GetOnlineVersion(out PluginsVersion,SRLVersion : integer);
begin
PluginsVersion := strtointdef(GetNumbers(getpage('http://wizzup.org/static/srl/plugins_version')),-1);
SRLVersion := strtointdef(GetNumbers(getpage('http://wizzup.org/static/srl/srl_version')),-1);
end;

procedure GetLocalVersion(out PluginsVersion,SRLVersion : integer);
begin
PluginsVersion := StrToIntDef(Settings.GetKeyValueDef('PluginsVersion','-1'),-1);
SRLVersion := StrToIntDef(Settings.GetKeyValueDef('SRLVersion','-1'),-1);
end;

function UpdatePlugins: Boolean;
var
I : integer;
Contents : String;
DeContents : string;
Files : TStringArray;
Failed,OverWrite : boolean;
begin
Contents := GetPage('http://wizzup.org/static/srl/simba_plugins.tar.bz2');
Failed := True;
if DecompressBZip2(Contents,DeContents,4096) then
if ForceDirectories(IncludePath + 'SRL/SimbaPlugins/') then
if UnTarEx(DeContents,IncludePath + 'SRL/SimbaPlugins/',true) then
begin;
Files := GetFiles(IncludePath + 'SRL/SimbaPlugins/','dll');
for i := 0 to high(Files) do
if FileExists(PluginPath + Files[i]) then
OverWrite := True;
if OverWrite then
begin;
Failed := not UnTarEx(DeContents,PluginPath,True);
Writeln('A restart is necessary.');
end else
Failed := not UnTarEx(DeContents,PluginPath,false);
end;
if Failed then
begin
Writeln('Failed to update the srl plugins');
end
else
begin
Writeln('Succesfully updated the srl plugins.');
end;
DeContents := '';
Contents := '';
Result := Failed;
if not Failed then
Settings.SetKeyValue('PluginsVersion',inttostr(OnlineP));
end;

function UpdateSRL: boolean;
var
Contents : String;
DeContents : string;
Failed : boolean;
begin
Contents := GetPage('http://wizzup.org/static/srl/srl.tar.bz2');
Failed := True;
if DecompressBZip2(Contents,DeContents,4096) then
if UnTarEx(DeContents,IncludePath,true) then
Failed := False;
if not Failed then
Settings.SetKeyValue('SRLVersion',inttostr(OnlineS));
if Result then
Result := Failed;
if not Failed then
begin
Writeln('Succesfully updated your SRL!');
end;
end;

procedure DoUpdate(Sender: TObject);
begin
if LocalP < OnlineP then
begin
UpdatePlugins;
end;
if LocalS < OnlineS then
begin
UpdateSRL;
end;
end;


function Update : boolean;
var
OpenForm: Boolean;
begin
Result := false;
if Updating then
Exit;
Updating := True;


if (LocalP < OnlineP) or (LocalS < OnlineS) then
begin
Result := True;
DoUpdate(Timer);
end;

Updating := False;

end;

procedure OnSRLCheckClick(Sender: TObject);
var
LocalP,LocalS,OnlineP,OnlineS : integer;
begin
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
if (OnlineP > LocalP) or (OnlineS > LocalS) then
begin;
Writeln('A new SRL version is available');
Update;
end;
end;

procedure SetAutoUpdate(Sender: TObject);
begin
Timer.Enabled := true;
if LowerCase(Settings.GetKeyValueDef('AutoUpdate','True')) = 'true' then
Settings.SetKeyValue('AutoUpdate', 'False')
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;

procedure OnSRLUpdateClick(Sender: TObject);
begin
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
if not ((OnlineP <= LocalP) and (OnlineS <= LocalS)) then
Update;
end;

procedure OnUpdateTimer(Sender: TObject);
begin;
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
Update;
end;

procedure Init;
begin;
Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @OnUpdateTimer;
Timer.Enabled :=true;
started := True;
end;

procedure Free;
begin
if (started) then
Timer.Enabled := False;//Freeing the components is not needed, as they will be freed upon the freeing of Simba.
end;

procedure Attach;
begin;
Writeln('From now on, you shall be alerted as to when your SRL is out of date!');
Timer.Enabled := true;
end;

Procedure Detach;
begin
Timer.Enabled := False;
end;

function GetName : string;
begin;
result := 'SRL Updater';
end;

function GetVersion : string;
begin;
result := '1.0';
end;
begin
end.

reflection.sex:
program ReflectionUpdater;
var
started: Boolean;
Timer : TTimer;
Updating : boolean;
LocalR,OnlineR: Integer;


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 GetOnlineVersion(out RefVersion : integer);
begin
RefVersion := strtointdef(GetNumbers(getpage('http://wizzup.org/static/srl/srl_refl_version')),-1);
end;

procedure GetLocalVersion(out RefVersion : integer);
begin
RefVersion := StrToIntDef(Settings.GetKeyValueDef('RefVersion','-1'),-1);
end;


function UpdateRef: boolean;
var
Contents : String;
DeContents : string;
Failed : boolean;
begin
Contents := GetPage('http://wizzup.org/static/srl/srlref.tar.bz2');
Failed := True;
if DecompressBZip2(Contents,DeContents,4096) then
if UnTarEx(DeContents,IncludePath,true) then
Failed := False;
if not Failed then
Settings.SetKeyValue('RefVersion',inttostr(OnlineR));
if Result then
Result := Failed;
if not Failed then
begin
Writeln('Succesfully updated your Reflection!');
end;
end;

procedure DoUpdate(Sender: TObject);
begin
if LocalR < OnlineR then
begin
UpdateRef;
end;
end;


function Update : boolean;
var
OpenForm: Boolean;
begin
Result := false;
if Updating then
Exit;
Updating := True;

if (LocalR < OnlineR) then
begin
Result := True;
DoUpdate(Timer);
end;

Updating := False;

end;

procedure OnReflectionCheckClick(Sender: TObject);
var
LocalR,OnlineR : integer;
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);

if (LocalR < OnlineR) then
begin
Writeln('A new Reflection version is available');
Update;
end;
end;

procedure SetAutoUpdate(Sender: TObject);
begin
Timer.Enabled := true;
if LowerCase(Settings.GetKeyValueDef('AutoUpdate','True')) = 'true' then
Settings.SetKeyValue('AutoUpdate', 'False')
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;

procedure OnReflectionUpdateClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);

if not (OnlineR <= LocalR) then
Update;
end;

procedure OnUpdateTimer(Sender: TObject);
begin;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
Update;
end;

procedure Init;
begin;
Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @OnUpdateTimer;
Timer.Enabled :=true;

started := True;
end;

procedure Free;
begin
if (started) then
Timer.Enabled := False;//Freeing the components is not needed, as they will be freed upon the freeing of Simba.
end;

procedure Attach;
begin;
Writeln('From now on, you shall be alerted as to when your Reflection is out of date!');
Timer.Enabled := true;
end;

Procedure Detach;
begin
Timer.Enabled := False;
end;

function GetName : string;
begin;
result := 'Reflection Updater';
end;

function GetVersion : string;
begin;
result := '1.0';
end;

begin
end.

msi.sex:
program new;

var
Timer: TTimer;

function GetOnlineVersion: integer;
begin
Result := StrToIntDef(ExtractFromStr(GetPage('http://wizzup.org/static/srl/msi_version'), Numbers), -1);
end;

function GetLocalVersion: integer;
begin
Result := StrToIntDef(Settings.GetKeyValueDef('MSIVersion', '-1'), -1);
end;

procedure MSIUpdate;
var
Contents, DeContents: string;
begin
Contents := GetPage('http://wizzup.org/static/srl/msi.tar.bz2');
if (DecompressBZip2(Contents, DeContents, 4096)) then
if (UnTarEx(DeContents, IncludePath, True)) then
begin
Settings.SetKeyValue('MSIVersion', IntToStr(GetOnlineVersion));
Writeln('Succesfully updated MSI!');
end else
WriteLn('There was a problem updating MSI!');
end;

procedure Update;
begin
if (GetLocalVersion < GetOnlineVersion) then
MSIUpdate;
end;

procedure UpdateTimer(Sender: TObject);
begin
if (GetLocalVersion < GetOnlineVersion) then
Update;
end;

procedure Init;
begin
Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @UpdateTimer;
Timer.ENABLED := True;
end;

procedure Attach;
begin
WriteLn('MSI Updater Enabled. You will now be alerted to MSI Updates!');
Timer.Enabled := True;
end;

procedure Detach;
begin
Timer.Enabled := False;
WriteLn('MSI Updater Disabled.');
end;

function GetName: string;
begin
Result := 'MSI Updater';
end;

function GetVersion: string;
begin
Result := '0.2a';
end;

begin
end.