/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/PackageManagerWrapper.cs
43 строки
1 KB
Michael Jolley
CmdPal: Linq clean-up (All Apps) (#41551)
26 сен 2025, 19:15
Не верифицирован
26 сен 2025, 19:15
3bdb530
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Security.Principal; using Windows.Management.Deployment; namespace Microsoft.CmdPal.Ext.Apps.Programs; public class PackageManagerWrapper : IPackageManager { private readonly PackageManager _packageManager; public PackageManagerWrapper() { _packageManager = new PackageManager(); } public IEnumerable<IPackage> FindPackagesForCurrentUser() { var user = WindowsIdentity.GetCurrent().User; if (user is not null) { var pkgs = _packageManager.FindPackagesForUser(user.Value); ICollection<IPackage> packages = []; foreach (var package in pkgs) { if (package is not null) { packages.Add(PackageWrapper.GetWrapperFromPackage(package)); } } return packages; } return []; } }