|
1 | 1 | using System.Globalization;
|
2 | 2 | using System.Net;
|
3 | 3 | using System.Text.RegularExpressions;
|
| 4 | +using ABI.Windows.UI.Composition; |
4 | 5 | using UniGetUI.Core.IconEngine;
|
5 | 6 | using UniGetUI.Core.Logging;
|
6 | 7 | using UniGetUI.PackageEngine.Classes.Manager.BaseProviders;
|
7 | 8 | using UniGetUI.PackageEngine.Interfaces;
|
| 9 | +using UniGetUI.PackageEngine.PackageClasses; |
8 | 10 | using UniGetUIManagers = UniGetUI.PackageEngine.ManagerClasses.Manager;
|
9 | 11 |
|
10 | 12 | namespace UniGetUI.PackageEngine.Managers.WingetManager
|
@@ -91,6 +93,32 @@ protected override async Task<Uri[]> GetPackageScreenshots_Unsafe(IPackage packa
|
91 | 93 | return FoundIcons.ToArray();
|
92 | 94 | }
|
93 | 95 |
|
| 96 | + protected override string? GetPackageInstallLocation_Unsafe(IPackage package) |
| 97 | + { |
| 98 | + foreach (var base_path in new string[] |
| 99 | + { |
| 100 | + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), |
| 101 | + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), |
| 102 | + Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Programs"), |
| 103 | + Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "WinGet", "Packages"), |
| 104 | + Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "WinGet", "Packages"), |
| 105 | + Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "WinGet", "Packages"), |
| 106 | + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), |
| 107 | + }) |
| 108 | + { |
| 109 | + var path_with_name = Path.Join(base_path, package.Name); |
| 110 | + if (Directory.Exists(path_with_name)) return path_with_name; |
| 111 | + |
| 112 | + var path_with_id = Path.Join(base_path, package.Id); |
| 113 | + if (Directory.Exists(path_with_id)) return path_with_id; |
| 114 | + |
| 115 | + var path_with_source = Path.Join(base_path, $"{package.Id}_{package.Source.Name}"); |
| 116 | + if (Directory.Exists(path_with_source)) return path_with_source; |
| 117 | + } |
| 118 | + |
| 119 | + return null; |
| 120 | + } |
| 121 | + |
94 | 122 | private static async Task<string?> GetMicrosoftStorePackageManifest(IPackage package)
|
95 | 123 | {
|
96 | 124 | if (__msstore_package_manifests.TryGetValue(package.Id, out var manifest))
|
|
0 commit comments