[PT Run] Localized file paths (Part 1): Update helper class and Program plugin (#20024)

* make helper non-static and add cache

* uwp app: add localized path

* Win32Program: Rename variable

* spell fix

* Win32Program: Localized paths

* fix invalid var name

* spell fix

* fix build

* test new shell localization helper

* fixes

* fix crash

* replace old helper class

* replace old helper class 2

* Helper improvements

* last changes

* add docs info

* remove left-over

* remove second left-over
This commit is contained in:
Heiko
2023-02-13 17:30:18 +01:00
committed by GitHub
parent 4c3b470ec0
commit 6e4a2898ab
11 changed files with 178 additions and 95 deletions

View File

@@ -150,7 +150,7 @@ namespace Microsoft.Plugin.Program.Storage
// Using OrdinalIgnoreCase since this is used internally
if (extension.Equals(LnkExtension, StringComparison.OrdinalIgnoreCase))
{
app = GetAppWithSameLnkResolvedPath(path);
app = GetAppWithSameLnkFilePath(path);
if (app == null)
{
// Cancelled links won't have a resolved path.
@@ -195,12 +195,12 @@ namespace Microsoft.Plugin.Program.Storage
// To mitigate the issue faced (as stated above) when a shortcut application is renamed, the Exe FullPath and executable name must be obtained.
// Unlike the rename event args, since we do not have a newPath, we iterate through all the programs and find the one with the same LnkResolved path.
private Programs.Win32Program GetAppWithSameLnkResolvedPath(string lnkResolvedPath)
private Programs.Win32Program GetAppWithSameLnkFilePath(string lnkFilePath)
{
foreach (Programs.Win32Program app in Items)
{
// Using Invariant / OrdinalIgnoreCase since we're comparing paths
if (lnkResolvedPath.ToUpperInvariant().Equals(app.LnkResolvedPath, StringComparison.OrdinalIgnoreCase))
if (lnkFilePath.ToUpperInvariant().Equals(app.LnkFilePath, StringComparison.OrdinalIgnoreCase))
{
return app;
}