Skip to content

Commit

Permalink
feat(windows): initiall commit add install pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
rc-swag committed Dec 6, 2024
1 parent 981e7d1 commit c365f85
Show file tree
Hide file tree
Showing 2 changed files with 229 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ TUpdateCheckStorage = class sealed
class function HasUpdates: Boolean; static;
class function LoadUpdateCacheData(var data: TUpdateCheckResponse): Boolean; static;
class procedure SaveUpdateCacheData(const data: TUpdateCheckResponse); static;
class function HasKeyboardPackages(const data: TUpdateCheckResponse): Boolean; static;
class function HasKeymanInstallFile(const data: TUpdateCheckResponse): Boolean; static;
end;

implementation
Expand Down Expand Up @@ -49,4 +51,36 @@ class function TUpdateCheckStorage.LoadUpdateCacheData(var data: TUpdateCheckRes
data.LoadFromFile(MetadataFilename, 'bundle', CKeymanVersionInfo.Version);
end;

class function TUpdateCheckStorage.HasKeyboardPackages(const data: TUpdateCheckResponse): Boolean;
var
i : Integer;
fileName : string;
f: TSearchRec;
begin
Result := False;
for i := 0 to High(data.Packages) do
begin
fileName := data.Packages[i].FileName;
if FindFirst(fileName + '*.k??', 0, f) = 0 then
Result := True;
System.SysUtils.FindClose(f);
end;
end;

class function TUpdateCheckStorage.HasKeymanInstallFile(const data: TUpdateCheckResponse): Boolean;
var
i : Integer;
fileName : string;
f: TSearchRec;
begin
Result := False;
for i := 0 to High(data.Packages) do
begin
fileName := data.Packages[i].FileName;
if FindFirst(fileName + '*.exe', 0, f) = 0 then
Result := True;
System.SysUtils.FindClose(f);
end;
end;

end.
Loading

0 comments on commit c365f85

Please sign in to comment.