Skip to content

Commit

Permalink
Merge pull request #2093 from gep13/feature/GH-2092
Browse files Browse the repository at this point in the history
(GH-2092) Take all registry keys into account
  • Loading branch information
gep13 authored Apr 16, 2021
2 parents 071c9c3 + f13e946 commit d74c45f
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,14 @@ public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration confi

private IEnumerable<PackageResult> report_registry_programs(ChocolateyConfiguration config, IEnumerable<IPackage> list)
{
var itemsToRemoveFromMachine = list.Select(package => _packageInfoService.get_package_information(package)).
Where(p => p.RegistrySnapshot != null).
Select(p => p.RegistrySnapshot.RegistryKeys.FirstOrDefault()).
Where(p => p != null).
Select(p => p.DisplayName).ToList();
var itemsToRemoveFromMachine = list.Select(package => _packageInfoService.get_package_information(package)).Where(p => p.RegistrySnapshot != null).ToList();

var count = 0;
var machineInstalled = _registryService.get_installer_keys().RegistryKeys.
Where((p) => p.is_in_programs_and_features() && !itemsToRemoveFromMachine.Contains(p.DisplayName) && !p.KeyPath.contains("choco-")).
OrderBy((p) => p.DisplayName).Distinct();
var machineInstalled = _registryService.get_installer_keys().RegistryKeys.Where(
p => p.is_in_programs_and_features() &&
!itemsToRemoveFromMachine.Any(pkg => pkg.RegistrySnapshot.RegistryKeys.Any(k => k.DisplayName.is_equal_to(p.DisplayName))) &&
!p.KeyPath.contains("choco-")).OrderBy(p => p.DisplayName).Distinct();

this.Log().Info(() => "");
foreach (var key in machineInstalled)
{
Expand Down

0 comments on commit d74c45f

Please sign in to comment.