From 3ef9e9506676046ac6d8c3d8351377bfba9f4e6e Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 14 Jan 2025 11:05:33 -0600 Subject: [PATCH 1/6] Diversify icon detection --- .../Packages/Package.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 5d212a637..7e42190f2 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -104,6 +104,9 @@ public Package( "Scoop" => id.ToLower().Replace(".app", ""), "Chocolatey" => id.ToLower().Replace(".install", "").Replace(".portable", ""), "vcpkg" => id.ToLower().Split(":")[0].Split("[")[0], + "Steam" => id.ToLower().Split("\\")[^1].Replace("Steam App", "steam:"), + "Local PC" => id.ToLower().Split("\\")[^1], + "Microsoft Store" => id.ToLower().Split(".")[1].Split("_")[0], _ => id.ToLower() }; } From c60b8bcb8f0d3b1754b13d1c1a6ce00891412f97 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 14 Jan 2025 13:02:08 -0600 Subject: [PATCH 2/6] Add Steam package details --- .../ClientHelpers/NativeWinGetHelper.cs | 42 +++++++++++++ .../Helpers/WinGetPkgDetailsHelper.cs | 63 +++++++++++++++++++ .../DialogPages/PackageDetailsPage.xaml.cs | 12 +++- .../AbstractPackagesPage.xaml.cs | 2 +- .../SoftwarePages/InstalledPackagesPage.cs | 2 +- 5 files changed, 118 insertions(+), 3 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index 891c3ece8..f15514565 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Text.Json.Nodes; using Microsoft.Management.Deployment; using UniGetUI.Core.Classes; using UniGetUI.Core.Logging; @@ -10,6 +11,7 @@ using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.PackageEngine.Structs; using WindowsPackageManager.Interop; +using WinRT; namespace UniGetUI.PackageEngine.Managers.WingetManager; @@ -318,6 +320,46 @@ public void GetPackageDetails_UnSafe(IPackageDetails details) { details.ManifestUrl = new Uri("https://apps.microsoft.com/detail/" + details.Package.Id); } + else if (details.Package.Source.Name == "Steam") + { + string AppId = details.Package.Id.Split(" ")[^1]; + JsonNode? SteamManifest = JsonObject.Parse(WinGetPkgDetailsHelper.GetSteamManifest(details.Package) ?? "{}")?[AppId]?["data"]; + if (SteamManifest?["developers"]?.AsArray() != null && SteamManifest?["developers"]?.AsArray().Count > 0) + { + details.Author = string.Join(", ", SteamManifest!["developers"]!.AsArray() ?? []); + } + if (SteamManifest?["short_description"] != null) + { + details.Description = SteamManifest["short_description"]!.ToString(); + } + if (SteamManifest?["website"] != null) + { + details.HomepageUrl = new Uri(SteamManifest["website"]!.ToString()); + } + details.ManifestUrl = new Uri($"https://store.steampowered.com/api/appdetails/?appids={AppId}"); + if (SteamManifest?["publishers"]?.AsArray() != null && SteamManifest?["publishers"]?.AsArray().Count > 0) + { + details.Publisher = string.Join(", ", SteamManifest!["publishers"]!.AsArray() ?? []); + } + List Tags = []; + if (SteamManifest?["categories"]?.AsArray() != null && SteamManifest?["categories"]?.AsArray().Count > 0) + { + foreach (JsonNode? category in SteamManifest!["categories"]!.AsArray()) + { + if (category?.AsObject()?["description"] != null) + { + Tags.Add(category!.AsObject()!["description"]!.ToString()); + } + } + } + if (Tags.Count > 0) + { + details.Tags = [.. Tags]; + } + details.InstallerType = "Steam"; + details.InstallerUrl = new Uri($"steam://install/{AppId}"); + return; + } CatalogPackageMetadata? NativeDetails = NativePackageHandler.GetDetails(details.Package); if (NativeDetails is null) return; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs index 399e35fd5..0a0e181bd 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs @@ -1,5 +1,8 @@ using System.Globalization; using System.Net; +using System.Text.Json; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; using Microsoft.Management.Deployment; using UniGetUI.Core.IconEngine; @@ -12,6 +15,7 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager internal sealed class WinGetPkgDetailsHelper : BasePkgDetailsHelper { private static readonly Dictionary __msstore_package_manifests = []; + private static readonly Dictionary __steam_package_manifests = []; public WinGetPkgDetailsHelper(WinGet manager) : base(manager) { } @@ -39,6 +43,26 @@ protected override void GetDetails_UnSafe(IPackageDetails details) protected override IEnumerable GetScreenshots_UnSafe(IPackage package) { + if (package.Source.Name == "Steam") + { + string? SteamResponseContent = GetSteamManifest(package); + if (SteamResponseContent is null) + { + return []; + } + + string AppId = package.Id.Split(" ")[^1]; + List Screenshots = []; + foreach (JsonNode? Screenshot in JsonObject.Parse(SteamResponseContent)?[AppId]?["data"]?["screenshots"]?.AsArray() ?? []) { + string? ScreenshotUrl = Screenshot?.AsObject()["path_full"]?.ToString(); + if (ScreenshotUrl != null) + { + Screenshots.Add(new Uri(ScreenshotUrl)); + } + } + return Screenshots; + } + if (package.Source.Name != "msstore") { return []; @@ -215,6 +239,45 @@ protected override IEnumerable GetScreenshots_UnSafe(IPackage package) return new CacheableIcon(new Uri(uri)); } + public static string? GetSteamManifest(IPackage package) + { + if (__steam_package_manifests.TryGetValue(package.Id, out var manifest)) + { + return manifest; + } + + string AppId = package.Id.Split(" ")[^1]; + string url = $"https://store.steampowered.com/api/appdetails/?appids={AppId}"; + +#pragma warning disable SYSLIB0014 + HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url); +#pragma warning restore SYSLIB0014 + + httpRequest.Method = "GET"; + + HttpWebResponse? httpResponse = httpRequest.GetResponse() as HttpWebResponse; + if (httpResponse is null) + { + Logger.Warn($"Null Steam response for uri={url}"); + return null; + } + + string result; + using (StreamReader streamReader = new(httpResponse.GetResponseStream())) + { + result = streamReader.ReadToEnd(); + } + + Logger.Debug("Steam API call status code: " + httpResponse.StatusCode); + + if (result != "" && httpResponse.StatusCode == HttpStatusCode.OK) + { + __msstore_package_manifests[package.Id] = result; + } + + return result; + } + private static CacheableIcon? GetWinGetPackageIcon(IPackage package) { CatalogPackageMetadata? NativeDetails = NativePackageHandler.GetDetails(package); diff --git a/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs b/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs index 340997cb2..d38976f84 100644 --- a/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs @@ -351,7 +351,8 @@ public async Task LoadInformation() SetTextToItem(InstallerHash_Content, details.InstallerHash); if (details.InstallerUrl is not null) { - SetTextToItem(InstallerSize_Content, details.InstallerSize > 0 ? $" ({details.InstallerSize} MB)" : $" ({CoreTools.Translate("Unknown size")})"); + if (details.Package.Source.Name != "Steam") + SetTextToItem(InstallerSize_Content, details.InstallerSize > 0 ? $" ({details.InstallerSize} MB)" : $" ({CoreTools.Translate("Unknown size")})"); SetTextToItem(DownloadInstaller_Button, CoreTools.Translate("Download installer")); } else @@ -460,6 +461,15 @@ public async void DownloadInstallerButton_Click(object sender, RoutedEventArgs e { return; } + if (Package.Details.InstallerUrl.ToString().StartsWith("steam://")) + { + Process.Start(new ProcessStartInfo + { + FileName = Package.Details.InstallerUrl.ToString(), + UseShellExecute = true + }); + return; + } FileSavePicker savePicker = new(); MainWindow window = MainApp.Instance.MainWindow; diff --git a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs index dd139a66b..4270475a4 100644 --- a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs +++ b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs @@ -787,7 +787,7 @@ protected void ClearSourceSelectionButton_Click(object sender, RoutedEventArgs e protected void ShowDetailsForPackage(IPackage? package) { - if (package is null || package.Source.IsVirtualManager || package is InvalidImportedPackage) + if (package is null || (package.Source.IsVirtualManager && package.Source.Name != "Steam") || package is InvalidImportedPackage) { return; } diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index b213a1f64..e0ae57466 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -318,7 +318,7 @@ protected override async void WhenShowingContextMenu(IPackage package) MenuUninstallThenReinstall.IsEnabled = !IS_LOCAL; MenuIgnoreUpdates.IsEnabled = false; //!IS_LOCAL; MenuSharePackage.IsEnabled = !IS_LOCAL; - MenuPackageDetails.IsEnabled = !IS_LOCAL; + MenuPackageDetails.IsEnabled = !IS_LOCAL || package.Source.Name == "Steam"; MenuOpenInstallLocation.IsEnabled = package.Manager.DetailsHelper.GetInstallLocation(package) is not null; if (!IS_LOCAL) From 0c681665b8d4b21e214d035b4f200b1dada68be8 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 14 Jan 2025 13:06:46 -0600 Subject: [PATCH 3/6] Implement Steam package details for bundled WinGet as well --- .../ClientHelpers/BundledWinGetHelper.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index 6d97097b8..e582a443f 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Text; +using System.Text.Json.Nodes; using System.Text.RegularExpressions; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; @@ -304,6 +305,46 @@ public void GetPackageDetails_UnSafe(IPackageDetails details) { details.ManifestUrl = new Uri("https://apps.microsoft.com/detail/" + details.Package.Id); } + else if (details.Package.Source.Name == "Steam") + { + string AppId = details.Package.Id.Split(" ")[^1]; + JsonNode? SteamManifest = JsonObject.Parse(WinGetPkgDetailsHelper.GetSteamManifest(details.Package) ?? "{}")?[AppId]?["data"]; + if (SteamManifest?["developers"]?.AsArray() != null && SteamManifest?["developers"]?.AsArray().Count > 0) + { + details.Author = string.Join(", ", SteamManifest!["developers"]!.AsArray() ?? []); + } + if (SteamManifest?["short_description"] != null) + { + details.Description = SteamManifest["short_description"]!.ToString(); + } + if (SteamManifest?["website"] != null) + { + details.HomepageUrl = new Uri(SteamManifest["website"]!.ToString()); + } + details.ManifestUrl = new Uri($"https://store.steampowered.com/api/appdetails/?appids={AppId}"); + if (SteamManifest?["publishers"]?.AsArray() != null && SteamManifest?["publishers"]?.AsArray().Count > 0) + { + details.Publisher = string.Join(", ", SteamManifest!["publishers"]!.AsArray() ?? []); + } + List Tags = []; + if (SteamManifest?["categories"]?.AsArray() != null && SteamManifest?["categories"]?.AsArray().Count > 0) + { + foreach (JsonNode? category in SteamManifest!["categories"]!.AsArray()) + { + if (category?.AsObject()?["description"] != null) + { + Tags.Add(category!.AsObject()!["description"]!.ToString()); + } + } + } + if (Tags.Count > 0) + { + details.Tags = [.. Tags]; + } + details.InstallerType = "Steam"; + details.InstallerUrl = new Uri($"steam://install/{AppId}"); + return; + } // Get the output for the best matching locale Process process = new(); From de9efe37f711135ce0fd1981c3a1edc019831f32 Mon Sep 17 00:00:00 2001 From: mrixner <100489307+mrixner@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:35:16 -0600 Subject: [PATCH 4/6] Update WinGetPkgDetailsHelper.cs (Using Incorrect Cache) --- .../Helpers/WinGetPkgDetailsHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs index 0a0e181bd..b0727c4ed 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs @@ -272,7 +272,7 @@ protected override IEnumerable GetScreenshots_UnSafe(IPackage package) if (result != "" && httpResponse.StatusCode == HttpStatusCode.OK) { - __msstore_package_manifests[package.Id] = result; + __steam_package_manifests[package.Id] = result; } return result; From ae1a28aa6d18cc4eb59ac4b5143100cb7ef1ae18 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 16 Jan 2025 18:10:04 -0600 Subject: [PATCH 5/6] Revert "Add Steam package details" This reverts commit c60b8bcb8f0d3b1754b13d1c1a6ce00891412f97. --- .../ClientHelpers/NativeWinGetHelper.cs | 42 ------------- .../Helpers/WinGetPkgDetailsHelper.cs | 63 ------------------- .../DialogPages/PackageDetailsPage.xaml.cs | 12 +--- .../AbstractPackagesPage.xaml.cs | 2 +- .../SoftwarePages/InstalledPackagesPage.cs | 2 +- 5 files changed, 3 insertions(+), 118 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index f15514565..891c3ece8 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Text.Json.Nodes; using Microsoft.Management.Deployment; using UniGetUI.Core.Classes; using UniGetUI.Core.Logging; @@ -11,7 +10,6 @@ using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.PackageEngine.Structs; using WindowsPackageManager.Interop; -using WinRT; namespace UniGetUI.PackageEngine.Managers.WingetManager; @@ -320,46 +318,6 @@ public void GetPackageDetails_UnSafe(IPackageDetails details) { details.ManifestUrl = new Uri("https://apps.microsoft.com/detail/" + details.Package.Id); } - else if (details.Package.Source.Name == "Steam") - { - string AppId = details.Package.Id.Split(" ")[^1]; - JsonNode? SteamManifest = JsonObject.Parse(WinGetPkgDetailsHelper.GetSteamManifest(details.Package) ?? "{}")?[AppId]?["data"]; - if (SteamManifest?["developers"]?.AsArray() != null && SteamManifest?["developers"]?.AsArray().Count > 0) - { - details.Author = string.Join(", ", SteamManifest!["developers"]!.AsArray() ?? []); - } - if (SteamManifest?["short_description"] != null) - { - details.Description = SteamManifest["short_description"]!.ToString(); - } - if (SteamManifest?["website"] != null) - { - details.HomepageUrl = new Uri(SteamManifest["website"]!.ToString()); - } - details.ManifestUrl = new Uri($"https://store.steampowered.com/api/appdetails/?appids={AppId}"); - if (SteamManifest?["publishers"]?.AsArray() != null && SteamManifest?["publishers"]?.AsArray().Count > 0) - { - details.Publisher = string.Join(", ", SteamManifest!["publishers"]!.AsArray() ?? []); - } - List Tags = []; - if (SteamManifest?["categories"]?.AsArray() != null && SteamManifest?["categories"]?.AsArray().Count > 0) - { - foreach (JsonNode? category in SteamManifest!["categories"]!.AsArray()) - { - if (category?.AsObject()?["description"] != null) - { - Tags.Add(category!.AsObject()!["description"]!.ToString()); - } - } - } - if (Tags.Count > 0) - { - details.Tags = [.. Tags]; - } - details.InstallerType = "Steam"; - details.InstallerUrl = new Uri($"steam://install/{AppId}"); - return; - } CatalogPackageMetadata? NativeDetails = NativePackageHandler.GetDetails(details.Package); if (NativeDetails is null) return; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs index b0727c4ed..399e35fd5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs @@ -1,8 +1,5 @@ using System.Globalization; using System.Net; -using System.Text.Json; -using System.Text.Json.Nodes; -using System.Text.Json.Serialization; using System.Text.RegularExpressions; using Microsoft.Management.Deployment; using UniGetUI.Core.IconEngine; @@ -15,7 +12,6 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager internal sealed class WinGetPkgDetailsHelper : BasePkgDetailsHelper { private static readonly Dictionary __msstore_package_manifests = []; - private static readonly Dictionary __steam_package_manifests = []; public WinGetPkgDetailsHelper(WinGet manager) : base(manager) { } @@ -43,26 +39,6 @@ protected override void GetDetails_UnSafe(IPackageDetails details) protected override IEnumerable GetScreenshots_UnSafe(IPackage package) { - if (package.Source.Name == "Steam") - { - string? SteamResponseContent = GetSteamManifest(package); - if (SteamResponseContent is null) - { - return []; - } - - string AppId = package.Id.Split(" ")[^1]; - List Screenshots = []; - foreach (JsonNode? Screenshot in JsonObject.Parse(SteamResponseContent)?[AppId]?["data"]?["screenshots"]?.AsArray() ?? []) { - string? ScreenshotUrl = Screenshot?.AsObject()["path_full"]?.ToString(); - if (ScreenshotUrl != null) - { - Screenshots.Add(new Uri(ScreenshotUrl)); - } - } - return Screenshots; - } - if (package.Source.Name != "msstore") { return []; @@ -239,45 +215,6 @@ protected override IEnumerable GetScreenshots_UnSafe(IPackage package) return new CacheableIcon(new Uri(uri)); } - public static string? GetSteamManifest(IPackage package) - { - if (__steam_package_manifests.TryGetValue(package.Id, out var manifest)) - { - return manifest; - } - - string AppId = package.Id.Split(" ")[^1]; - string url = $"https://store.steampowered.com/api/appdetails/?appids={AppId}"; - -#pragma warning disable SYSLIB0014 - HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url); -#pragma warning restore SYSLIB0014 - - httpRequest.Method = "GET"; - - HttpWebResponse? httpResponse = httpRequest.GetResponse() as HttpWebResponse; - if (httpResponse is null) - { - Logger.Warn($"Null Steam response for uri={url}"); - return null; - } - - string result; - using (StreamReader streamReader = new(httpResponse.GetResponseStream())) - { - result = streamReader.ReadToEnd(); - } - - Logger.Debug("Steam API call status code: " + httpResponse.StatusCode); - - if (result != "" && httpResponse.StatusCode == HttpStatusCode.OK) - { - __steam_package_manifests[package.Id] = result; - } - - return result; - } - private static CacheableIcon? GetWinGetPackageIcon(IPackage package) { CatalogPackageMetadata? NativeDetails = NativePackageHandler.GetDetails(package); diff --git a/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs b/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs index d38976f84..340997cb2 100644 --- a/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/PackageDetailsPage.xaml.cs @@ -351,8 +351,7 @@ public async Task LoadInformation() SetTextToItem(InstallerHash_Content, details.InstallerHash); if (details.InstallerUrl is not null) { - if (details.Package.Source.Name != "Steam") - SetTextToItem(InstallerSize_Content, details.InstallerSize > 0 ? $" ({details.InstallerSize} MB)" : $" ({CoreTools.Translate("Unknown size")})"); + SetTextToItem(InstallerSize_Content, details.InstallerSize > 0 ? $" ({details.InstallerSize} MB)" : $" ({CoreTools.Translate("Unknown size")})"); SetTextToItem(DownloadInstaller_Button, CoreTools.Translate("Download installer")); } else @@ -461,15 +460,6 @@ public async void DownloadInstallerButton_Click(object sender, RoutedEventArgs e { return; } - if (Package.Details.InstallerUrl.ToString().StartsWith("steam://")) - { - Process.Start(new ProcessStartInfo - { - FileName = Package.Details.InstallerUrl.ToString(), - UseShellExecute = true - }); - return; - } FileSavePicker savePicker = new(); MainWindow window = MainApp.Instance.MainWindow; diff --git a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs index 4270475a4..dd139a66b 100644 --- a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs +++ b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs @@ -787,7 +787,7 @@ protected void ClearSourceSelectionButton_Click(object sender, RoutedEventArgs e protected void ShowDetailsForPackage(IPackage? package) { - if (package is null || (package.Source.IsVirtualManager && package.Source.Name != "Steam") || package is InvalidImportedPackage) + if (package is null || package.Source.IsVirtualManager || package is InvalidImportedPackage) { return; } diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index e0ae57466..b213a1f64 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -318,7 +318,7 @@ protected override async void WhenShowingContextMenu(IPackage package) MenuUninstallThenReinstall.IsEnabled = !IS_LOCAL; MenuIgnoreUpdates.IsEnabled = false; //!IS_LOCAL; MenuSharePackage.IsEnabled = !IS_LOCAL; - MenuPackageDetails.IsEnabled = !IS_LOCAL || package.Source.Name == "Steam"; + MenuPackageDetails.IsEnabled = !IS_LOCAL; MenuOpenInstallLocation.IsEnabled = package.Manager.DetailsHelper.GetInstallLocation(package) is not null; if (!IS_LOCAL) From e7c6639364ddbb63e4db752073781e0150bc9354 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 16 Jan 2025 18:11:23 -0600 Subject: [PATCH 6/6] Revert "Implement Steam package details for bundled WinGet as well" This reverts commit 0c681665b8d4b21e214d035b4f200b1dada68be8. --- .../ClientHelpers/BundledWinGetHelper.cs | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index e582a443f..6d97097b8 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -1,6 +1,5 @@ using System.Diagnostics; using System.Text; -using System.Text.Json.Nodes; using System.Text.RegularExpressions; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; @@ -305,46 +304,6 @@ public void GetPackageDetails_UnSafe(IPackageDetails details) { details.ManifestUrl = new Uri("https://apps.microsoft.com/detail/" + details.Package.Id); } - else if (details.Package.Source.Name == "Steam") - { - string AppId = details.Package.Id.Split(" ")[^1]; - JsonNode? SteamManifest = JsonObject.Parse(WinGetPkgDetailsHelper.GetSteamManifest(details.Package) ?? "{}")?[AppId]?["data"]; - if (SteamManifest?["developers"]?.AsArray() != null && SteamManifest?["developers"]?.AsArray().Count > 0) - { - details.Author = string.Join(", ", SteamManifest!["developers"]!.AsArray() ?? []); - } - if (SteamManifest?["short_description"] != null) - { - details.Description = SteamManifest["short_description"]!.ToString(); - } - if (SteamManifest?["website"] != null) - { - details.HomepageUrl = new Uri(SteamManifest["website"]!.ToString()); - } - details.ManifestUrl = new Uri($"https://store.steampowered.com/api/appdetails/?appids={AppId}"); - if (SteamManifest?["publishers"]?.AsArray() != null && SteamManifest?["publishers"]?.AsArray().Count > 0) - { - details.Publisher = string.Join(", ", SteamManifest!["publishers"]!.AsArray() ?? []); - } - List Tags = []; - if (SteamManifest?["categories"]?.AsArray() != null && SteamManifest?["categories"]?.AsArray().Count > 0) - { - foreach (JsonNode? category in SteamManifest!["categories"]!.AsArray()) - { - if (category?.AsObject()?["description"] != null) - { - Tags.Add(category!.AsObject()!["description"]!.ToString()); - } - } - } - if (Tags.Count > 0) - { - details.Tags = [.. Tags]; - } - details.InstallerType = "Steam"; - details.InstallerUrl = new Uri($"steam://install/{AppId}"); - return; - } // Get the output for the best matching locale Process process = new();