Revert "Improving performance of Adding and Removing Packaged Apps" (#4898)

* Revert "Adding newline to end of file for IProgramRepository"

This reverts commit d55cac80bf.

* Revert "Fixing comments"

This reverts commit a1ecdc9bfa.

* Revert "Restoring checks for invalid uwp apps based on PR feedback. This was accidentally removed when moving the initialize outside the constructor."

This reverts commit 0e8c1cb0fd.

* Revert "Removing unecessary implementation of IRepository interface as this is implemented by the base class."

This reverts commit 1c724280f5.

* Revert "Fixing potential race condition in ListRepository.  Now internally implemented as a concurrent dictionary."

This reverts commit 9ff8246a9d.

* Revert "Updating packagerepository comment based on pr feedback"

This reverts commit 2c45956030.

* Revert "Changing test structure.  Need to add unit tests."

This reverts commit 1c267a55d5.

* Revert "Fixing message format for exception"

This reverts commit f60bdc3dd4.

* Revert "Merging in Theme changes and moving win32Tests to Microsoft.Plugin.Program.UnitTests"

This reverts commit 030dfc2370.
This commit is contained in:
ryanbodrug-microsoft
2020-07-09 12:10:48 -07:00
committed by GitHub
parent b13e719ab3
commit 12d9d59d85
18 changed files with 734 additions and 1137 deletions

View File

@@ -31,7 +31,7 @@ namespace Microsoft.Plugin.Program.Programs
{
public string Name { get; }
public string FullName { get; }
public string FamilyName { get; }
public string FamilyName { get; }
public string Location { get; set; }
public Application[] Apps { get; set; }
@@ -40,17 +40,24 @@ namespace Microsoft.Plugin.Program.Programs
public UWP(Package package)
{
Location = package.InstalledLocation.Path;
Name = package.Id.Name;
FullName = package.Id.FullName;
FamilyName = package.Id.FamilyName;
InitializeAppInfo();
Apps = Apps.Where(a =>
{
var valid =
!string.IsNullOrEmpty(a.UserModelId) &&
!string.IsNullOrEmpty(a.DisplayName);
return valid;
}).ToArray();
}
public void InitializeAppInfo(string installedLocation)
private void InitializeAppInfo()
{
Location = installedLocation;
AppxPackageHelper _helper = new AppxPackageHelper();
var path = Path.Combine(installedLocation, "AppxManifest.xml");
var path = Path.Combine(Location, "AppxManifest.xml");
var namespaces = XmlNamespaces(path);
InitPackageVersion(namespaces);
@@ -69,17 +76,9 @@ namespace Microsoft.Plugin.Program.Programs
{
var app = new Application(_app, this);
apps.Add(app);
}
Apps = apps.Where(a =>
{
var valid =
!string.IsNullOrEmpty(a.UserModelId) &&
!string.IsNullOrEmpty(a.DisplayName) &&
a.AppListEntry != "none";
return valid;
}).ToArray();
}
Apps = apps.Where(a => a.AppListEntry != "none").ToArray();
}
else
{
@@ -155,14 +154,21 @@ namespace Microsoft.Plugin.Program.Programs
try
{
u = new UWP(p);
u.InitializeAppInfo(p.InstalledLocation.Path);
}
#if !DEBUG
catch (Exception e)
{
ProgramLogger.LogException($"|UWP|All|{p.InstalledLocation}|An unexpected error occurred and "
+ $"unable to convert Package to UWP for {p.Id.FullName}", e);
return new Application[] { };
}
#endif
#if DEBUG //make developer aware and implement handling
catch
{
throw;
}
#endif
return u.Apps;
}).ToArray();