Componentes.Terceros.RemObj.../official/5.0.24.615/RemObjects SDK for Delphi/Source/IDE/uROProductVersionInfo.pas

104 lines
2.6 KiB
ObjectPascal

unit uROProductVersionInfo;
interface
procedure GetVersionInfos(const iTargetUrl:string='');
procedure RegisterProduct(const iProductID:string; iBuildNo:integer=-1);
procedure UnregisterProduct(const iProductID:string);
implementation
uses
uROPleaseWaitForm, uROProductVersionInfo_Intf, uROBinMessage,
uROWinInetHttpChannel, Classes, SysUtils, Forms, uRoProductVersionInfoForm,
Dialogs;
var
gProducts:TStringList;
procedure GetVersionInfos(const iTargetUrl:string='');
var
lProducts:TProductInfoRequestArray;
lInfo:TProductInfoArray;
i:integer;
lMessage:TROBINMessage;
lChannel:TROWinInetHTTPChannel;
begin
lProducts := TProductInfoRequestArray.Create();
try
for i := 0 to gProducts.Count-1 do begin
with lProducts.Add do begin
ProductID := gProducts[i];
CurrentBuild := integer(gProducts.Objects[i]);
end;
end;
lMessage := TROBinMessage.Create(nil);
lChannel := TROWinInetHTTPChannel.Create(nil);
lChannel.TargetURL := iTargetUrl;
if lChannel.TargetURL = '' then
lChannel.TargetURL := 'http://www.remobjects.com/isapi/roversioninfo.dll/bin';
//lChannel.TargetURL := 'http://localhost:8099/bin';
try
with TPleaseWaitForm.Create(Application,'Checking for new product versions...','RemObjects Software') do try
Show();
with CoIProductVersionInfo.Create(lMessage,lChannel) do begin
lInfo := GetProductVersions(lProducts);
end;
try
Hide();
if Assigned(lInfo) and (lInfo.Count > 0) then begin
with TProductVersionInfoForm.Create(Application) do try
LoadFromInfo(lInfo);
ShowModal();
finally
Free();
end;
end
else begin
ShowMessage('You are running the latest versions of all installed products.');
end;
finally
FreeAndNil(lInfo);
end;
finally
Free();
end;
finally
FreeAndNil(lMessage);
FreeAndNil(lChannel);
end;
finally
lProducts.Free();
end;
end;
procedure RegisterProduct(const iProductID:string; iBuildNo:integer=-1);
begin
gProducts.AddObject(iProductID,pointer(iBuildNo));
end;
procedure UnregisterProduct(const iProductID:string);
var
lIndex:integer;
begin
lIndex := gProducts.IndexOf(iProductID);
if lIndex <> -1 then gProducts.Delete(lIndex);
end;
initialization
gProducts := TStringList.Create();
gProducts.Sorted := true;
gProducts.Duplicates := dupIgnore;
finalization
FreeAndNil(gProducts);
end.