From 4ad6d3f148315d1a02911b6c2673555382cf5610 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Mon, 9 Dec 2024 21:04:33 +0100 Subject: [PATCH 01/11] Remove duplicated nullable --- .../UniGetUI.Core.Classes.Tests.csproj | 5 ++--- .../UniGetUI.Core.Classes.csproj | 8 ++----- .../UniGetUI.Core.Data.Tests.csproj | 5 ++--- .../UniGetUI.Core.Data.csproj | 8 ++----- .../UniGetUI.Core.IconEngine.Tests.csproj | 5 ++--- .../UniGetUI.Core.IconEngine.csproj | 8 ++----- .../UniGetUI.Core.LanguageEngine.Tests.csproj | 5 ++--- .../UniGetUI.Core.LanguageEngine.csproj | 8 ++----- .../UniGetUI.Core.Logging.csproj | 8 ++----- .../UniGetUI.Core.Logging.Tests.csproj | 5 ++--- .../UniGetUI.Core.Settings.Tests.csproj | 5 ++--- .../UniGetUI.Core.Settings.csproj | 8 ++----- .../UniGetUI.Core.Tools.Tests.csproj | 5 ++--- .../UniGetUI.Core.Tools.csproj | 8 ++----- .../UniGetUI.Interface.BackgroundApi.csproj | 4 ++-- .../UniGetUI.PackageEngine.Structs.csproj | 8 ++----- ...iGetUI.PackageEngine.Managers.Cargo.csproj | 8 ++----- ...I.PackageEngine.Managers.Chocolatey.csproj | 8 ++----- ...GetUI.PackageEngine.Managers.Dotnet.csproj | 8 ++----- ...ackageEngine.Managers.Generic.NuGet.csproj | 8 ++----- ...UniGetUI.PackageEngine.Managers.Npm.csproj | 8 ++----- ...UniGetUI.PackageEngine.Managers.Pip.csproj | 8 ++----- ...I.PackageEngine.Managers.PowerShell.csproj | 8 ++----- ....PackageEngine.Managers.PowerShell7.csproj | 8 ++----- ...iGetUI.PackageEngine.Managers.Scoop.csproj | 8 ++----- ...iGetUI.PackageEngine.Managers.Vcpkg.csproj | 4 ---- ...GetUI.PackageEngine.Managers.WinGet.csproj | 9 ++------ .../UniGetUI.PackageEngine.Classes.csproj | 6 +----- ...UniGetUI.PackageEngine.Serializable.csproj | 8 ++----- src/UniGetUI/UniGetUI.csproj | 21 +++++++++---------- ...aries.WindowsPackageManager.Interop.csproj | 4 ++-- 31 files changed, 67 insertions(+), 160 deletions(-) diff --git a/src/UniGetUI.Core.Classes.Tests/UniGetUI.Core.Classes.Tests.csproj b/src/UniGetUI.Core.Classes.Tests/UniGetUI.Core.Classes.Tests.csproj index 7038e381e..10bc94e9d 100644 --- a/src/UniGetUI.Core.Classes.Tests/UniGetUI.Core.Classes.Tests.csproj +++ b/src/UniGetUI.Core.Classes.Tests/UniGetUI.Core.Classes.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj b/src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj index 85b606b73..32704e9f2 100644 --- a/src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj +++ b/src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj b/src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj index 142f0bf38..da77fbb63 100644 --- a/src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj +++ b/src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj b/src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj index 225124fc4..36e592f58 100644 --- a/src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj +++ b/src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.IconEngine.Tests/UniGetUI.Core.IconEngine.Tests.csproj b/src/UniGetUI.Core.IconEngine.Tests/UniGetUI.Core.IconEngine.Tests.csproj index 4738e36a9..5dcb4a409 100644 --- a/src/UniGetUI.Core.IconEngine.Tests/UniGetUI.Core.IconEngine.Tests.csproj +++ b/src/UniGetUI.Core.IconEngine.Tests/UniGetUI.Core.IconEngine.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj b/src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj index 76da9513e..492e200a1 100644 --- a/src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj +++ b/src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.Language.Tests/UniGetUI.Core.LanguageEngine.Tests.csproj b/src/UniGetUI.Core.Language.Tests/UniGetUI.Core.LanguageEngine.Tests.csproj index 55cd6c52f..54abc1493 100644 --- a/src/UniGetUI.Core.Language.Tests/UniGetUI.Core.LanguageEngine.Tests.csproj +++ b/src/UniGetUI.Core.Language.Tests/UniGetUI.Core.LanguageEngine.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.LanguageEngine/UniGetUI.Core.LanguageEngine.csproj b/src/UniGetUI.Core.LanguageEngine/UniGetUI.Core.LanguageEngine.csproj index bcf27b87f..fdf454c3d 100644 --- a/src/UniGetUI.Core.LanguageEngine/UniGetUI.Core.LanguageEngine.csproj +++ b/src/UniGetUI.Core.LanguageEngine/UniGetUI.Core.LanguageEngine.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj b/src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj index dfba326ff..ae1b17d00 100644 --- a/src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj +++ b/src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.Logging.Tests/UniGetUI.Core.Logging.Tests.csproj b/src/UniGetUI.Core.Logging.Tests/UniGetUI.Core.Logging.Tests.csproj index e16a56f1d..b94fcf725 100644 --- a/src/UniGetUI.Core.Logging.Tests/UniGetUI.Core.Logging.Tests.csproj +++ b/src/UniGetUI.Core.Logging.Tests/UniGetUI.Core.Logging.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.Settings.Tests/UniGetUI.Core.Settings.Tests.csproj b/src/UniGetUI.Core.Settings.Tests/UniGetUI.Core.Settings.Tests.csproj index 842fe6808..8b705af0e 100644 --- a/src/UniGetUI.Core.Settings.Tests/UniGetUI.Core.Settings.Tests.csproj +++ b/src/UniGetUI.Core.Settings.Tests/UniGetUI.Core.Settings.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.Settings/UniGetUI.Core.Settings.csproj b/src/UniGetUI.Core.Settings/UniGetUI.Core.Settings.csproj index 394be135a..89c5aa3b1 100644 --- a/src/UniGetUI.Core.Settings/UniGetUI.Core.Settings.csproj +++ b/src/UniGetUI.Core.Settings/UniGetUI.Core.Settings.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Core.Tools.Tests/UniGetUI.Core.Tools.Tests.csproj b/src/UniGetUI.Core.Tools.Tests/UniGetUI.Core.Tools.Tests.csproj index 64fc2fd02..07acb1b11 100644 --- a/src/UniGetUI.Core.Tools.Tests/UniGetUI.Core.Tools.Tests.csproj +++ b/src/UniGetUI.Core.Tools.Tests/UniGetUI.Core.Tools.Tests.csproj @@ -6,14 +6,13 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true Martí Climent and the contributors Martí Climent - enable false Debug;Release diff --git a/src/UniGetUI.Core.Tools/UniGetUI.Core.Tools.csproj b/src/UniGetUI.Core.Tools/UniGetUI.Core.Tools.csproj index d2b0bfcbb..a3d57780b 100644 --- a/src/UniGetUI.Core.Tools/UniGetUI.Core.Tools.csproj +++ b/src/UniGetUI.Core.Tools/UniGetUI.Core.Tools.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj b/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj index 0b3556e12..9ab892bd1 100644 --- a/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj +++ b/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true diff --git a/src/UniGetUI.PackageEngine.Enums/UniGetUI.PackageEngine.Structs.csproj b/src/UniGetUI.PackageEngine.Enums/UniGetUI.PackageEngine.Structs.csproj index dfba326ff..ae1b17d00 100644 --- a/src/UniGetUI.PackageEngine.Enums/UniGetUI.PackageEngine.Structs.csproj +++ b/src/UniGetUI.PackageEngine.Enums/UniGetUI.PackageEngine.Structs.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Cargo/UniGetUI.PackageEngine.Managers.Cargo.csproj b/src/UniGetUI.PackageEngine.Managers.Cargo/UniGetUI.PackageEngine.Managers.Cargo.csproj index e6cb7f98c..8bf0d8e2e 100644 --- a/src/UniGetUI.PackageEngine.Managers.Cargo/UniGetUI.PackageEngine.Managers.Cargo.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Cargo/UniGetUI.PackageEngine.Managers.Cargo.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/UniGetUI.PackageEngine.Managers.Chocolatey.csproj b/src/UniGetUI.PackageEngine.Managers.Chocolatey/UniGetUI.PackageEngine.Managers.Chocolatey.csproj index 847f364d6..72df7205b 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/UniGetUI.PackageEngine.Managers.Chocolatey.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/UniGetUI.PackageEngine.Managers.Chocolatey.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/UniGetUI.PackageEngine.Managers.Dotnet.csproj b/src/UniGetUI.PackageEngine.Managers.Dotnet/UniGetUI.PackageEngine.Managers.Dotnet.csproj index 32078fd54..6db87daad 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/UniGetUI.PackageEngine.Managers.Dotnet.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/UniGetUI.PackageEngine.Managers.Dotnet.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/UniGetUI.PackageEngine.Managers.Generic.NuGet.csproj b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/UniGetUI.PackageEngine.Managers.Generic.NuGet.csproj index d5e6c70f7..2fffdd4c1 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/UniGetUI.PackageEngine.Managers.Generic.NuGet.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/UniGetUI.PackageEngine.Managers.Generic.NuGet.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/UniGetUI.PackageEngine.Managers.Npm.csproj b/src/UniGetUI.PackageEngine.Managers.Npm/UniGetUI.PackageEngine.Managers.Npm.csproj index b7e4e4bbc..87d883444 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/UniGetUI.PackageEngine.Managers.Npm.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Npm/UniGetUI.PackageEngine.Managers.Npm.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/UniGetUI.PackageEngine.Managers.Pip.csproj b/src/UniGetUI.PackageEngine.Managers.Pip/UniGetUI.PackageEngine.Managers.Pip.csproj index b7e4e4bbc..87d883444 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/UniGetUI.PackageEngine.Managers.Pip.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Pip/UniGetUI.PackageEngine.Managers.Pip.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/UniGetUI.PackageEngine.Managers.PowerShell.csproj b/src/UniGetUI.PackageEngine.Managers.PowerShell/UniGetUI.PackageEngine.Managers.PowerShell.csproj index 32078fd54..6db87daad 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/UniGetUI.PackageEngine.Managers.PowerShell.csproj +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/UniGetUI.PackageEngine.Managers.PowerShell.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/UniGetUI.PackageEngine.Managers.PowerShell7.csproj b/src/UniGetUI.PackageEngine.Managers.PowerShell7/UniGetUI.PackageEngine.Managers.PowerShell7.csproj index bc2eac533..aff4889f3 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/UniGetUI.PackageEngine.Managers.PowerShell7.csproj +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/UniGetUI.PackageEngine.Managers.PowerShell7.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/UniGetUI.PackageEngine.Managers.Scoop.csproj b/src/UniGetUI.PackageEngine.Managers.Scoop/UniGetUI.PackageEngine.Managers.Scoop.csproj index b7e4e4bbc..87d883444 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/UniGetUI.PackageEngine.Managers.Scoop.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/UniGetUI.PackageEngine.Managers.Scoop.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.Vcpkg/UniGetUI.PackageEngine.Managers.Vcpkg.csproj b/src/UniGetUI.PackageEngine.Managers.Vcpkg/UniGetUI.PackageEngine.Managers.Vcpkg.csproj index 22c446728..21056cf22 100644 --- a/src/UniGetUI.PackageEngine.Managers.Vcpkg/UniGetUI.PackageEngine.Managers.Vcpkg.csproj +++ b/src/UniGetUI.PackageEngine.Managers.Vcpkg/UniGetUI.PackageEngine.Managers.Vcpkg.csproj @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/UniGetUI.PackageEngine.Managers.WinGet.csproj b/src/UniGetUI.PackageEngine.Managers.WinGet/UniGetUI.PackageEngine.Managers.WinGet.csproj index 493d592c1..b1b809803 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/UniGetUI.PackageEngine.Managers.WinGet.csproj +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/UniGetUI.PackageEngine.Managers.WinGet.csproj @@ -6,9 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -19,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/UniGetUI.PackageEngine.Classes.csproj b/src/UniGetUI.PackageEngine.PackageManagerClasses/UniGetUI.PackageEngine.Classes.csproj index d9cb5ba91..ac874e662 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/UniGetUI.PackageEngine.Classes.csproj +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/UniGetUI.PackageEngine.Classes.csproj @@ -7,7 +7,7 @@ win-$(Platform) x64 10.0.19041.0 - 10.0.26100.53 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI.PackageEngine.Serializable/UniGetUI.PackageEngine.Serializable.csproj b/src/UniGetUI.PackageEngine.Serializable/UniGetUI.PackageEngine.Serializable.csproj index dfba326ff..ae1b17d00 100644 --- a/src/UniGetUI.PackageEngine.Serializable/UniGetUI.PackageEngine.Serializable.csproj +++ b/src/UniGetUI.PackageEngine.Serializable/UniGetUI.PackageEngine.Serializable.csproj @@ -6,8 +6,8 @@ win-x64;win-arm64 win-$(Platform) x64 - 10.0.19041.0 - 10.0.26100.53 + 10.0.19041.0 + 10.0.26100.53 8.0.401 true true @@ -18,10 +18,6 @@ Debug;Release - - enable - - diff --git a/src/UniGetUI/UniGetUI.csproj b/src/UniGetUI/UniGetUI.csproj index a5c2bcb1b..a0917cff4 100644 --- a/src/UniGetUI/UniGetUI.csproj +++ b/src/UniGetUI/UniGetUI.csproj @@ -21,19 +21,18 @@ UniGetUI.EntryPoint False icon.ico - enable - - true - 8.0.401 - true - true - None - 10.0.26100.56 + + true + 8.0.401 + true + true + None + 10.0.26100.56 - - true + + true diff --git a/src/WindowsPackageManager.Interop/ExternalLibraries.WindowsPackageManager.Interop.csproj b/src/WindowsPackageManager.Interop/ExternalLibraries.WindowsPackageManager.Interop.csproj index c77f77519..eec7fc8cf 100644 --- a/src/WindowsPackageManager.Interop/ExternalLibraries.WindowsPackageManager.Interop.csproj +++ b/src/WindowsPackageManager.Interop/ExternalLibraries.WindowsPackageManager.Interop.csproj @@ -3,8 +3,8 @@ net8.0-windows10.0.22621.0 enable - 10.0.19041.0 - 10.0.26100.56 + 10.0.19041.0 + 10.0.26100.56 x64 true WindowsPackageManager.Interop From c63a1b07b7b6bdc288654d452160a68f5a215d26 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Mon, 9 Dec 2024 21:11:34 +0100 Subject: [PATCH 02/11] Fix few warnings --- .../TaskRecyclerTests.cs | 8 +++----- src/UniGetUI.Core.Classes/TaskRecycler.cs | 15 +++------------ src/UniGetUI.Core.Settings/SettingsEngine.cs | 4 ++-- .../SettingsEngine_Dictionaries.cs | 2 +- .../SettingsEngine_Lists.cs | 2 +- .../CratesIOClient.cs | 14 +++++++------- .../ClientHelpers/BundledWinGetHelper.cs | 4 +--- .../ClientHelpers/NativePackageHandler.cs | 6 +++--- .../ClientHelpers/NativeWinGetHelper.cs | 2 +- .../AbstractPackageLoader.cs | 4 ++-- .../Manager/Classes/ManagerLogger.cs | 4 ++-- .../Manager/PackageManager.cs | 8 ++++---- .../Classes/DesktopShortcutsDatabase.cs | 2 +- .../Packages/ImportedPackage.cs | 2 +- .../Packages/InvalidImportedPackage.cs | 4 ++-- .../Packages/Package.cs | 2 +- src/UniGetUI/Controls/PackageWrapper.cs | 2 +- src/UniGetUI/Controls/SourceManager.xaml.cs | 2 +- .../DialogPages/DesktopShortcuts.xaml.cs | 2 +- .../Pages/DialogPages/IgnoredUpdates.xaml.cs | 3 +-- .../Pages/DialogPages/InstallOptions.xaml.cs | 2 +- src/UniGetUI/Pages/MainView.xaml.cs | 3 +-- src/UniGetUI/Pages/SettingsPage.xaml.cs | 18 +----------------- .../SoftwarePages/InstalledPackagesPage.cs | 6 +++--- .../Pages/SoftwarePages/PackageBundlesPage.cs | 19 +++++++------------ 25 files changed, 52 insertions(+), 88 deletions(-) diff --git a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs index 1219ad089..a60309828 100644 --- a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs @@ -8,20 +8,20 @@ private int MySlowMethod1() return (new Random()).Next(); } - class TestClass + private class TestClass { public TestClass() {} public string SlowMethod2() { Thread.Sleep(1000); - return (new Random()).Next().ToString(); + return new Random().Next().ToString(); } public string SlowMethod3() { Thread.Sleep(1000); - return (new Random()).Next().ToString(); + return new Random().Next().ToString(); } } @@ -131,7 +131,6 @@ public void TestTaskRecycler_Class_String() string result2 = task2.GetAwaiter().GetResult(); Assert.Equal(result1, result2); - var class1_copy = class1; // The SAME method from the SAME instance, even when called @@ -153,7 +152,6 @@ public void TestTaskRecycler_Class_String() // Ensure the last call was not permanently cached Assert.NotEqual(result1, result3); - // The SAME method from two DIFFERENT instances should NOT be // cached, so the results should differ var task7 = TaskRecycler.RunOrAttachAsync(class1.SlowMethod3); diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index 04717fbce..82647763e 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -21,12 +21,10 @@ namespace UniGetUI.Core.Classes; */ public static class TaskRecycler { - private static ConcurrentDictionary> _tasks = new(); - + private static readonly ConcurrentDictionary> _tasks = new(); // --------------------------------------------------------------------------------------------------------------- - /// Asynchronous entry point for 0 parameters public static Task RunOrAttachAsync(Func method, int cacheTimeSecs = 0) { @@ -57,10 +55,8 @@ public static Task RunOrAttachAsync(Func(() => method(arg1, arg2, arg3)), hash, cacheTimeSecs); } - // --------------------------------------------------------------------------------------------------------------- - /// Synchronous entry point for 0 parameters public static ReturnT RunOrAttach(Func method, int cacheTimeSecs = 0) => RunOrAttachAsync(method, cacheTimeSecs).GetAwaiter().GetResult(); @@ -79,10 +75,8 @@ public static ReturnT RunOrAttach(Func RunOrAttachAsync(method, arg1, arg2, arg3, cacheTimeSecs).GetAwaiter().GetResult(); - // --------------------------------------------------------------------------------------------------------------- - /// /// Instantly removes a function call from the cache, even if the associated task has not /// finished yet. Any previous call will finish as expected. New calls won't attach to any @@ -93,10 +87,8 @@ public static ReturnT RunOrAttach(Func method) => _removeFromCache(method.GetHashCode(), 0); - // --------------------------------------------------------------------------------------------------------------- - /// /// Handles running the task if no such task was found on cache, and returning the cached task if it was found. /// @@ -134,15 +126,14 @@ private static async Task _runTaskAndWait(Task task, int hash, /// private static async void _removeFromCache(int hash, int cacheTimeSecsSecs) { - if(cacheTimeSecsSecs > 0) + if (cacheTimeSecsSecs > 0) await Task.Delay(cacheTimeSecsSecs * 1000); _tasks.Remove(hash, out _); } } - public static class TaskRecyclerTelemetry { - public static int DeduplicatedCalls = 0; + public static int DeduplicatedCalls; } diff --git a/src/UniGetUI.Core.Settings/SettingsEngine.cs b/src/UniGetUI.Core.Settings/SettingsEngine.cs index 8059fb7ac..4caa5fbd4 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine.cs @@ -6,8 +6,8 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary booleanSettings = new(); - private static ConcurrentDictionary valueSettings = new(); + private static readonly ConcurrentDictionary booleanSettings = new(); + private static readonly ConcurrentDictionary valueSettings = new(); public static bool Get(string setting, bool invert = false) { diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs index fb2f270d7..48ca71359 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary> dictionarySettings = new(); + private static readonly ConcurrentDictionary> dictionarySettings = new(); // Returns an empty dictionary if the setting doesn't exist and null if the types are invalid private static Dictionary? _getDictionary(string setting) diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs index 45dcad82a..db3800158 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary> listSettings = new(); + private static readonly ConcurrentDictionary> listSettings = new(); // Returns an empty list if the setting doesn't exist and null if the type is invalid private static List? _getList(string setting) diff --git a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs index 2d5542dd5..f56cda616 100644 --- a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs +++ b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs @@ -3,21 +3,21 @@ namespace UniGetUI.PackageEngine.Managers.CargoManager; -record CargoManifest +internal record CargoManifest { public CargoManifestCategory[]? categories { get; init; } public required CargoManifestCrate crate { get; init; } public required CargoManifestVersion[] versions { get; init; } } -record CargoManifestCategory +internal record CargoManifestCategory { public required string category { get; init; } public required string description { get; init; } public required string id { get; init; } } -record CargoManifestCrate +internal record CargoManifestCrate { public string[]? categories { get; init; } public string? description { get; init; } @@ -33,7 +33,7 @@ record CargoManifestCrate public string? updated_at { get; init; } } -record CargoManifestVersion +internal record CargoManifestVersion { public string[]? bin_names { get; init; } public required string checksum { get; init; } @@ -47,19 +47,19 @@ record CargoManifestVersion public bool yanked { get; init; } } -record CargoManifestVersionWrapper +internal record CargoManifestVersionWrapper { public required CargoManifestVersion version { get; init; } } -class CargoManifestPublisher +internal class CargoManifestPublisher { public string? avatar { get; init; } public required string name { get; init; } public string? url { get; init; } } -class CratesIOClient +internal class CratesIOClient { public const string ApiUrl = "https://crates.io/api/v1"; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index 1c38c5ed5..244bb88cc 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -15,7 +15,7 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; internal sealed class BundledWinGetHelper : IWinGetManagerHelper { - private WinGet Manager; + private readonly WinGet Manager; public BundledWinGetHelper(WinGet manager) { @@ -289,8 +289,6 @@ public IEnumerable FindPackages_UnSafe(string query) return Packages; } - - public void GetPackageDetails_UnSafe(IPackageDetails details) { if (details.Package.Source.Name == "winget") diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs index a7e598801..fceb241a5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs @@ -9,9 +9,9 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; public static class NativePackageHandler { - private static ConcurrentDictionary __nativePackages = new(); - private static ConcurrentDictionary __nativeDetails = new(); - private static ConcurrentDictionary __nativeInstallers_Install = new(); + private static readonly ConcurrentDictionary __nativePackages = new(); + private static readonly ConcurrentDictionary __nativeDetails = new(); + private static readonly ConcurrentDictionary __nativeInstallers_Install = new(); private static ConcurrentDictionary __nativeInstallers_Uninstall = new(); /// diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index 1b772d48f..1294f997b 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -21,7 +21,7 @@ internal sealed class NativeWinGetHelper : IWinGetManagerHelper public static WindowsPackageManagerFactory? ExternalFactory; public PackageManager WinGetManager; public static PackageManager? ExternalWinGetManager; - private WinGet Manager; + private readonly WinGet Manager; public NativeWinGetHelper(WinGet manager) { diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index 8f82c0b6b..f0d0a6403 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -47,8 +47,8 @@ public List Packages /// public event EventHandler? StartedLoading; - readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; - readonly bool DISABLE_RELOAD; + private readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; + private readonly bool DISABLE_RELOAD; private readonly bool PACKAGES_CHECKED_BY_DEFAULT; protected string LOADER_IDENTIFIER; private int LoadOperationIdentifier; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs index 58b22bcdb..571953023 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs @@ -6,9 +6,9 @@ namespace UniGetUI.PackageEngine.ManagerClasses.Classes { public class ManagerLogger : IManagerLogger { - readonly IPackageManager Manager; + private readonly IPackageManager Manager; - private List operations = new(); + private readonly List operations = new(); public IEnumerable Operations { get => (IEnumerable)operations; } public ManagerLogger(IPackageManager manager) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index c82207b64..52e2f808c 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -68,7 +68,7 @@ public virtual void Initialize() if (IsReady() && Capabilities.SupportsCustomSources) { - Task> sourcesTask = Task.Run(() => SourcesHelper.GetSources()); + Task> sourcesTask = Task.Run(SourcesHelper.GetSources); if (sourcesTask.Wait(TimeSpan.FromSeconds(15))) { @@ -162,7 +162,7 @@ private IEnumerable _findPackages(string query, bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to find packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -209,7 +209,7 @@ private IEnumerable _getAvailableUpdates(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list available updates with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -254,7 +254,7 @@ private IEnumerable _getInstalledPackages(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list installed packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs index ceee43341..84b9872b8 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs @@ -17,7 +17,7 @@ public enum Status Unknown, // The user has not said whether they want this shortcut to be deleted } - private static List UnknownShortcuts = []; + private static readonly List UnknownShortcuts = []; public static IReadOnlyDictionary GetDatabase() { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs index d69bb0e0e..d93cacdc3 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs @@ -13,7 +13,7 @@ public class ImportedPackage : Package public SerializableUpdatesOptions_v1 updates_options; public SerializableInstallationOptions_v1 installation_options; - private string _version; + private readonly string _version; public override string Version { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs index 48ac9a39a..4b8982203 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs @@ -23,8 +23,8 @@ public bool IsChecked set { __is_checked = value; OnPropertyChanged(nameof(IsChecked)); } } - private long __hash; - private long __extended_hash; + private readonly long __hash; + private readonly long __extended_hash; private static OverridenInstallationOptions __overriden_options; public ref OverridenInstallationOptions OverridenOptions { get => ref __overriden_options; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 18e80908d..4271bbae6 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -27,7 +27,7 @@ public class Package : IPackage private readonly string ignoredId; private readonly string _iconId; - private static ConcurrentDictionary _cachedIconPaths = new(); + private static readonly ConcurrentDictionary _cachedIconPaths = new(); private IPackageDetails? __details; public IPackageDetails Details diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index 9760979a1..d81c98939 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -21,7 +21,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// public class PackageWrapper : IIndexableListItem, INotifyPropertyChanged, IDisposable { - private static ConcurrentDictionary CachedPackageIcons = new(); + private static readonly ConcurrentDictionary CachedPackageIcons = new(); public static void ResetIconCache() { diff --git a/src/UniGetUI/Controls/SourceManager.xaml.cs b/src/UniGetUI/Controls/SourceManager.xaml.cs index dabca5f8b..f3a1584c3 100644 --- a/src/UniGetUI/Controls/SourceManager.xaml.cs +++ b/src/UniGetUI/Controls/SourceManager.xaml.cs @@ -32,7 +32,7 @@ public void Remove(object sender, RoutedEventArgs e) public sealed partial class SourceManager : UserControl { private IPackageManager Manager { get; set; } - private ObservableCollection Sources = new(); + private readonly ObservableCollection Sources = new(); private ListView _datagrid { get; set; } public SourceManager(IPackageManager Manager) diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index b1e201212..a4d536693 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -25,7 +25,7 @@ namespace UniGetUI.Interface public sealed partial class DesktopShortcutsManager : Page { public event EventHandler? Close; - private ObservableCollection desktopShortcuts = new ObservableCollection(); + private readonly ObservableCollection desktopShortcuts = new ObservableCollection(); private bool NewOnly; diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index ca4943f22..d2a68a81a 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -21,7 +21,7 @@ namespace UniGetUI.Interface public sealed partial class IgnoredUpdatesManager : Page { public event EventHandler? Close; - private ObservableCollection ignoredPackages = new ObservableCollection(); + private readonly ObservableCollection ignoredPackages = new ObservableCollection(); public IgnoredUpdatesManager() { @@ -69,7 +69,6 @@ private void CloseButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs Close?.Invoke(this, EventArgs.Empty); } - private async void YesResetButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { foreach (IgnoredPackageEntry package in ignoredPackages.ToArray()) diff --git a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs index 8d24dfe41..026372b97 100644 --- a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs @@ -20,7 +20,7 @@ public sealed partial class InstallOptionsPage : Page public SerializableInstallationOptions_v1 Options; public IPackage Package; public event EventHandler? Close; - private OperationType Operation; + private readonly OperationType Operation; public InstallOptionsPage(IPackage package, SerializableInstallationOptions_v1 options) : this(package, OperationType.None, options) { } public InstallOptionsPage(IPackage package, OperationType operation, SerializableInstallationOptions_v1 options) diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index 56b746d4e..e025806ff 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -49,7 +49,7 @@ public sealed partial class MainView : UserControl private PageType OldPage_t = PageType.Null; private PageType CurrentPage_t = PageType.Null; - private HashSet AddedPages = new(); + private readonly HashSet AddedPages = new(); public MainView() { @@ -199,7 +199,6 @@ private static PageType GetPreviousPage(PageType type) _ => throw new InvalidDataException($"Unknown page type {type}") }; - private void SettingsNavButton_Click(object sender, EventArgs e) => NavigateTo(PageType.Settings); diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index 37e381afd..e5f82b092 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -35,7 +35,7 @@ public sealed partial class SettingsPage : IEnterLeaveListener private readonly HyperlinkButton ResetBackupDirectory; private readonly HyperlinkButton OpenBackupDirectory; private readonly TextBlock BackupDirectoryLabel; - private bool InterfaceLoaded; + private readonly bool InterfaceLoaded; public SettingsPage() { @@ -122,10 +122,8 @@ public SettingsPage() ExtraSettingsCards.Add(Manager, []); } - // ---------------------------------------------------------------------------------------- - ButtonCard WinGet_ResetWindowsIPackageManager = new() { Text = CoreTools.AutoTranslated("Reset WinGet") + $" ({CoreTools.Translate("This may help if no packages are listed")})", ButtonText = CoreTools.AutoTranslated("Reset") @@ -162,10 +160,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_ResetWindowsIPackageManager); ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_UseBundled); - // ---------------------------------------------------------------------------------------- - ButtonCard Scoop_Install = new() { Text = CoreTools.AutoTranslated("Install Scoop"), ButtonText = CoreTools.AutoTranslated("Install") }; Scoop_Install.Click += (_, _) => { @@ -188,10 +184,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_Uninstall); ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_ResetAppCache); - // ---------------------------------------------------------------------------------------- - CheckboxCard Chocolatey_SystemChoco = new() { Text = CoreTools.AutoTranslated("Use system Chocolatey"), SettingName = "UseSystemChocolatey" }; Chocolatey_SystemChoco.StateChanged += (_, _) => { @@ -200,10 +194,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Chocolatey].Add(Chocolatey_SystemChoco); - // ---------------------------------------------------------------------------------------- - CheckboxCard Vcpkg_UpdateGitPorts = new() { Text = CoreTools.Translate("Update vcpkg's Git portfiles automatically (requires Git installed)"), @@ -266,28 +258,20 @@ public SettingsPage() } }; - p.Children.Add(VcPkgRootLabel); p.Children.Add(ResetVcPkgRootLabel); p.Children.Add(OpenVcPkgRootLabel); Vcpkg_CustomVcpkgRoot.Description = p; - - Vcpkg_CustomVcpkgRoot.Click += (_, _) => { IPackageManagerExpanders[PEInterface.Vcpkg].ShowRestartRequiredBanner(); }; - ExtraSettingsCards[PEInterface.Vcpkg].Add(Vcpkg_CustomVcpkgRoot); - - // ---------------------------------------------------------------------------------------- - - foreach (IPackageManager Manager in PEInterface.Managers) { // Creation of the actual expander diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index 9fc4be77c..36c7ca834 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -21,9 +21,9 @@ public class InstalledPackagesPage : AbstractPackagesPage { private bool HasDoneBackup; - BetterMenuItem? MenuAsAdmin; - BetterMenuItem? MenuInteractive; - BetterMenuItem? MenuRemoveData; + private BetterMenuItem? MenuAsAdmin; + private BetterMenuItem? MenuInteractive; + private BetterMenuItem? MenuRemoveData; private BetterMenuItem? MenuInstallationOptions; private BetterMenuItem? MenuReinstallPackage; private BetterMenuItem? MenuUninstallThenReinstall; diff --git a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs index 68561ccbb..ec805b737 100644 --- a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs @@ -23,13 +23,13 @@ namespace UniGetUI.Interface.SoftwarePages { public class PackageBundlesPage : AbstractPackagesPage { - BetterMenuItem? MenuInstallOptions; - BetterMenuItem? MenuInstall; - BetterMenuItem? MenuShare; - BetterMenuItem? MenuDetails; - BetterMenuItem? MenuAsAdmin; - BetterMenuItem? MenuInteractive; - BetterMenuItem? MenuSkipHash; + private BetterMenuItem? MenuInstallOptions; + private BetterMenuItem? MenuInstall; + private BetterMenuItem? MenuShare; + private BetterMenuItem? MenuDetails; + private BetterMenuItem? MenuAsAdmin; + private BetterMenuItem? MenuInteractive; + private BetterMenuItem? MenuSkipHash; private bool _hasUnsavedChanges = false; private bool HasUnsavedChanges @@ -426,7 +426,6 @@ private void MenuRemoveFromList_Invoked(object sender, RoutedEventArgs args) Loader.Remove(package); } - public async Task OpenFromFile(string? file = null) { try @@ -540,8 +539,6 @@ public async Task SaveFile() DialogHelper.HideLoadingDialog(); await MainApp.Instance.MainWindow.ShowDialogAsync(warningDialog); - - } } @@ -669,5 +666,3 @@ public static IPackage InvalidPackageFromSerializable(SerializableIncompatiblePa } } } - - From 96d9f2e5f0a29d0418a51b6a182d2e9eb46e69be Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Mon, 9 Dec 2024 21:22:56 +0100 Subject: [PATCH 03/11] Fix more warnings --- src/UniGetUI.Core.Data/CoreData.cs | 3 +-- src/UniGetUI.Core.IconStore/IconCacheEngine.cs | 3 --- src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs | 1 - src/UniGetUI.Core.Settings.Tests/SettingsTest.cs | 1 - src/UniGetUI.Core.Tools/Tools.cs | 7 +------ .../IInstallationOptions.cs | 4 ++-- src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs | 2 -- .../ManagerHelpers/IMultiSourceHelper.cs | 2 -- .../Helpers/ChocolateyPkgOperationHelper.cs | 1 - .../BaseNuGetDetailsHelper.cs | 1 - .../Helpers/PowerShellPkgOperationHelper.cs | 1 - .../Helpers/ScoopPkgDetailsHelper.cs | 2 -- .../Manager/Helpers/BaseSourceHelper.cs | 2 -- .../Manager/Helpers/PackagePkgOperationHelper.cs | 1 - .../Packages/Classes/InstallationOptions.cs | 1 - src/UniGetUI/Controls/PackageWrapper.cs | 6 +++--- src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs | 2 +- src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs | 2 +- 18 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/UniGetUI.Core.Data/CoreData.cs b/src/UniGetUI.Core.Data/CoreData.cs index 5851e5be2..e8ec68969 100644 --- a/src/UniGetUI.Core.Data/CoreData.cs +++ b/src/UniGetUI.Core.Data/CoreData.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Net; using System.Text.Json; using System.Text.Json.Serialization.Metadata; @@ -160,7 +160,6 @@ public static string UniGetUI_DefaultBackupDirectory /// public const int NewShortcutsNotificationTag = 1236; - /// /// A path pointing to the location where the app is installed /// diff --git a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs index cea19e121..5161ee87c 100644 --- a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs +++ b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs @@ -230,7 +230,6 @@ cachedIconFile is not null && return null; } - /// /// The given image will be downsized to the expected size of an icon, if required /// @@ -278,10 +277,8 @@ private static void DownsizeImage(string cachedIconFile, string extension) Logger.Error($"An error occurred while downsizing the image file {cachedIconFile}"); Logger.Error(ex); } - } - /// /// Checks whether a cached image is valid or not depending on the size (in bytes) of the image /// diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs index f14051eef..35f89078d 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs @@ -81,7 +81,6 @@ public Dictionary LoadLanguageFile(string LangKey) Dictionary LangDict = BundledContents.ToDictionary(x => x.Key, x => x.Value?.ToString() ?? ""); - string CachedLangFileToLoad = Path.Join(CoreData.UniGetUICacheDirectory_Lang, "lang_" + LangKey + ".json"); if (Settings.Get("DisableLangAutoUpdater")) diff --git a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs index 13b2451ee..d99c67c9c 100644 --- a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs +++ b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs @@ -149,7 +149,6 @@ public void TestListSettings(string SettingName, string[] ls1Array, int[] ls2Arr public void TestDictionarySettings(string SettingName, string[] keyArray, int[] intArray, string[] strArray) { Dictionary test = []; - Dictionary emptyDictionary = []; Dictionary nonEmptyDictionary = []; nonEmptyDictionary["this should not be null; something's wrong"] = null; diff --git a/src/UniGetUI.Core.Tools/Tools.cs b/src/UniGetUI.Core.Tools/Tools.cs index 2050c9f55..565b46d37 100644 --- a/src/UniGetUI.Core.Tools/Tools.cs +++ b/src/UniGetUI.Core.Tools/Tools.cs @@ -481,10 +481,7 @@ public static void CreateSymbolicLinkDir(string linkPath, string targetPath) }; Process? p = Process.Start(startInfo); - if (p is not null) - { - p.WaitForExit(); - } + p?.WaitForExit(); if (p is null || p.ExitCode != 0) { @@ -518,7 +515,6 @@ public static ProcessStartInfo UpdateEnvironmentVariables() return UpdateEnvironmentVariables(new ProcessStartInfo()); } - /// /// Returns the updated environment variables on the returned ProcessStartInfo object /// @@ -545,7 +541,6 @@ public static ProcessStartInfo UpdateEnvironmentVariables(ProcessStartInfo info) return info; } - /// /// Pings the update server and 3 well-known sites to check for internet availability /// diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs b/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs index 8cd8f6fc1..26bebb766 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs @@ -33,7 +33,7 @@ public interface IInstallationOptions /// public async Task SaveToDiskAsync() { - await Task.Run(() => SaveToDisk()); + await Task.Run(SaveToDisk); } /// @@ -41,7 +41,7 @@ public async Task SaveToDiskAsync() /// public async Task LoadFromDiskAsync() { - await Task.Run(() => LoadFromDisk()); + await Task.Run(LoadFromDisk); } /// diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs b/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs index c1028945b..5f73d00fc 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs @@ -75,7 +75,6 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// An always-valid URI object, pointing to a file:// or to a ms-appx:// URL public Uri GetIconUrl(); - /// /// Get the package's icon url. If the package has no icon, null is returned. /// After calling this method, the returned URL (if any) points to a location on the local machine @@ -88,7 +87,6 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// public IEnumerable GetScreenshots(); - /// /// Adds the package to the ignored updates list. If no version is provided, all updates are ignored. /// Calling this method will override older ignored updates. diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerHelpers/IMultiSourceHelper.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerHelpers/IMultiSourceHelper.cs index 4a4747612..ac2601101 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerHelpers/IMultiSourceHelper.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerHelpers/IMultiSourceHelper.cs @@ -46,7 +46,5 @@ public interface IMultiSourceHelper /// /// An array of ManagerSource objects public IEnumerable GetSources(); - - } } diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateyPkgOperationHelper.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateyPkgOperationHelper.cs index bc4e9ebba..0b37b7f34 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateyPkgOperationHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateyPkgOperationHelper.cs @@ -63,7 +63,6 @@ protected override OperationVeredict _getOperationResult( return OperationVeredict.Succeeded; } - string output_string = string.Join("\n", processOutput); if (!package.OverridenOptions.RunAsAdministrator != true && (output_string.Contains("Run as administrator") diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs index 208a8a8a4..2aba7c765 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs @@ -145,7 +145,6 @@ protected override IEnumerable GetScreenshots_UnSafe(IPackage package) throw new NotImplementedException(); } - protected override IEnumerable GetInstallableVersions_UnSafe(IPackage package) { Uri SearchUrl = new($"{package.Source.Url}/FindPackagesById()?id='{package.Id}'"); diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellPkgOperationHelper.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellPkgOperationHelper.cs index 99606f180..30f81f0a5 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellPkgOperationHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellPkgOperationHelper.cs @@ -25,7 +25,6 @@ protected override IEnumerable _getOperationParameters(IPackage package, if (options.PreRelease) parameters.Add("-AllowPrerelease"); - if (!package.OverridenOptions.PowerShell_DoNotSetScopeParameter) { if (package.OverridenOptions.Scope == PackageScope.Global || diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs index 07f850703..5b3383a29 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs @@ -58,7 +58,6 @@ protected override void GetDetails_UnSafe(IPackageDetails details) logger.AddToStdOut(JsonString); logger.AddToStdErr(p.StandardError.ReadToEnd()); - if (JsonNode.Parse(JsonString) is not JsonObject contents) { throw new InvalidOperationException("Deserialized RawInfo was null"); @@ -116,7 +115,6 @@ protected override void GetDetails_UnSafe(IPackageDetails details) details.License = contents?["license"]?.ToString(); } - // Load installers if (contents?["url"] is JsonArray urlList) { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/BaseSourceHelper.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/BaseSourceHelper.cs index 568d0edec..d10dc85ff 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/BaseSourceHelper.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/BaseSourceHelper.cs @@ -73,8 +73,6 @@ public virtual IEnumerable _getSources() Logger.Error(e); return []; } - - } } } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/PackagePkgOperationHelper.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/PackagePkgOperationHelper.cs index 289b2c8c1..ea9d428d1 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/PackagePkgOperationHelper.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Helpers/PackagePkgOperationHelper.cs @@ -25,7 +25,6 @@ protected abstract OperationVeredict _getOperationResult( IEnumerable processOutput, int returnCode); - public IEnumerable GetParameters( IPackage package, IInstallationOptions options, diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/InstallationOptions.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/InstallationOptions.cs index b406cb0ee..9d190fece 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/InstallationOptions.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/InstallationOptions.cs @@ -124,7 +124,6 @@ public void FromSerializable(SerializableInstallationOptions_v1 options) Architecture = null; } - if (options.InstallationScope != "" && CommonTranslations.InvertedScopeNames_NonLang.TryGetValue(options.InstallationScope, out var value)) { InstallationScope = value; diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index d81c98939..0e858c83f 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -34,9 +34,9 @@ public bool IsChecked set => Package.IsChecked = value; } - public bool IconWasLoaded = false; - public bool AlternateIdIconVisible = false; - public bool ShowCustomPackageIcon = false; + public bool IconWasLoaded; + public bool AlternateIdIconVisible; + public bool ShowCustomPackageIcon; public bool ShowDefaultPackageIcon = true; public IconType MainIconId = IconType.Id; public IconType AlternateIconId = IconType.Id; diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index a4d536693..9f3833908 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -56,7 +56,7 @@ private void UpdateData(List? NewShortcuts) { shortcut.OnReset += (sender, path) => { - if (sender is not ShortcutEntry sh) throw new Exception(); + if (sender is not ShortcutEntry sh) throw new InvalidOperationException(); DesktopShortcutsDatabase.ResetShortcut(sh.ShortcutPath); desktopShortcuts.Remove(sh); }; diff --git a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs index ec805b737..a63c9603a 100644 --- a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs @@ -31,7 +31,7 @@ public class PackageBundlesPage : AbstractPackagesPage private BetterMenuItem? MenuInteractive; private BetterMenuItem? MenuSkipHash; - private bool _hasUnsavedChanges = false; + private bool _hasUnsavedChanges; private bool HasUnsavedChanges { get => _hasUnsavedChanges; From 9cce9921db20bdc42d6f417a166d1b1a0cd0109f Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Wed, 11 Dec 2024 18:15:52 +0100 Subject: [PATCH 04/11] Remove added readonly part 1 --- src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs | 2 +- src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs | 2 +- src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs | 2 +- src/UniGetUI/Pages/MainView.xaml.cs | 2 +- src/UniGetUI/Pages/SettingsPage.xaml.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index 9f3833908..ce69824cb 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -25,7 +25,7 @@ namespace UniGetUI.Interface public sealed partial class DesktopShortcutsManager : Page { public event EventHandler? Close; - private readonly ObservableCollection desktopShortcuts = new ObservableCollection(); + private ObservableCollection desktopShortcuts = new ObservableCollection(); private bool NewOnly; diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index d2a68a81a..f3e877501 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -21,7 +21,7 @@ namespace UniGetUI.Interface public sealed partial class IgnoredUpdatesManager : Page { public event EventHandler? Close; - private readonly ObservableCollection ignoredPackages = new ObservableCollection(); + private ObservableCollection ignoredPackages = new ObservableCollection(); public IgnoredUpdatesManager() { diff --git a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs index 026372b97..8d24dfe41 100644 --- a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs @@ -20,7 +20,7 @@ public sealed partial class InstallOptionsPage : Page public SerializableInstallationOptions_v1 Options; public IPackage Package; public event EventHandler? Close; - private readonly OperationType Operation; + private OperationType Operation; public InstallOptionsPage(IPackage package, SerializableInstallationOptions_v1 options) : this(package, OperationType.None, options) { } public InstallOptionsPage(IPackage package, OperationType operation, SerializableInstallationOptions_v1 options) diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index e025806ff..35cd100a2 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -49,7 +49,7 @@ public sealed partial class MainView : UserControl private PageType OldPage_t = PageType.Null; private PageType CurrentPage_t = PageType.Null; - private readonly HashSet AddedPages = new(); + private HashSet AddedPages = new(); public MainView() { diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index e5f82b092..1faa92fb4 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -35,7 +35,7 @@ public sealed partial class SettingsPage : IEnterLeaveListener private readonly HyperlinkButton ResetBackupDirectory; private readonly HyperlinkButton OpenBackupDirectory; private readonly TextBlock BackupDirectoryLabel; - private readonly bool InterfaceLoaded; + private bool InterfaceLoaded; public SettingsPage() { From a354e7f5149059fc7db0b22b04792b852c5b901b Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Wed, 11 Dec 2024 18:21:10 +0100 Subject: [PATCH 05/11] Remove added readonly part 2 --- .../ClientHelpers/BundledWinGetHelper.cs | 2 +- .../ClientHelpers/NativePackageHandler.cs | 6 +++--- .../ClientHelpers/NativeWinGetHelper.cs | 2 +- .../Manager/Classes/ManagerLogger.cs | 2 +- .../Packages/Classes/DesktopShortcutsDatabase.cs | 2 +- .../Packages/ImportedPackage.cs | 2 +- .../Packages/InvalidImportedPackage.cs | 4 ++-- .../Packages/Package.cs | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index 244bb88cc..ef3884edf 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -15,7 +15,7 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; internal sealed class BundledWinGetHelper : IWinGetManagerHelper { - private readonly WinGet Manager; + private WinGet Manager; public BundledWinGetHelper(WinGet manager) { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs index fceb241a5..a7e598801 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs @@ -9,9 +9,9 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; public static class NativePackageHandler { - private static readonly ConcurrentDictionary __nativePackages = new(); - private static readonly ConcurrentDictionary __nativeDetails = new(); - private static readonly ConcurrentDictionary __nativeInstallers_Install = new(); + private static ConcurrentDictionary __nativePackages = new(); + private static ConcurrentDictionary __nativeDetails = new(); + private static ConcurrentDictionary __nativeInstallers_Install = new(); private static ConcurrentDictionary __nativeInstallers_Uninstall = new(); /// diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index 1294f997b..1b772d48f 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -21,7 +21,7 @@ internal sealed class NativeWinGetHelper : IWinGetManagerHelper public static WindowsPackageManagerFactory? ExternalFactory; public PackageManager WinGetManager; public static PackageManager? ExternalWinGetManager; - private readonly WinGet Manager; + private WinGet Manager; public NativeWinGetHelper(WinGet manager) { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs index 571953023..9cda17020 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs @@ -8,7 +8,7 @@ public class ManagerLogger : IManagerLogger { private readonly IPackageManager Manager; - private readonly List operations = new(); + private List operations = new(); public IEnumerable Operations { get => (IEnumerable)operations; } public ManagerLogger(IPackageManager manager) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs index 84b9872b8..ceee43341 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs @@ -17,7 +17,7 @@ public enum Status Unknown, // The user has not said whether they want this shortcut to be deleted } - private static readonly List UnknownShortcuts = []; + private static List UnknownShortcuts = []; public static IReadOnlyDictionary GetDatabase() { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs index d93cacdc3..d69bb0e0e 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs @@ -13,7 +13,7 @@ public class ImportedPackage : Package public SerializableUpdatesOptions_v1 updates_options; public SerializableInstallationOptions_v1 installation_options; - private readonly string _version; + private string _version; public override string Version { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs index 4b8982203..48ac9a39a 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs @@ -23,8 +23,8 @@ public bool IsChecked set { __is_checked = value; OnPropertyChanged(nameof(IsChecked)); } } - private readonly long __hash; - private readonly long __extended_hash; + private long __hash; + private long __extended_hash; private static OverridenInstallationOptions __overriden_options; public ref OverridenInstallationOptions OverridenOptions { get => ref __overriden_options; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 4271bbae6..18e80908d 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -27,7 +27,7 @@ public class Package : IPackage private readonly string ignoredId; private readonly string _iconId; - private static readonly ConcurrentDictionary _cachedIconPaths = new(); + private static ConcurrentDictionary _cachedIconPaths = new(); private IPackageDetails? __details; public IPackageDetails Details From 959938bdafac9f2e6ae321ca8ace5881ecf00ff8 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Wed, 11 Dec 2024 18:29:05 +0100 Subject: [PATCH 06/11] Remove added readonly part 3 --- src/UniGetUI.Core.Classes/TaskRecycler.cs | 2 +- src/UniGetUI.Core.Settings/SettingsEngine.cs | 4 ++-- src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs | 2 +- src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index 82647763e..953a61f7c 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -21,7 +21,7 @@ namespace UniGetUI.Core.Classes; */ public static class TaskRecycler { - private static readonly ConcurrentDictionary> _tasks = new(); + private static ConcurrentDictionary> _tasks = new(); // --------------------------------------------------------------------------------------------------------------- diff --git a/src/UniGetUI.Core.Settings/SettingsEngine.cs b/src/UniGetUI.Core.Settings/SettingsEngine.cs index 4caa5fbd4..8059fb7ac 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine.cs @@ -6,8 +6,8 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static readonly ConcurrentDictionary booleanSettings = new(); - private static readonly ConcurrentDictionary valueSettings = new(); + private static ConcurrentDictionary booleanSettings = new(); + private static ConcurrentDictionary valueSettings = new(); public static bool Get(string setting, bool invert = false) { diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs index 48ca71359..fb2f270d7 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static readonly ConcurrentDictionary> dictionarySettings = new(); + private static ConcurrentDictionary> dictionarySettings = new(); // Returns an empty dictionary if the setting doesn't exist and null if the types are invalid private static Dictionary? _getDictionary(string setting) diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs index db3800158..45dcad82a 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static readonly ConcurrentDictionary> listSettings = new(); + private static ConcurrentDictionary> listSettings = new(); // Returns an empty list if the setting doesn't exist and null if the type is invalid private static List? _getList(string setting) From 5fb47db8574a76b92cfa12113573d793c3efcbed Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Wed, 11 Dec 2024 18:37:40 +0100 Subject: [PATCH 07/11] Revert "Fix few warnings" This reverts commit c63a1b07b7b6bdc288654d452160a68f5a215d26. --- .../TaskRecyclerTests.cs | 8 +++++--- src/UniGetUI.Core.Classes/TaskRecycler.cs | 13 +++++++++++-- .../CratesIOClient.cs | 14 +++++++------- .../ClientHelpers/BundledWinGetHelper.cs | 2 ++ .../AbstractPackageLoader.cs | 4 ++-- .../Manager/Classes/ManagerLogger.cs | 2 +- .../Manager/PackageManager.cs | 8 ++++---- src/UniGetUI/Controls/PackageWrapper.cs | 2 +- src/UniGetUI/Controls/SourceManager.xaml.cs | 2 +- .../Pages/DialogPages/IgnoredUpdates.xaml.cs | 1 + src/UniGetUI/Pages/MainView.xaml.cs | 1 + src/UniGetUI/Pages/SettingsPage.xaml.cs | 16 ++++++++++++++++ .../SoftwarePages/InstalledPackagesPage.cs | 6 +++--- .../Pages/SoftwarePages/PackageBundlesPage.cs | 19 ++++++++++++------- 14 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs index a60309828..1219ad089 100644 --- a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs @@ -8,20 +8,20 @@ private int MySlowMethod1() return (new Random()).Next(); } - private class TestClass + class TestClass { public TestClass() {} public string SlowMethod2() { Thread.Sleep(1000); - return new Random().Next().ToString(); + return (new Random()).Next().ToString(); } public string SlowMethod3() { Thread.Sleep(1000); - return new Random().Next().ToString(); + return (new Random()).Next().ToString(); } } @@ -131,6 +131,7 @@ public void TestTaskRecycler_Class_String() string result2 = task2.GetAwaiter().GetResult(); Assert.Equal(result1, result2); + var class1_copy = class1; // The SAME method from the SAME instance, even when called @@ -152,6 +153,7 @@ public void TestTaskRecycler_Class_String() // Ensure the last call was not permanently cached Assert.NotEqual(result1, result3); + // The SAME method from two DIFFERENT instances should NOT be // cached, so the results should differ var task7 = TaskRecycler.RunOrAttachAsync(class1.SlowMethod3); diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index 953a61f7c..04717fbce 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -23,8 +23,10 @@ public static class TaskRecycler { private static ConcurrentDictionary> _tasks = new(); + // --------------------------------------------------------------------------------------------------------------- + /// Asynchronous entry point for 0 parameters public static Task RunOrAttachAsync(Func method, int cacheTimeSecs = 0) { @@ -55,8 +57,10 @@ public static Task RunOrAttachAsync(Func(() => method(arg1, arg2, arg3)), hash, cacheTimeSecs); } + // --------------------------------------------------------------------------------------------------------------- + /// Synchronous entry point for 0 parameters public static ReturnT RunOrAttach(Func method, int cacheTimeSecs = 0) => RunOrAttachAsync(method, cacheTimeSecs).GetAwaiter().GetResult(); @@ -75,8 +79,10 @@ public static ReturnT RunOrAttach(Func RunOrAttachAsync(method, arg1, arg2, arg3, cacheTimeSecs).GetAwaiter().GetResult(); + // --------------------------------------------------------------------------------------------------------------- + /// /// Instantly removes a function call from the cache, even if the associated task has not /// finished yet. Any previous call will finish as expected. New calls won't attach to any @@ -87,8 +93,10 @@ public static ReturnT RunOrAttach(Func method) => _removeFromCache(method.GetHashCode(), 0); + // --------------------------------------------------------------------------------------------------------------- + /// /// Handles running the task if no such task was found on cache, and returning the cached task if it was found. /// @@ -126,14 +134,15 @@ private static async Task _runTaskAndWait(Task task, int hash, /// private static async void _removeFromCache(int hash, int cacheTimeSecsSecs) { - if (cacheTimeSecsSecs > 0) + if(cacheTimeSecsSecs > 0) await Task.Delay(cacheTimeSecsSecs * 1000); _tasks.Remove(hash, out _); } } + public static class TaskRecyclerTelemetry { - public static int DeduplicatedCalls; + public static int DeduplicatedCalls = 0; } diff --git a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs index f56cda616..2d5542dd5 100644 --- a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs +++ b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs @@ -3,21 +3,21 @@ namespace UniGetUI.PackageEngine.Managers.CargoManager; -internal record CargoManifest +record CargoManifest { public CargoManifestCategory[]? categories { get; init; } public required CargoManifestCrate crate { get; init; } public required CargoManifestVersion[] versions { get; init; } } -internal record CargoManifestCategory +record CargoManifestCategory { public required string category { get; init; } public required string description { get; init; } public required string id { get; init; } } -internal record CargoManifestCrate +record CargoManifestCrate { public string[]? categories { get; init; } public string? description { get; init; } @@ -33,7 +33,7 @@ internal record CargoManifestCrate public string? updated_at { get; init; } } -internal record CargoManifestVersion +record CargoManifestVersion { public string[]? bin_names { get; init; } public required string checksum { get; init; } @@ -47,19 +47,19 @@ internal record CargoManifestVersion public bool yanked { get; init; } } -internal record CargoManifestVersionWrapper +record CargoManifestVersionWrapper { public required CargoManifestVersion version { get; init; } } -internal class CargoManifestPublisher +class CargoManifestPublisher { public string? avatar { get; init; } public required string name { get; init; } public string? url { get; init; } } -internal class CratesIOClient +class CratesIOClient { public const string ApiUrl = "https://crates.io/api/v1"; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index ef3884edf..1c38c5ed5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -289,6 +289,8 @@ public IEnumerable FindPackages_UnSafe(string query) return Packages; } + + public void GetPackageDetails_UnSafe(IPackageDetails details) { if (details.Package.Source.Name == "winget") diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index f0d0a6403..8f82c0b6b 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -47,8 +47,8 @@ public List Packages /// public event EventHandler? StartedLoading; - private readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; - private readonly bool DISABLE_RELOAD; + readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; + readonly bool DISABLE_RELOAD; private readonly bool PACKAGES_CHECKED_BY_DEFAULT; protected string LOADER_IDENTIFIER; private int LoadOperationIdentifier; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs index 9cda17020..58b22bcdb 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs @@ -6,7 +6,7 @@ namespace UniGetUI.PackageEngine.ManagerClasses.Classes { public class ManagerLogger : IManagerLogger { - private readonly IPackageManager Manager; + readonly IPackageManager Manager; private List operations = new(); public IEnumerable Operations { get => (IEnumerable)operations; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index 52e2f808c..c82207b64 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -68,7 +68,7 @@ public virtual void Initialize() if (IsReady() && Capabilities.SupportsCustomSources) { - Task> sourcesTask = Task.Run(SourcesHelper.GetSources); + Task> sourcesTask = Task.Run(() => SourcesHelper.GetSources()); if (sourcesTask.Wait(TimeSpan.FromSeconds(15))) { @@ -162,7 +162,7 @@ private IEnumerable _findPackages(string query, bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to find packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -209,7 +209,7 @@ private IEnumerable _getAvailableUpdates(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list available updates with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -254,7 +254,7 @@ private IEnumerable _getInstalledPackages(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list installed packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index 0e858c83f..35aca5a21 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -21,7 +21,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// public class PackageWrapper : IIndexableListItem, INotifyPropertyChanged, IDisposable { - private static readonly ConcurrentDictionary CachedPackageIcons = new(); + private static ConcurrentDictionary CachedPackageIcons = new(); public static void ResetIconCache() { diff --git a/src/UniGetUI/Controls/SourceManager.xaml.cs b/src/UniGetUI/Controls/SourceManager.xaml.cs index f3a1584c3..dabca5f8b 100644 --- a/src/UniGetUI/Controls/SourceManager.xaml.cs +++ b/src/UniGetUI/Controls/SourceManager.xaml.cs @@ -32,7 +32,7 @@ public void Remove(object sender, RoutedEventArgs e) public sealed partial class SourceManager : UserControl { private IPackageManager Manager { get; set; } - private readonly ObservableCollection Sources = new(); + private ObservableCollection Sources = new(); private ListView _datagrid { get; set; } public SourceManager(IPackageManager Manager) diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index f3e877501..ca4943f22 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -69,6 +69,7 @@ private void CloseButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs Close?.Invoke(this, EventArgs.Empty); } + private async void YesResetButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { foreach (IgnoredPackageEntry package in ignoredPackages.ToArray()) diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index 35cd100a2..56b746d4e 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -199,6 +199,7 @@ private static PageType GetPreviousPage(PageType type) _ => throw new InvalidDataException($"Unknown page type {type}") }; + private void SettingsNavButton_Click(object sender, EventArgs e) => NavigateTo(PageType.Settings); diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index 1faa92fb4..37e381afd 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -122,8 +122,10 @@ public SettingsPage() ExtraSettingsCards.Add(Manager, []); } + // ---------------------------------------------------------------------------------------- + ButtonCard WinGet_ResetWindowsIPackageManager = new() { Text = CoreTools.AutoTranslated("Reset WinGet") + $" ({CoreTools.Translate("This may help if no packages are listed")})", ButtonText = CoreTools.AutoTranslated("Reset") @@ -160,8 +162,10 @@ public SettingsPage() ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_ResetWindowsIPackageManager); ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_UseBundled); + // ---------------------------------------------------------------------------------------- + ButtonCard Scoop_Install = new() { Text = CoreTools.AutoTranslated("Install Scoop"), ButtonText = CoreTools.AutoTranslated("Install") }; Scoop_Install.Click += (_, _) => { @@ -184,8 +188,10 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_Uninstall); ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_ResetAppCache); + // ---------------------------------------------------------------------------------------- + CheckboxCard Chocolatey_SystemChoco = new() { Text = CoreTools.AutoTranslated("Use system Chocolatey"), SettingName = "UseSystemChocolatey" }; Chocolatey_SystemChoco.StateChanged += (_, _) => { @@ -194,8 +200,10 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Chocolatey].Add(Chocolatey_SystemChoco); + // ---------------------------------------------------------------------------------------- + CheckboxCard Vcpkg_UpdateGitPorts = new() { Text = CoreTools.Translate("Update vcpkg's Git portfiles automatically (requires Git installed)"), @@ -258,20 +266,28 @@ public SettingsPage() } }; + p.Children.Add(VcPkgRootLabel); p.Children.Add(ResetVcPkgRootLabel); p.Children.Add(OpenVcPkgRootLabel); Vcpkg_CustomVcpkgRoot.Description = p; + + Vcpkg_CustomVcpkgRoot.Click += (_, _) => { IPackageManagerExpanders[PEInterface.Vcpkg].ShowRestartRequiredBanner(); }; + ExtraSettingsCards[PEInterface.Vcpkg].Add(Vcpkg_CustomVcpkgRoot); + + // ---------------------------------------------------------------------------------------- + + foreach (IPackageManager Manager in PEInterface.Managers) { // Creation of the actual expander diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index 36c7ca834..9fc4be77c 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -21,9 +21,9 @@ public class InstalledPackagesPage : AbstractPackagesPage { private bool HasDoneBackup; - private BetterMenuItem? MenuAsAdmin; - private BetterMenuItem? MenuInteractive; - private BetterMenuItem? MenuRemoveData; + BetterMenuItem? MenuAsAdmin; + BetterMenuItem? MenuInteractive; + BetterMenuItem? MenuRemoveData; private BetterMenuItem? MenuInstallationOptions; private BetterMenuItem? MenuReinstallPackage; private BetterMenuItem? MenuUninstallThenReinstall; diff --git a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs index db08e821d..d531fd1b7 100644 --- a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs @@ -23,13 +23,13 @@ namespace UniGetUI.Interface.SoftwarePages { public class PackageBundlesPage : AbstractPackagesPage { - private BetterMenuItem? MenuInstallOptions; - private BetterMenuItem? MenuInstall; - private BetterMenuItem? MenuShare; - private BetterMenuItem? MenuDetails; - private BetterMenuItem? MenuAsAdmin; - private BetterMenuItem? MenuInteractive; - private BetterMenuItem? MenuSkipHash; + BetterMenuItem? MenuInstallOptions; + BetterMenuItem? MenuInstall; + BetterMenuItem? MenuShare; + BetterMenuItem? MenuDetails; + BetterMenuItem? MenuAsAdmin; + BetterMenuItem? MenuInteractive; + BetterMenuItem? MenuSkipHash; private bool _hasUnsavedChanges; private bool HasUnsavedChanges @@ -426,6 +426,7 @@ private void MenuRemoveFromList_Invoked(object sender, RoutedEventArgs args) Loader.Remove(package); } + public async Task OpenFromFile(string? file = null) { try @@ -539,6 +540,8 @@ public async Task SaveFile() DialogHelper.HideLoadingDialog(); await MainApp.Instance.MainWindow.ShowDialogAsync(warningDialog); + + } } @@ -677,3 +680,5 @@ public static IPackage InvalidPackageFromSerializable(SerializableIncompatiblePa } } } + + From 2c106f72ad6529887095f5ed6bf01453f09b7bf5 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Wed, 11 Dec 2024 19:40:52 +0100 Subject: [PATCH 08/11] Blank multiple lines --- .../TaskRecyclerTests.cs | 10 ++++----- src/UniGetUI.Core.Classes/TaskRecycler.cs | 11 +--------- .../ClientHelpers/BundledWinGetHelper.cs | 2 -- .../Manager/PackageManager.cs | 8 +++---- .../Pages/DialogPages/IgnoredUpdates.xaml.cs | 2 -- src/UniGetUI/Pages/MainView.xaml.cs | 1 - src/UniGetUI/Pages/SettingsPage.xaml.cs | 21 ------------------- 7 files changed, 9 insertions(+), 46 deletions(-) diff --git a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs index 1219ad089..699926f17 100644 --- a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs @@ -5,7 +5,7 @@ public class TaskRecyclerTests private int MySlowMethod1() { Thread.Sleep(1000); - return (new Random()).Next(); + return new Random().Next(); } class TestClass @@ -15,20 +15,20 @@ public TestClass() {} public string SlowMethod2() { Thread.Sleep(1000); - return (new Random()).Next().ToString(); + return new Random().Next().ToString(); } public string SlowMethod3() { Thread.Sleep(1000); - return (new Random()).Next().ToString(); + return new Random().Next().ToString(); } } private int MySlowMethod4(int argument) { Thread.Sleep(1000); - return (new Random()).Next() + (argument - argument); + return new Random().Next() + (argument - argument); } [Fact] @@ -131,7 +131,6 @@ public void TestTaskRecycler_Class_String() string result2 = task2.GetAwaiter().GetResult(); Assert.Equal(result1, result2); - var class1_copy = class1; // The SAME method from the SAME instance, even when called @@ -153,7 +152,6 @@ public void TestTaskRecycler_Class_String() // Ensure the last call was not permanently cached Assert.NotEqual(result1, result3); - // The SAME method from two DIFFERENT instances should NOT be // cached, so the results should differ var task7 = TaskRecycler.RunOrAttachAsync(class1.SlowMethod3); diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index 04717fbce..b15b9a44a 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -23,10 +23,8 @@ public static class TaskRecycler { private static ConcurrentDictionary> _tasks = new(); - // --------------------------------------------------------------------------------------------------------------- - /// Asynchronous entry point for 0 parameters public static Task RunOrAttachAsync(Func method, int cacheTimeSecs = 0) { @@ -57,10 +55,8 @@ public static Task RunOrAttachAsync(Func(() => method(arg1, arg2, arg3)), hash, cacheTimeSecs); } - // --------------------------------------------------------------------------------------------------------------- - /// Synchronous entry point for 0 parameters public static ReturnT RunOrAttach(Func method, int cacheTimeSecs = 0) => RunOrAttachAsync(method, cacheTimeSecs).GetAwaiter().GetResult(); @@ -79,10 +75,8 @@ public static ReturnT RunOrAttach(Func RunOrAttachAsync(method, arg1, arg2, arg3, cacheTimeSecs).GetAwaiter().GetResult(); - // --------------------------------------------------------------------------------------------------------------- - /// /// Instantly removes a function call from the cache, even if the associated task has not /// finished yet. Any previous call will finish as expected. New calls won't attach to any @@ -93,10 +87,8 @@ public static ReturnT RunOrAttach(Func method) => _removeFromCache(method.GetHashCode(), 0); - // --------------------------------------------------------------------------------------------------------------- - /// /// Handles running the task if no such task was found on cache, and returning the cached task if it was found. /// @@ -134,14 +126,13 @@ private static async Task _runTaskAndWait(Task task, int hash, /// private static async void _removeFromCache(int hash, int cacheTimeSecsSecs) { - if(cacheTimeSecsSecs > 0) + if (cacheTimeSecsSecs > 0) await Task.Delay(cacheTimeSecsSecs * 1000); _tasks.Remove(hash, out _); } } - public static class TaskRecyclerTelemetry { public static int DeduplicatedCalls = 0; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index 1c38c5ed5..ef3884edf 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -289,8 +289,6 @@ public IEnumerable FindPackages_UnSafe(string query) return Packages; } - - public void GetPackageDetails_UnSafe(IPackageDetails details) { if (details.Package.Source.Name == "winget") diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index c82207b64..52e2f808c 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -68,7 +68,7 @@ public virtual void Initialize() if (IsReady() && Capabilities.SupportsCustomSources) { - Task> sourcesTask = Task.Run(() => SourcesHelper.GetSources()); + Task> sourcesTask = Task.Run(SourcesHelper.GetSources); if (sourcesTask.Wait(TimeSpan.FromSeconds(15))) { @@ -162,7 +162,7 @@ private IEnumerable _findPackages(string query, bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to find packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -209,7 +209,7 @@ private IEnumerable _getAvailableUpdates(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list available updates with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); @@ -254,7 +254,7 @@ private IEnumerable _getInstalledPackages(bool SecondAttempt) { if (!SecondAttempt) { - while (e is AggregateException) e = e.InnerException ?? new("How did we get here?"); + while (e is AggregateException) e = e.InnerException ?? new InvalidOperationException("How did we get here?"); Logger.Warn($"Manager {DisplayName} failed to list installed packages with exception {e.GetType().Name}: {e.Message}"); Logger.Warn($"Since this was the first attempt, {Name}.AttemptFastRepair() will be called and the procedure will be restarted"); AttemptFastRepair(); diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index ca4943f22..0f79d0bd9 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -53,7 +53,6 @@ public async Task UpdateData() ignoredPackages.Add(new IgnoredPackageEntry(ignoredId.Split("\\")[^1], version, manager, ignoredPackages)); } - } private async void IgnoredUpdatesList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) @@ -69,7 +68,6 @@ private void CloseButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs Close?.Invoke(this, EventArgs.Empty); } - private async void YesResetButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { foreach (IgnoredPackageEntry package in ignoredPackages.ToArray()) diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index 56b746d4e..35cd100a2 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -199,7 +199,6 @@ private static PageType GetPreviousPage(PageType type) _ => throw new InvalidDataException($"Unknown page type {type}") }; - private void SettingsNavButton_Click(object sender, EventArgs e) => NavigateTo(PageType.Settings); diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index 37e381afd..bb3509fc3 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -122,10 +122,8 @@ public SettingsPage() ExtraSettingsCards.Add(Manager, []); } - // ---------------------------------------------------------------------------------------- - ButtonCard WinGet_ResetWindowsIPackageManager = new() { Text = CoreTools.AutoTranslated("Reset WinGet") + $" ({CoreTools.Translate("This may help if no packages are listed")})", ButtonText = CoreTools.AutoTranslated("Reset") @@ -162,10 +160,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_ResetWindowsIPackageManager); ExtraSettingsCards[PEInterface.WinGet].Add(WinGet_UseBundled); - // ---------------------------------------------------------------------------------------- - ButtonCard Scoop_Install = new() { Text = CoreTools.AutoTranslated("Install Scoop"), ButtonText = CoreTools.AutoTranslated("Install") }; Scoop_Install.Click += (_, _) => { @@ -188,10 +184,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_Uninstall); ExtraSettingsCards[PEInterface.Scoop].Add(Scoop_ResetAppCache); - // ---------------------------------------------------------------------------------------- - CheckboxCard Chocolatey_SystemChoco = new() { Text = CoreTools.AutoTranslated("Use system Chocolatey"), SettingName = "UseSystemChocolatey" }; Chocolatey_SystemChoco.StateChanged += (_, _) => { @@ -200,10 +194,8 @@ public SettingsPage() ExtraSettingsCards[PEInterface.Chocolatey].Add(Chocolatey_SystemChoco); - // ---------------------------------------------------------------------------------------- - CheckboxCard Vcpkg_UpdateGitPorts = new() { Text = CoreTools.Translate("Update vcpkg's Git portfiles automatically (requires Git installed)"), @@ -266,28 +258,20 @@ public SettingsPage() } }; - p.Children.Add(VcPkgRootLabel); p.Children.Add(ResetVcPkgRootLabel); p.Children.Add(OpenVcPkgRootLabel); Vcpkg_CustomVcpkgRoot.Description = p; - - Vcpkg_CustomVcpkgRoot.Click += (_, _) => { IPackageManagerExpanders[PEInterface.Vcpkg].ShowRestartRequiredBanner(); }; - ExtraSettingsCards[PEInterface.Vcpkg].Add(Vcpkg_CustomVcpkgRoot); - - // ---------------------------------------------------------------------------------------- - - foreach (IPackageManager Manager in PEInterface.Managers) { // Creation of the actual expander @@ -375,7 +359,6 @@ void SetManagerStatus(IPackageManager manager, bool ShowVersion = false) ManagerStatus.Message = ""; ShowVersionButton.Visibility = Visibility.Visible; } - } else if (manager.IsEnabled() && !manager.Status.Found) { @@ -477,7 +460,6 @@ void EnableOrDisableEntries() SetManagerStatus(Manager); EnableOrDisableEntries(); MainLayout.Children.Add(ManagerExpander); - } InterfaceLoaded = true; @@ -558,7 +540,6 @@ private async void ExportSettings(object sender, EventArgs e) Logger.Error("An error occurred when exporting settings"); Logger.Error(ex); } - } private void ResetWingetUI(object sender, EventArgs e) @@ -611,7 +592,6 @@ private void ChangeBackupDirectory_Click(object sender, EventArgs e) BackupDirectoryLabel.Text = folder; ResetBackupDirectory.IsEnabled = true; } - } private void OpenBackupPath_Click(object sender, RoutedEventArgs e) @@ -630,7 +610,6 @@ private void OpenBackupPath_Click(object sender, RoutedEventArgs e) } Process.Start("explorer.exe", directory); - } private void DoCacheAdminRights_StateChanged(object sender, EventArgs e) From 0d1b2d3bcae01001b9ef383a0b8c6355c43335fc Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Thu, 12 Dec 2024 11:50:26 +0100 Subject: [PATCH 09/11] Remove unused usings --- src/UniGetUI.Core.Classes/TaskRecycler.cs | 3 --- src/UniGetUI.Core.IconStore/IconCacheEngine.cs | 4 ---- src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs | 1 - .../Helpers/CargoPkgDetailsHelper.cs | 1 - .../Helpers/ChocolateySourceHelper.cs | 1 - .../BaseNuGetDetailsHelper.cs | 1 - .../Helpers/NpmPkgDetailsHelper.cs | 3 --- src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs | 1 - .../Helpers/PipPkgDetailsHelper.cs | 1 - .../Helpers/PowerShellSourceHelper.cs | 1 - .../PowerShell.cs | 1 - .../Helpers/PowerShell7SourceHelper.cs | 1 - .../Helpers/ScoopPkgDetailsHelper.cs | 3 --- .../Helpers/ScoopSourceHelper.cs | 1 - .../Helpers/VcpkgPkgDetailsHelper.cs | 4 ---- .../Helpers/VcpkgPkgOperationHelper.cs | 2 -- .../Helpers/VcpkgSourceHelper.cs | 3 --- src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs | 2 -- .../ClientHelpers/BundledWinGetHelper.cs | 2 -- .../ClientHelpers/NativePackageHandler.cs | 1 - .../ClientHelpers/NativeWinGetHelper.cs | 2 -- .../Helpers/WinGetPkgDetailsHelper.cs | 2 -- .../Helpers/WinGetSourceHelper.cs | 1 - src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs | 2 -- .../AbstractPackageLoader.cs | 2 -- .../Manager/Classes/NullPackageManager.cs | 3 --- .../Manager/PackageManager.cs | 3 --- .../Packages/Classes/DesktopShortcutsDatabase.cs | 5 ----- .../Packages/Classes/IgnoredUpdatesDatabase.cs | 4 ---- .../Packages/Package.cs | 1 - src/UniGetUI/App.xaml.cs | 4 ---- src/UniGetUI/AutoUpdater.cs | 4 ---- src/UniGetUI/Controls/PackageWrapper.cs | 6 ------ src/UniGetUI/MainWindow.xaml.cs | 1 - src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs | 6 ------ src/UniGetUI/Pages/DialogPages/DialogHelper_Generic.cs | 1 - src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs | 1 - src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs | 1 - src/UniGetUI/Pages/MainView.xaml.cs | 2 -- src/UniGetUI/Pages/SettingsPage.xaml.cs | 3 --- .../Pages/SoftwarePages/AbstractPackagesPage.xaml.cs | 2 -- src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs | 1 - 42 files changed, 94 deletions(-) diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index b15b9a44a..7937aba62 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -1,7 +1,4 @@ using System.Collections.Concurrent; -using System.Diagnostics; -using UniGetUI.Core.Logging; -using WinRT.Interop; namespace UniGetUI.Core.Classes; diff --git a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs index 5161ee87c..461bee351 100644 --- a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs +++ b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs @@ -1,13 +1,9 @@ using System.Collections.ObjectModel; using System.Security.Cryptography; -using Windows.ApplicationModel; -using Windows.Graphics.Imaging; -using Windows.UI; using PhotoSauce.MagicScaler; using UniGetUI.Core.Classes; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; -using UniGetUI.Core.Tools; namespace UniGetUI.Core.IconEngine { diff --git a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs index 2b3fc55c5..2f3c223ad 100644 --- a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs +++ b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs @@ -10,7 +10,6 @@ using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.Interface { diff --git a/src/UniGetUI.PackageEngine.Managers.Cargo/Helpers/CargoPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Cargo/Helpers/CargoPkgDetailsHelper.cs index 561beae40..d9805eb75 100644 --- a/src/UniGetUI.PackageEngine.Managers.Cargo/Helpers/CargoPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Cargo/Helpers/CargoPkgDetailsHelper.cs @@ -2,7 +2,6 @@ using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.CargoManager; internal sealed class CargoPkgDetailsHelper(Cargo manager) : BasePkgDetailsHelper(manager) diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateySourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateySourceHelper.cs index 32031412a..28b1db7ec 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateySourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Helpers/ChocolateySourceHelper.cs @@ -4,7 +4,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.ChocolateyManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs index 2aba7c765..f4520ae54 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.Generic.NuGet.Internal; namespace UniGetUI.PackageEngine.Managers.PowerShellManager diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Helpers/NpmPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Helpers/NpmPkgDetailsHelper.cs index 2665698a3..33caf3ed0 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Helpers/NpmPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Helpers/NpmPkgDetailsHelper.cs @@ -3,13 +3,10 @@ using System.Text.Json.Nodes; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; -using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.NpmManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs index 8cce1b667..48cf13660 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Net.Http.Json; using System.Text.Json.Nodes; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Helpers/PipPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Helpers/PipPkgDetailsHelper.cs index 28613c57f..aee583274 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Helpers/PipPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Helpers/PipPkgDetailsHelper.cs @@ -7,7 +7,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.PipManager { diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellSourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellSourceHelper.cs index caf4f9c7c..96c381a19 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellSourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellSourceHelper.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.PowerShellManager { diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs index 14d377621..4658c322d 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; -using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.Chocolatey; diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Helpers/PowerShell7SourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Helpers/PowerShell7SourceHelper.cs index d033feb2f..b4ec51f0f 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Helpers/PowerShell7SourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Helpers/PowerShell7SourceHelper.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.PowerShell7Manager { diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs index 5b3383a29..e96076543 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopPkgDetailsHelper.cs @@ -1,14 +1,11 @@ -using System.Collections; using System.Diagnostics; using System.Text.Json.Nodes; -using System.Threading.Tasks.Dataflow; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.ScoopManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopSourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopSourceHelper.cs index 3b58dfb7d..bdc9a8453 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopSourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Helpers/ScoopSourceHelper.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.ScoopManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgDetailsHelper.cs index 92c869671..d94d9cdc1 100644 --- a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgDetailsHelper.cs @@ -1,16 +1,12 @@ -using System.Diagnostics; using System.Text.Json.Nodes; using System.Text.RegularExpressions; using UniGetUI.Core.Data; -using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.IconEngine; -using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.VcpkgManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgOperationHelper.cs b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgOperationHelper.cs index 53c5ba685..a611eea54 100644 --- a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgOperationHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgPkgOperationHelper.cs @@ -1,5 +1,3 @@ -using System.Runtime.InteropServices; -using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgSourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgSourceHelper.cs index d74b3a5c0..7ab317696 100644 --- a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgSourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Helpers/VcpkgSourceHelper.cs @@ -1,10 +1,7 @@ -using UniGetUI.Core.SettingsEngine; -using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.VcpkgManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs index 7bd794866..4d7a2c3b6 100644 --- a/src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs +++ b/src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs @@ -2,7 +2,6 @@ using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; -using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; @@ -10,7 +9,6 @@ using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; -using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index ef3884edf..39d035cc4 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -1,9 +1,7 @@ using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; -using UniGetUI.Core.Data; using UniGetUI.Core.Logging; -using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Enums; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs index a7e598801..5fbecf730 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs @@ -1,6 +1,5 @@ using System.Collections.Concurrent; using Microsoft.Management.Deployment; -using UniGetUI.Core.Classes; using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index 1b772d48f..909612dbe 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -1,9 +1,7 @@ using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using Microsoft.Management.Deployment; using UniGetUI.Core.Classes; using UniGetUI.Core.Logging; -using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Enums; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs index 7351877d2..399e35fd5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgDetailsHelper.cs @@ -6,8 +6,6 @@ using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.PackageClasses; -using UniGetUIManagers = UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.WingetManager { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetSourceHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetSourceHelper.cs index 3744cf35b..e0d3e099e 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetSourceHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetSourceHelper.cs @@ -1,7 +1,6 @@ using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.Managers.WingetManager { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs index e148d3e28..1a560007e 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs @@ -1,14 +1,12 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -using ABI.System.Collections.Generic; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.ManagerClasses.Classes; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index 8f82c0b6b..f8cfe5ad6 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -1,6 +1,4 @@ using System.Collections.Concurrent; -using Windows.UI.Composition; -using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Interfaces; namespace UniGetUI.PackageEngine.PackageLoader diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/NullPackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/NullPackageManager.cs index 990083df2..39129aed2 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/NullPackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/NullPackageManager.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; -using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Interfaces.ManagerProviders; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index 52e2f808c..1581c52bb 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -1,12 +1,9 @@ -using UniGetUI.Core.Classes; -using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Classes.Packages; -using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.ManagerClasses.Classes; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs index ceee43341..1d12b1e55 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs @@ -1,8 +1,3 @@ -using System.Collections.Concurrent; -using System.Data; -using System.Text.Json; -using Microsoft.VisualBasic.CompilerServices; -using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/IgnoredUpdatesDatabase.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/IgnoredUpdatesDatabase.cs index 892aa4f0c..170f6f1e4 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/IgnoredUpdatesDatabase.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/IgnoredUpdatesDatabase.cs @@ -1,7 +1,3 @@ -using System.Collections.Concurrent; -using System.Data; -using System.Text.Json; -using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 18e80908d..23f5ad52e 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -1,7 +1,6 @@ using System.Collections.Concurrent; using System.ComponentModel; using System.Runtime.CompilerServices; -using System.Xml; using UniGetUI.Core.Classes; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; diff --git a/src/UniGetUI/App.xaml.cs b/src/UniGetUI/App.xaml.cs index b13f3602d..3d315deff 100644 --- a/src/UniGetUI/App.xaml.cs +++ b/src/UniGetUI/App.xaml.cs @@ -1,6 +1,4 @@ using System.Diagnostics; -using System.Globalization; -using System.Security.Cryptography; using System.Text.RegularExpressions; using Windows.ApplicationModel.Activation; using CommunityToolkit.WinUI.Helpers; @@ -18,8 +16,6 @@ using Microsoft.Windows.AppLifecycle; using Microsoft.Windows.AppNotifications; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using WinRT.Interop; using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; namespace UniGetUI diff --git a/src/UniGetUI/AutoUpdater.cs b/src/UniGetUI/AutoUpdater.cs index adec375c8..ad6aa0483 100644 --- a/src/UniGetUI/AutoUpdater.cs +++ b/src/UniGetUI/AutoUpdater.cs @@ -1,8 +1,6 @@ using System.Diagnostics; using System.Globalization; -using System.Net.NetworkInformation; using System.Security.Cryptography; -using H.NotifyIcon; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.Windows.AppNotifications; @@ -11,9 +9,7 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.Interface; using UniGetUI.Interface.Enums; -using Version = YamlDotNet.Core.Version; namespace UniGetUI; diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index 35aca5a21..336397cfd 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -1,17 +1,11 @@ using System.Collections.Concurrent; using System.ComponentModel; using System.Runtime.InteropServices; -using Windows.System.RemoteSystems; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; using UniGetUI.Core.Classes; -using UniGetUI.Core.Logging; -using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; -using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine.Interfaces; namespace UniGetUI.PackageEngine.PackageClasses diff --git a/src/UniGetUI/MainWindow.xaml.cs b/src/UniGetUI/MainWindow.xaml.cs index 16797ef1a..7023dbb64 100644 --- a/src/UniGetUI/MainWindow.xaml.cs +++ b/src/UniGetUI/MainWindow.xaml.cs @@ -23,7 +23,6 @@ using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.Pages.DialogPages; -using UniGetUI.PackageEngine.Classes.Packages.Classes; namespace UniGetUI.Interface { diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index ce69824cb..f0a87e147 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -5,13 +5,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using UniGetUI.Core.Logging; -using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Classes.Packages.Classes; -using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.Managers.WingetManager; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. diff --git a/src/UniGetUI/Pages/DialogPages/DialogHelper_Generic.cs b/src/UniGetUI/Pages/DialogPages/DialogHelper_Generic.cs index 319ad233e..31d7efb13 100644 --- a/src/UniGetUI/Pages/DialogPages/DialogHelper_Generic.cs +++ b/src/UniGetUI/Pages/DialogPages/DialogHelper_Generic.cs @@ -1,7 +1,6 @@ using System.Diagnostics; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Microsoft.Windows.AppNotifications; using Microsoft.Windows.AppNotifications.Builder; diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index 0f79d0bd9..8e51261a1 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -1,7 +1,6 @@ using System.Collections.ObjectModel; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine; diff --git a/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs b/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs index eed0d4da8..eed0d119f 100644 --- a/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs +++ b/src/UniGetUI/Pages/LogPages/ManagerLogsPage.cs @@ -4,7 +4,6 @@ using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.Interface.Pages.LogPage { diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index 35cd100a2..c563a5d23 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -10,10 +10,8 @@ using UniGetUI.Interface.Pages; using UniGetUI.Interface.Pages.LogPage; using UniGetUI.Interface.SoftwarePages; -using UniGetUI.Interface.Widgets; using Windows.UI.Core; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.Pages.DialogPages; // To learn more about WinUI, the WinUI project structure, diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index bb3509fc3..7881feebc 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -6,18 +6,15 @@ using Microsoft.UI.Xaml.Media; using Newtonsoft.Json; using UniGetUI.Core.Data; -using UniGetUI.Core.IconEngine; using UniGetUI.Core.Language; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.Interface.Pages; -using UniGetUI.Interface.Pages.LogPage; using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.VcpkgManager; using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.Pages.DialogPages; diff --git a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs index 99b1a02c5..2c6af7573 100644 --- a/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs +++ b/src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml.cs @@ -1,11 +1,9 @@ using System.Collections.Concurrent; -using System.ComponentModel; using System.Diagnostics; using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Widgets; diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index 9fc4be77c..0516e1dfc 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -1,4 +1,3 @@ -using System.Diagnostics; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Data; From 93a7fd24583d3b3499a3d1a59b6b0a137a705660 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Thu, 12 Dec 2024 13:04:42 +0100 Subject: [PATCH 10/11] Reapply "Fix few warnings" This reverts commit 5fb47db8574a76b92cfa12113573d793c3efcbed. --- .../TaskRecyclerTests.cs | 2 +- src/UniGetUI.Core.Classes/TaskRecycler.cs | 2 +- .../CratesIOClient.cs | 14 +++++++------- .../AbstractPackageLoader.cs | 4 ++-- .../Manager/Classes/ManagerLogger.cs | 2 +- src/UniGetUI/Controls/PackageWrapper.cs | 2 +- src/UniGetUI/Controls/SourceManager.xaml.cs | 2 +- .../SoftwarePages/InstalledPackagesPage.cs | 6 +++--- .../Pages/SoftwarePages/PackageBundlesPage.cs | 19 +++++++------------ 9 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs index 699926f17..9e7c0b6f5 100644 --- a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs @@ -8,7 +8,7 @@ private int MySlowMethod1() return new Random().Next(); } - class TestClass + private class TestClass { public TestClass() {} diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index 7937aba62..e432c0925 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -132,5 +132,5 @@ private static async void _removeFromCache(int hash, int cacheTimeSecsSecs) public static class TaskRecyclerTelemetry { - public static int DeduplicatedCalls = 0; + public static int DeduplicatedCalls; } diff --git a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs index 2d5542dd5..f56cda616 100644 --- a/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs +++ b/src/UniGetUI.PackageEngine.Managers.Cargo/CratesIOClient.cs @@ -3,21 +3,21 @@ namespace UniGetUI.PackageEngine.Managers.CargoManager; -record CargoManifest +internal record CargoManifest { public CargoManifestCategory[]? categories { get; init; } public required CargoManifestCrate crate { get; init; } public required CargoManifestVersion[] versions { get; init; } } -record CargoManifestCategory +internal record CargoManifestCategory { public required string category { get; init; } public required string description { get; init; } public required string id { get; init; } } -record CargoManifestCrate +internal record CargoManifestCrate { public string[]? categories { get; init; } public string? description { get; init; } @@ -33,7 +33,7 @@ record CargoManifestCrate public string? updated_at { get; init; } } -record CargoManifestVersion +internal record CargoManifestVersion { public string[]? bin_names { get; init; } public required string checksum { get; init; } @@ -47,19 +47,19 @@ record CargoManifestVersion public bool yanked { get; init; } } -record CargoManifestVersionWrapper +internal record CargoManifestVersionWrapper { public required CargoManifestVersion version { get; init; } } -class CargoManifestPublisher +internal class CargoManifestPublisher { public string? avatar { get; init; } public required string name { get; init; } public string? url { get; init; } } -class CratesIOClient +internal class CratesIOClient { public const string ApiUrl = "https://crates.io/api/v1"; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index f8cfe5ad6..773bfebf6 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -45,8 +45,8 @@ public List Packages /// public event EventHandler? StartedLoading; - readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; - readonly bool DISABLE_RELOAD; + private readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; + private readonly bool DISABLE_RELOAD; private readonly bool PACKAGES_CHECKED_BY_DEFAULT; protected string LOADER_IDENTIFIER; private int LoadOperationIdentifier; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs index 58b22bcdb..9cda17020 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs @@ -6,7 +6,7 @@ namespace UniGetUI.PackageEngine.ManagerClasses.Classes { public class ManagerLogger : IManagerLogger { - readonly IPackageManager Manager; + private readonly IPackageManager Manager; private List operations = new(); public IEnumerable Operations { get => (IEnumerable)operations; } diff --git a/src/UniGetUI/Controls/PackageWrapper.cs b/src/UniGetUI/Controls/PackageWrapper.cs index 336397cfd..4a507ace2 100644 --- a/src/UniGetUI/Controls/PackageWrapper.cs +++ b/src/UniGetUI/Controls/PackageWrapper.cs @@ -15,7 +15,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// public class PackageWrapper : IIndexableListItem, INotifyPropertyChanged, IDisposable { - private static ConcurrentDictionary CachedPackageIcons = new(); + private static readonly ConcurrentDictionary CachedPackageIcons = new(); public static void ResetIconCache() { diff --git a/src/UniGetUI/Controls/SourceManager.xaml.cs b/src/UniGetUI/Controls/SourceManager.xaml.cs index dabca5f8b..f3a1584c3 100644 --- a/src/UniGetUI/Controls/SourceManager.xaml.cs +++ b/src/UniGetUI/Controls/SourceManager.xaml.cs @@ -32,7 +32,7 @@ public void Remove(object sender, RoutedEventArgs e) public sealed partial class SourceManager : UserControl { private IPackageManager Manager { get; set; } - private ObservableCollection Sources = new(); + private readonly ObservableCollection Sources = new(); private ListView _datagrid { get; set; } public SourceManager(IPackageManager Manager) diff --git a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs index 0516e1dfc..0dc3b182a 100644 --- a/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs @@ -20,9 +20,9 @@ public class InstalledPackagesPage : AbstractPackagesPage { private bool HasDoneBackup; - BetterMenuItem? MenuAsAdmin; - BetterMenuItem? MenuInteractive; - BetterMenuItem? MenuRemoveData; + private BetterMenuItem? MenuAsAdmin; + private BetterMenuItem? MenuInteractive; + private BetterMenuItem? MenuRemoveData; private BetterMenuItem? MenuInstallationOptions; private BetterMenuItem? MenuReinstallPackage; private BetterMenuItem? MenuUninstallThenReinstall; diff --git a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs index d531fd1b7..db08e821d 100644 --- a/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs @@ -23,13 +23,13 @@ namespace UniGetUI.Interface.SoftwarePages { public class PackageBundlesPage : AbstractPackagesPage { - BetterMenuItem? MenuInstallOptions; - BetterMenuItem? MenuInstall; - BetterMenuItem? MenuShare; - BetterMenuItem? MenuDetails; - BetterMenuItem? MenuAsAdmin; - BetterMenuItem? MenuInteractive; - BetterMenuItem? MenuSkipHash; + private BetterMenuItem? MenuInstallOptions; + private BetterMenuItem? MenuInstall; + private BetterMenuItem? MenuShare; + private BetterMenuItem? MenuDetails; + private BetterMenuItem? MenuAsAdmin; + private BetterMenuItem? MenuInteractive; + private BetterMenuItem? MenuSkipHash; private bool _hasUnsavedChanges; private bool HasUnsavedChanges @@ -426,7 +426,6 @@ private void MenuRemoveFromList_Invoked(object sender, RoutedEventArgs args) Loader.Remove(package); } - public async Task OpenFromFile(string? file = null) { try @@ -540,8 +539,6 @@ public async Task SaveFile() DialogHelper.HideLoadingDialog(); await MainApp.Instance.MainWindow.ShowDialogAsync(warningDialog); - - } } @@ -680,5 +677,3 @@ public static IPackage InvalidPackageFromSerializable(SerializableIncompatiblePa } } } - - From 66918b8abe443698a7661f6ddd632b289416370f Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Thu, 12 Dec 2024 13:08:46 +0100 Subject: [PATCH 11/11] Add more readonly. Add resharper disable for SourceManager.xaml.cs --- src/UniGetUI.Core.Classes/TaskRecycler.cs | 2 +- src/UniGetUI.Core.Settings/SettingsEngine.cs | 4 ++-- src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs | 2 +- src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs | 2 +- .../ClientHelpers/BundledWinGetHelper.cs | 2 +- .../ClientHelpers/NativePackageHandler.cs | 6 +++--- .../ClientHelpers/NativeWinGetHelper.cs | 2 +- .../Manager/Classes/ManagerLogger.cs | 2 +- .../Packages/Classes/DesktopShortcutsDatabase.cs | 2 +- .../Packages/ImportedPackage.cs | 2 +- .../Packages/InvalidImportedPackage.cs | 4 ++-- .../Packages/Package.cs | 2 +- src/UniGetUI/Controls/SourceManager.xaml.cs | 8 ++++++-- src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs | 2 +- src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs | 2 +- src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs | 2 +- src/UniGetUI/Pages/MainView.xaml.cs | 2 +- src/UniGetUI/Pages/SettingsPage.xaml.cs | 2 +- 18 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index e432c0925..1bb3ff011 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -18,7 +18,7 @@ namespace UniGetUI.Core.Classes; */ public static class TaskRecycler { - private static ConcurrentDictionary> _tasks = new(); + private static readonly ConcurrentDictionary> _tasks = new(); // --------------------------------------------------------------------------------------------------------------- diff --git a/src/UniGetUI.Core.Settings/SettingsEngine.cs b/src/UniGetUI.Core.Settings/SettingsEngine.cs index 8059fb7ac..4caa5fbd4 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine.cs @@ -6,8 +6,8 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary booleanSettings = new(); - private static ConcurrentDictionary valueSettings = new(); + private static readonly ConcurrentDictionary booleanSettings = new(); + private static readonly ConcurrentDictionary valueSettings = new(); public static bool Get(string setting, bool invert = false) { diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs index fb2f270d7..48ca71359 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary> dictionarySettings = new(); + private static readonly ConcurrentDictionary> dictionarySettings = new(); // Returns an empty dictionary if the setting doesn't exist and null if the types are invalid private static Dictionary? _getDictionary(string setting) diff --git a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs index 45dcad82a..db3800158 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine { public static partial class Settings { - private static ConcurrentDictionary> listSettings = new(); + private static readonly ConcurrentDictionary> listSettings = new(); // Returns an empty list if the setting doesn't exist and null if the type is invalid private static List? _getList(string setting) diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs index 39d035cc4..6d97097b8 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/BundledWinGetHelper.cs @@ -13,7 +13,7 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; internal sealed class BundledWinGetHelper : IWinGetManagerHelper { - private WinGet Manager; + private readonly WinGet Manager; public BundledWinGetHelper(WinGet manager) { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs index 5fbecf730..67e35ab7f 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativePackageHandler.cs @@ -8,9 +8,9 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; public static class NativePackageHandler { - private static ConcurrentDictionary __nativePackages = new(); - private static ConcurrentDictionary __nativeDetails = new(); - private static ConcurrentDictionary __nativeInstallers_Install = new(); + private static readonly ConcurrentDictionary __nativePackages = new(); + private static readonly ConcurrentDictionary __nativeDetails = new(); + private static readonly ConcurrentDictionary __nativeInstallers_Install = new(); private static ConcurrentDictionary __nativeInstallers_Uninstall = new(); /// diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs index 909612dbe..891c3ece8 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs @@ -19,7 +19,7 @@ internal sealed class NativeWinGetHelper : IWinGetManagerHelper public static WindowsPackageManagerFactory? ExternalFactory; public PackageManager WinGetManager; public static PackageManager? ExternalWinGetManager; - private WinGet Manager; + private readonly WinGet Manager; public NativeWinGetHelper(WinGet manager) { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs index 9cda17020..571953023 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerLogger.cs @@ -8,7 +8,7 @@ public class ManagerLogger : IManagerLogger { private readonly IPackageManager Manager; - private List operations = new(); + private readonly List operations = new(); public IEnumerable Operations { get => (IEnumerable)operations; } public ManagerLogger(IPackageManager manager) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs index 1d12b1e55..6070c9dc2 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/DesktopShortcutsDatabase.cs @@ -12,7 +12,7 @@ public enum Status Unknown, // The user has not said whether they want this shortcut to be deleted } - private static List UnknownShortcuts = []; + private static readonly List UnknownShortcuts = []; public static IReadOnlyDictionary GetDatabase() { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs index d69bb0e0e..d93cacdc3 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs @@ -13,7 +13,7 @@ public class ImportedPackage : Package public SerializableUpdatesOptions_v1 updates_options; public SerializableInstallationOptions_v1 installation_options; - private string _version; + private readonly string _version; public override string Version { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs index 48ac9a39a..4b8982203 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs @@ -23,8 +23,8 @@ public bool IsChecked set { __is_checked = value; OnPropertyChanged(nameof(IsChecked)); } } - private long __hash; - private long __extended_hash; + private readonly long __hash; + private readonly long __extended_hash; private static OverridenInstallationOptions __overriden_options; public ref OverridenInstallationOptions OverridenOptions { get => ref __overriden_options; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 23f5ad52e..b8fd0f5f7 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -26,7 +26,7 @@ public class Package : IPackage private readonly string ignoredId; private readonly string _iconId; - private static ConcurrentDictionary _cachedIconPaths = new(); + private static readonly ConcurrentDictionary _cachedIconPaths = new(); private IPackageDetails? __details; public IPackageDetails Details diff --git a/src/UniGetUI/Controls/SourceManager.xaml.cs b/src/UniGetUI/Controls/SourceManager.xaml.cs index f3a1584c3..72d097d4d 100644 --- a/src/UniGetUI/Controls/SourceManager.xaml.cs +++ b/src/UniGetUI/Controls/SourceManager.xaml.cs @@ -22,6 +22,7 @@ public SourceItem(SourceManager Parent, IManagerSource Source) this.Parent = Parent; this.Source = Source; } + public void Remove(object sender, RoutedEventArgs e) { RemoveSourceOperation op = new(Source); @@ -29,12 +30,15 @@ public void Remove(object sender, RoutedEventArgs e) op.OperationSucceeded += (_, _) => { Parent.RemoveSourceItem(this); }; } } + public sealed partial class SourceManager : UserControl { private IPackageManager Manager { get; set; } - private readonly ObservableCollection Sources = new(); + // ReSharper disable once FieldCanBeMadeReadOnly.Local + private ObservableCollection Sources = new(); private ListView _datagrid { get; set; } + public SourceManager(IPackageManager Manager) { this.Manager = Manager; @@ -51,7 +55,6 @@ public SourceManager(IPackageManager Manager) { try { - ContentDialog d = new() { Title = CoreTools.Translate("Add source") @@ -170,6 +173,7 @@ public async void LoadSources() { Sources.Add(new SourceItem(this, source)); } + if (Sources.Count > 0) { _datagrid.SelectedIndex = 0; diff --git a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs index f0a87e147..82aa0a1a1 100644 --- a/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs @@ -19,7 +19,7 @@ namespace UniGetUI.Interface public sealed partial class DesktopShortcutsManager : Page { public event EventHandler? Close; - private ObservableCollection desktopShortcuts = new ObservableCollection(); + private readonly ObservableCollection desktopShortcuts = new ObservableCollection(); private bool NewOnly; diff --git a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs index 8e51261a1..b5f5186e5 100644 --- a/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/IgnoredUpdates.xaml.cs @@ -20,7 +20,7 @@ namespace UniGetUI.Interface public sealed partial class IgnoredUpdatesManager : Page { public event EventHandler? Close; - private ObservableCollection ignoredPackages = new ObservableCollection(); + private readonly ObservableCollection ignoredPackages = new ObservableCollection(); public IgnoredUpdatesManager() { diff --git a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs index 8d24dfe41..026372b97 100644 --- a/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs +++ b/src/UniGetUI/Pages/DialogPages/InstallOptions.xaml.cs @@ -20,7 +20,7 @@ public sealed partial class InstallOptionsPage : Page public SerializableInstallationOptions_v1 Options; public IPackage Package; public event EventHandler? Close; - private OperationType Operation; + private readonly OperationType Operation; public InstallOptionsPage(IPackage package, SerializableInstallationOptions_v1 options) : this(package, OperationType.None, options) { } public InstallOptionsPage(IPackage package, OperationType operation, SerializableInstallationOptions_v1 options) diff --git a/src/UniGetUI/Pages/MainView.xaml.cs b/src/UniGetUI/Pages/MainView.xaml.cs index c563a5d23..34202c51c 100644 --- a/src/UniGetUI/Pages/MainView.xaml.cs +++ b/src/UniGetUI/Pages/MainView.xaml.cs @@ -47,7 +47,7 @@ public sealed partial class MainView : UserControl private PageType OldPage_t = PageType.Null; private PageType CurrentPage_t = PageType.Null; - private HashSet AddedPages = new(); + private readonly HashSet AddedPages = new(); public MainView() { diff --git a/src/UniGetUI/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Pages/SettingsPage.xaml.cs index 7881feebc..f05fbbaf9 100644 --- a/src/UniGetUI/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Pages/SettingsPage.xaml.cs @@ -32,7 +32,7 @@ public sealed partial class SettingsPage : IEnterLeaveListener private readonly HyperlinkButton ResetBackupDirectory; private readonly HyperlinkButton OpenBackupDirectory; private readonly TextBlock BackupDirectoryLabel; - private bool InterfaceLoaded; + private readonly bool InterfaceLoaded; public SettingsPage() {