UAppCentreLib.pas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. unit UAppCentreLib;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, AppCentreCom_TLB, StdCtrls, ExtCtrls, superobject;
  6. function Authenticate(AAuthURL, AAppSecret: PChar): PChar; stdcall;
  7. function GetInstallationDirectory(AAppKey: PChar): PChar; stdcall;
  8. function RegisterInstallationDirectory(AAppKey: PChar; ADir: PChar): Integer; stdcall;
  9. implementation
  10. function Authenticate(AAuthURL, AAppSecret: PChar): PChar; stdcall;
  11. var
  12. AppCentreCom: ILXTAppCentreCom;
  13. jo: ISuperObject;
  14. JsonStr, rStr: string;
  15. begin
  16. AppCentreCom := CoLXTAppCentreCom.Create;
  17. JsonStr := AppCentreCom.Authenticate(AAuthURL, AAppSecret);
  18. Result := '';
  19. if JsonStr <> '' then
  20. begin
  21. jo := SO(JsonStr);
  22. rStr := jo.S['id'];
  23. Result := PChar(rStr);
  24. end;
  25. end;
  26. function GetInstallationDirectory(AAppKey: PChar): PChar; stdcall;
  27. var
  28. AppCentreCom: ILXTAppCentreCom;
  29. begin
  30. AppCentreCom := CoLXTAppCentreCom.Create;
  31. Result := AppCentreCom.GetInstallationDirectory(AAppKey);
  32. end;
  33. function RegisterInstallationDirectory(AAppKey: PChar; ADir: PChar): Integer; stdcall;
  34. var
  35. AppCentreCom: ILXTAppCentreCom;
  36. begin
  37. AppCentreCom := CoLXTAppCentreCom.Create;
  38. Result := AppCentreCom.RegisterInstallationDirectory(AAppKey, ADir);
  39. end;
  40. end.