UPD: CheckPhotosVersion - optimization

This commit is contained in:
Alexander Koblov 2024-11-10 11:56:25 +03:00
commit 503584708b
2 changed files with 15 additions and 5 deletions

View file

@ -396,8 +396,7 @@ begin
// Special case Microsoft Photos
if (AppID = 'Microsoft.Windows.Photos_8wekyb3d8bbwe!App') then
begin
// https://blogs.windows.com/windowsdeveloper/2024/06/03/microsoft-photos-migrating-from-uwp-to-windows-app-sdk/
if CheckPhotosVersion(2024, 11050) then
if CheckPhotosVersion then
begin
URL:= URIEncode(URL);
URL:= 'ms-photos:viewer?fileName=' + StringReplace(URL, '%5C', '\', [rfReplaceAll]);

View file

@ -176,7 +176,7 @@ procedure CreateShortcut(const Target, Shortcut: String);
}
function ExtractFileAttributes(const FindData: TWin32FindDataW): DWORD;
function CheckPhotosVersion(Build, Revision: UInt16): Boolean;
function CheckPhotosVersion: Boolean;
procedure UpdateEnvironment;
@ -1300,9 +1300,20 @@ begin
end;
end;
function CheckPhotosVersion(Build, Revision: UInt16): Boolean;
function CheckPhotosVersion: Boolean;
const
PhotosNew: TDuplicates = dupIgnore;
begin
Result:= CheckPackageVersion('Microsoft.Windows.Photos_8wekyb3d8bbwe', Build, Revision);
if (PhotosNew = dupIgnore) then
begin
// https://blogs.windows.com/windowsdeveloper/2024/06/03/microsoft-photos-migrating-from-uwp-to-windows-app-sdk/
if CheckPackageVersion('Microsoft.Windows.Photos_8wekyb3d8bbwe', 2024, 11050) then
PhotosNew:= dupAccept
else begin
PhotosNew:= dupError;
end;
end;
Result:= (PhotosNew = dupAccept);
end;
var