diff --git a/src/ExternalLibraries.FilePickers/Enums/SIATTRIBFLAGS.cs b/src/ExternalLibraries.FilePickers/Enums/SIATTRIBFLAGS.cs index 7b5493018..868ce8b5f 100644 --- a/src/ExternalLibraries.FilePickers/Enums/SIATTRIBFLAGS.cs +++ b/src/ExternalLibraries.FilePickers/Enums/SIATTRIBFLAGS.cs @@ -1,9 +1,9 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellitemarray-getattributes internal enum SIATTRIBFLAGS { - SIATTRIBFLAGS_AND = 0x00000001, // if multiple items and the attirbutes together. + SIATTRIBFLAGS_AND = 0x00000001, // if multiple items and the attributes together. SIATTRIBFLAGS_OR = 0x00000002, // if multiple items or the attributes together. SIATTRIBFLAGS_APPCOMPAT = 0x00000003, // Call GetAttributes directly on the ShellFolder for multiple attributes } diff --git a/src/UniGetUI.Core.Classes/SingletonBase.cs b/src/UniGetUI.Core.Classes/SingletonBase.cs index cc7f96290..e9a4ec699 100644 --- a/src/UniGetUI.Core.Classes/SingletonBase.cs +++ b/src/UniGetUI.Core.Classes/SingletonBase.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes +namespace UniGetUI.Core.Classes { public abstract class SingletonBase where T : SingletonBase { @@ -6,7 +6,5 @@ public abstract class SingletonBase where T : SingletonBase new(() => (Activator.CreateInstance(typeof(T), true) as T)!); public static T Instance => Lazy.Value; - - protected SingletonBase() { } } } diff --git a/src/UniGetUI.Core.Data/CoreData.cs b/src/UniGetUI.Core.Data/CoreData.cs index 4cf08df2a..31dd304e0 100644 --- a/src/UniGetUI.Core.Data/CoreData.cs +++ b/src/UniGetUI.Core.Data/CoreData.cs @@ -13,9 +13,9 @@ private static int GetCodePage() { try { - Process p = new Process() + Process p = new Process { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = "chcp.com", RedirectStandardOutput = true, @@ -155,7 +155,6 @@ public static string IgnoredUpdatesDatabaseFile public static string ManagerLogs = ""; - private static int __volatile_notification_id_counter = 1235; /// @@ -214,7 +213,6 @@ public static string UniGetUIExecutableFile public static string GSudoPath = ""; - /// /// This method will return the most appropriate data directory. /// If the new directory exists, it will be used. diff --git a/src/UniGetUI.Core.Data/Licenses.cs b/src/UniGetUI.Core.Data/Licenses.cs index d936d10b6..076bfb8ab 100644 --- a/src/UniGetUI.Core.Data/Licenses.cs +++ b/src/UniGetUI.Core.Data/Licenses.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Data +namespace UniGetUI.Core.Data { public static class LicenseData { @@ -12,8 +12,8 @@ public static class LicenseData {"Windows App Sdk", "MIT"}, {"NancyFx", "MIT"}, {"YamlDotNet", "MIT"}, - {"InnoDependencyInstaller", "CPOL 1.02" }, - + {"InnoDependencyInstaller", "CPOL 1.02" }, + // Package managers and related {"Winget", "MIT"}, {"Scoop", "MIT"}, @@ -33,8 +33,8 @@ public static class LicenseData public static Dictionary LicenseURLs = new(){ {"UniGetUI", new Uri("https://github.com/marticliment/WingetUI/blob/main/LICENSE")}, - - // C# Libraries + + // C# Libraries {"Pickers", new Uri("https://github.com/PavlikBender/Pickers/blob/master/LICENSE")}, {"Community Toolkit", new Uri("https://github.com/CommunityToolkit/Windows/blob/main/License.md")}, {"H.NotifyIcon", new Uri("https://github.com/HavenDV/H.NotifyIcon/blob/master/LICENSE.md")}, @@ -42,7 +42,7 @@ public static class LicenseData {"NancyFx", new Uri("https://github.com/NancyFx/Nancy/blob/master/license.txt")}, {"YamlDotNet", new Uri("https://github.com/aaubry/YamlDotNet/blob/master/LICENSE.txt") }, {"InnoDependencyInstaller", new Uri("https://github.com/DomGries/InnoDependencyInstaller/blob/master/LICENSE.md") }, - + // Package managers and related {"Winget", new Uri("https://github.com/microsoft/winget-cli/blob/master/LICENSE")}, {"Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE")}, @@ -54,15 +54,15 @@ public static class LicenseData {".NET Sdk", new Uri("https://github.com/dotnet/sdk/blob/main/LICENSE.TXT")}, {"dotnet-tools-outdated", new Uri("https://github.com/rychlym/dotnet-tools-outdated/blob/master/LICENSE")}, {"PowerShell Gallery", new Uri("https://www.powershellgallery.com/")}, - - // Other + + // Other {"Gsudo", new Uri("https://github.com/gerardog/gsudo/blob/master/LICENSE.txt")}, {"Icons", new Uri("https://icons8.com/license")}, }; public static Dictionary HomepageUrls = new(){ {"UniGetUI", new Uri("https://marticliment.com/unigetui")}, - + // C# Libraries {"Pickers", new Uri("https://github.com/PavlikBender/Pickers/")}, {"Community Toolkit", new Uri("https://github.com/CommunityToolkit/Windows/")}, @@ -71,7 +71,7 @@ public static class LicenseData {"NancyFx", new Uri("https://github.com/NancyFx/Nancy/")}, {"YamlDotNet", new Uri("https://github.com/aaubry/YamlDotNet/") }, {"InnoDependencyInstaller", new Uri("https://github.com/DomGries/InnoDependencyInstaller")}, - + // Package managers and related {"Winget", new Uri("https://github.com/microsoft/winget-cli/")}, {"Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/")}, @@ -83,8 +83,8 @@ public static class LicenseData {".NET Sdk", new Uri("https://dotnet.microsoft.com/")}, {"dotnet-tools-outdated", new Uri("https://github.com/rychlym/dotnet-tools-outdated/")}, {"PowerShell Gallery", new Uri("https://www.powershellgallery.com/")}, - - // Other + + // Other {"Gsudo", new Uri("https://github.com/gerardog/gsudo/")}, {"Icons", new Uri("https://icons8.com")}, }; diff --git a/src/UniGetUI.Core.IconEngine.Tests/IconCacheEngineTests.cs b/src/UniGetUI.Core.IconEngine.Tests/IconCacheEngineTests.cs index b4b54df64..af8023774 100644 --- a/src/UniGetUI.Core.IconEngine.Tests/IconCacheEngineTests.cs +++ b/src/UniGetUI.Core.IconEngine.Tests/IconCacheEngineTests.cs @@ -1,4 +1,4 @@ -using UniGetUI.Core.Data; +using UniGetUI.Core.Data; namespace UniGetUI.Core.IconEngine.Tests { @@ -68,7 +68,6 @@ public static async Task TestCacheEngineForPackageVersion(string url, string ver Assert.True(File.Exists(path)); } - [Theory] [InlineData("https://marticliment.com/resources/wingetui.png", 47903, "TestManager", "Package3")] public static async Task TestCacheEngineForPackageSize(string url, long size, string managerName, string packageId) diff --git a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs index 0217b483b..27ca6b6f7 100644 --- a/src/UniGetUI.Core.IconStore/IconCacheEngine.cs +++ b/src/UniGetUI.Core.IconStore/IconCacheEngine.cs @@ -1,4 +1,4 @@ -using System.Security.Cryptography; +using System.Security.Cryptography; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; @@ -55,7 +55,7 @@ public static class IconCacheEngine /// /// Returns the path to the icon file, downloading it if necessary /// - /// a CacheableIcon object representing the object + /// a CacheableIcon object representing the object /// The name of the PackageManager /// the Id of the package /// A path to a local icon file @@ -66,7 +66,7 @@ public static async Task DownloadIconOrCache(CacheableIcon? _icon, strin return ""; } - CacheableIcon icon = _icon ?? new CacheableIcon(); + var icon = (CacheableIcon)_icon; string extension = icon.Url.AbsolutePath[icon.Url.AbsolutePath.LastIndexOf('.')..][1..]; @@ -186,7 +186,6 @@ public static async Task DownloadIconOrCache(CacheableIcon? _icon, strin return FilePath; } - private static async Task CalculateFileHashAsync(string filePath) { using FileStream stream = File.OpenRead(filePath); diff --git a/src/UniGetUI.Core.IconStore/IconDatabase.cs b/src/UniGetUI.Core.IconStore/IconDatabase.cs index f5e51d9da..f876f4240 100644 --- a/src/UniGetUI.Core.IconStore/IconDatabase.cs +++ b/src/UniGetUI.Core.IconStore/IconDatabase.cs @@ -5,6 +5,9 @@ namespace UniGetUI.Core.IconEngine { + /// + /// This class represents the structure of the icon and screenshot database. It is used to deserialize the JSON data. + /// public class IconDatabase { public struct IconCount @@ -42,15 +45,9 @@ public static void InitializeInstance() private Dictionary IconDatabaseData = []; private IconCount __icon_count = new(); - /// - /// Tis class represents the structure of the icon and screenshot database. It is used to deserialize the JSON data. - /// - - /// /// Download the icon and screenshots database to a local file, and load it into memory /// - /// public async void LoadIconAndScreenshotsDatabase() { await LoadIconAndScreenshotsDatabaseAsync(); @@ -83,7 +80,6 @@ public async Task LoadIconAndScreenshotsDatabaseAsync() Logger.Warn(e); } - if (!File.Exists(IconsAndScreenshotsFile)) { Logger.Error("Icon Database file not found"); @@ -98,7 +94,7 @@ public async Task LoadIconAndScreenshotsDatabaseAsync() IconDatabaseData = JsonData.icons_and_screenshots; } - __icon_count = new IconCount() + __icon_count = new IconCount { PackagesWithIconCount = JsonData.package_count.packages_with_icon, PackagesWithScreenshotCount = JsonData.package_count.packages_with_screenshot, diff --git a/src/UniGetUI.Core.Language.Tests/LanguageDataTests.cs b/src/UniGetUI.Core.Language.Tests/LanguageDataTests.cs index bcb194561..11e758dd2 100644 --- a/src/UniGetUI.Core.Language.Tests/LanguageDataTests.cs +++ b/src/UniGetUI.Core.Language.Tests/LanguageDataTests.cs @@ -19,7 +19,6 @@ public void TranslatorsListNotEmptyTest() public void TranslatorsListTest(Person translator) => Assert.NotEmpty(translator.Name); - [Fact] public void LanguageReferenceNotEmptyTest() { @@ -44,4 +43,4 @@ public void TranslatedPercentageNotEmptyTests() } } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.Language.Tests/LanguageEngineTests.cs b/src/UniGetUI.Core.Language.Tests/LanguageEngineTests.cs index dd921a687..5c4109675 100644 --- a/src/UniGetUI.Core.Language.Tests/LanguageEngineTests.cs +++ b/src/UniGetUI.Core.Language.Tests/LanguageEngineTests.cs @@ -1,4 +1,4 @@ -using UniGetUI.PackageEngine.Enums; +using UniGetUI.PackageEngine.Enums; namespace UniGetUI.Core.Language.Tests { @@ -39,7 +39,6 @@ public void TestUniGetUIRefactoring(string language, string uniGetUILogTranslati Assert.Equal(uniGetUITranslation, engine.Translate("WingetUI")); } - [Fact] public void LocalFallbackTest() { diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs index 4d5fe1cff..81631d31c 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs @@ -1,4 +1,4 @@ -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Runtime.InteropServices; using System.Text.Json.Nodes; using UniGetUI.Core.Classes; @@ -10,9 +10,6 @@ namespace UniGetUI.Core.Language { public static class LanguageData { - /// - /// Returns - /// private static Person[]? __translators_list; public static Person[] TranslatorsList diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs index 27ec5ba1a..953a6f1f6 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs @@ -72,7 +72,6 @@ public Dictionary LoadLanguageFile(string LangKey, bool ForceBun } } - Dictionary? __LangDict = (JsonNode.Parse(File.ReadAllText(LangFileToLoad)) as JsonObject)?.ToDictionary(x => x.Key, x => x.Value != null ? x.Value.ToString() : ""); if (__LangDict != null) @@ -103,8 +102,6 @@ public Dictionary LoadLanguageFile(string LangKey, bool ForceBun /// Downloads and saves an updated version of the translations for the specified language. /// /// The Id of the language to download - /// Use the new or the old Url (should not be used manually) - /// public async Task DownloadUpdatedLanguageFile(string LangKey) { try diff --git a/src/UniGetUI.Core.Logger/Logger.cs b/src/UniGetUI.Core.Logger/Logger.cs index f75649b76..14789f024 100644 --- a/src/UniGetUI.Core.Logger/Logger.cs +++ b/src/UniGetUI.Core.Logger/Logger.cs @@ -1,4 +1,4 @@ -using Diagnostics = System.Diagnostics; +using Diagnostics = System.Diagnostics; namespace UniGetUI.Core.Logging { @@ -37,7 +37,6 @@ public static void Error(string s) LogContents.Add(new LogEntry(s, LogEntry.SeverityLevel.Error)); } - // Exception parameter log functions public static void ImportantInfo(Exception e) { @@ -69,7 +68,6 @@ public static void Error(Exception e) LogContents.Add(new LogEntry(e.ToString(), LogEntry.SeverityLevel.Error)); } - public static LogEntry[] GetLogs() { return LogContents.ToArray(); diff --git a/src/UniGetUI.Core.Tools.Tests/ToolsTests.cs b/src/UniGetUI.Core.Tools.Tests/ToolsTests.cs index 484cbc06b..f86735f3f 100644 --- a/src/UniGetUI.Core.Tools.Tests/ToolsTests.cs +++ b/src/UniGetUI.Core.Tools.Tests/ToolsTests.cs @@ -89,7 +89,7 @@ public void TestRandomStringGenerator(int length) Assert.NotEqual(string1, string3); } - foreach (string s in new []{string1, string2, string3}) + foreach (string s in new[] { string1, string2, string3 }) { foreach (char c in s) { @@ -137,4 +137,4 @@ public void TestSafeQueryString(string query, string expected) Assert.Equal(CoreTools.EnsureSafeQueryString(query), expected); } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.Tools/Tools.cs b/src/UniGetUI.Core.Tools/Tools.cs index 4bf0d33ec..32cf1b93b 100644 --- a/src/UniGetUI.Core.Tools/Tools.cs +++ b/src/UniGetUI.Core.Tools/Tools.cs @@ -53,8 +53,6 @@ public static void ReloadLanguageEngineInstance(string ForceLanguage = "") /// /// Dummy function to capture the strings that need to be translated but the translation is handled by a custom widget /// - /// - /// public static string AutoTranslated(string text) { return text; @@ -75,14 +73,14 @@ public static void RelaunchProcess() /// Finds an executable in path and returns its location /// /// The executable alias to find - /// A tuple containing: a boolean hat represents wether the path was found or not; the path to the file if found. + /// A tuple containing: a boolean hat represents whether the path was found or not; the path to the file if found. public static async Task> Which(string command) { command = command.Replace(";", "").Replace("&", "").Trim(); Logger.Debug($"Begin \"which\" search for command {command}"); Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Path.Join(Environment.SystemDirectory, "where.exe"), Arguments = command, @@ -257,8 +255,7 @@ public static async Task GetFileSizeAsyncAsLong(Uri? url) #pragma warning restore SYSLIB0014 // Type or member is obsolete req.Method = "HEAD"; WebResponse resp = await req.GetResponseAsync(); - long ContentLength; - if (long.TryParse(resp.Headers.Get("Content-Length"), out ContentLength)) + if (long.TryParse(resp.Headers.Get("Content-Length"), out long ContentLength)) { return ContentLength; } @@ -356,7 +353,7 @@ public static string EnsureSafeQueryString(string query) } /// - /// Returns a new Uri if the string is not empty. Returns null otherwhise + /// Returns a new Uri if the string is not empty. Returns null otherwise /// /// The null, empty or valid string /// an Uri? instance @@ -378,7 +375,7 @@ public static async Task CacheUACForCurrentProcess() Logger.Info("Caching admin rights for process id " + Environment.ProcessId); Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = CoreData.GSudoPath, Arguments = "cache on --pid " + Environment.ProcessId + " -d 1", @@ -402,7 +399,7 @@ public static async Task ResetUACForCurrentProcess() Logger.Info("Resetting administrator rights cache for process id " + Environment.ProcessId); Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = CoreData.GSudoPath, Arguments = "cache off --pid " + Environment.ProcessId, @@ -423,7 +420,7 @@ public static async Task ResetUACForCurrentProcess() /// The long integer is built with the first half of the MD5 sum of the given string /// /// A non-empty string - /// A long integer containing the first half of the bytes resultng from MD5suming inputString + /// A long integer containing the first half of the bytes resulting from MD5suming inputString public static long HashStringAsLong(string inputString) { byte[] bytes = MD5.HashData(Encoding.UTF8.GetBytes(inputString)); @@ -435,7 +432,6 @@ public static long HashStringAsLong(string inputString) /// /// The location of the link to be created /// The location of the real folder where to point - /// public static async Task CreateSymbolicLinkDir(string linkPath, string targetPath) { var startInfo = new ProcessStartInfo @@ -465,7 +461,6 @@ public static async Task CreateSymbolicLinkDir(string linkPath, string targetPat /// Will check whether the given folder is a symbolic link /// /// The folder to check - /// /// public static bool IsSymbolicLinkDir(string path) { diff --git a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs index 23a06c280..ad63a748c 100644 --- a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs +++ b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs @@ -46,7 +46,6 @@ public static bool AuthenticateToken(string token) /// /// Run the background api and wait for it for being stopped with the Stop() method /// - /// public async Task Start() { try @@ -151,7 +150,6 @@ public void BuildShareApi() } }); - // Basic entrypoint to know if UniGetUI is running Get("/is-running", (parameters) => { @@ -160,7 +158,7 @@ public void BuildShareApi() } /// - /// Build the endpoints required for the /widgets/v1 endpoint. All of these + /// Build the endpoints required for the /widgets/v1 endpoint. All of these /// endpoints are authenticated with MainApp.Instance.AuthenticateToken /// public void BuildV1WidgetsApi() @@ -199,7 +197,7 @@ public void BuildV1WidgetsApi() { if (package.Tag is PackageTag.OnQueue or PackageTag.BeingProcessed) { - continue; // Do not show already processed packages on queue + continue; // Do not show already processed packages on queue } string icon = $"http://localhost:7058/widgets/v2/get_icon_for_package?packageId={package.Id}&packageSource={package.Source.Name}&token={ApiTokenHolder.Token}"; @@ -318,7 +316,7 @@ public void BuildV1WidgetsApi() } byte[] fileContents = await File.ReadAllBytesAsync(iconPath); - return new Response() + return new Response { ContentType = $"image/{iconPath.Split('.')[^1]}", Contents = (stream) => diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs b/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs index b82481f2f..8cd8f6fc1 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IInstallationOptions.cs @@ -1,16 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Text.Json; -using System.Threading.Tasks; -using UniGetUI.Core.Data; -using UniGetUI.Core.Language; -using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Serializable; -using Windows.ApplicationModel; namespace UniGetUI.PackageEngine.Interfaces { @@ -31,13 +21,11 @@ public interface IInstallationOptions /// /// Loads and applies the options from the given SerializableInstallationOptions_v1 object to the current object. /// - /// public void FromSerializable(SerializableInstallationOptions_v1 options); /// /// Returns a SerializableInstallationOptions_v1 object containing the options of the current instance. /// - /// public SerializableInstallationOptions_v1 AsSerializable(); /// @@ -69,7 +57,6 @@ public async Task LoadFromDiskAsync() /// /// Returns a string representation of the current options. /// - /// public string ToString(); } } diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IManagerSource.cs b/src/UniGetUI.PAckageEngine.Interfaces/IManagerSource.cs index 7201f3333..efdf5e50c 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IManagerSource.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IManagerSource.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UniGetUI.Interface.Enums; namespace UniGetUI.PackageEngine.Interfaces @@ -23,16 +18,14 @@ public interface IManagerSource /// /// Returns a human-readable string representing the source name /// - /// public string ToString(); /// /// Replaces the current URL with the new one. Must be used only when a placeholder URL is used. /// - /// - void ReplaceUrl(Uri newUrl) - { - Url = newUrl; - } + void ReplaceUrl(Uri newUrl) + { + Url = newUrl; + } } } diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs b/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs index 9ea227de7..a0527018f 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IPackage.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using System.Runtime.CompilerServices; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Serializable; using UniGetUI.PackageEngine.Enums; @@ -24,15 +23,13 @@ public interface IPackage : INotifyPropertyChanged, IEquatable public string SourceAsString { get; } public string AutomationName { get; } - /// /// Returns an identifier that can be used to compare different packahe instances that refer to the same package. /// What is taken into account: /// - Manager and Source /// - Package Identifier - /// For more specific comparsion use GetVersionedHash() + /// For more specific comparison use GetVersionedHash() /// - /// public long GetHash(); /// @@ -43,30 +40,27 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// - Package version /// - Package new version (if any) /// - /// public long GetVersionedHash(); /// - /// Check wether two packages are **REALLY** the same package. + /// Check whether two packages are **REALLY** the same package. /// What is taken into account: /// - Manager and Source /// - Package Identifier /// - Package version /// - Package new version (if any) /// - /// - /// public bool Equals(object? other); /// - /// Check wether two package instances represent the same package. + /// Check whether two package instances represent the same package. /// What is taken into account: /// - Manager and Source /// - Package Identifier - /// For more specific comparsion use package.Equals(object? other) + /// For more specific comparison use package.Equals(object? other) /// /// A package - /// Wether the two instances refer to the same instance + /// Whether the two instances refer to the same instance public bool IsEquivalentTo(IPackage? other); /// @@ -85,7 +79,6 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// /// Retrieves a list og URIs representing the available screenshots for this package. /// - /// public Task GetPackageScreenshots(); @@ -93,32 +86,26 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// 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. /// - /// - /// public Task AddToIgnoredUpdatesAsync(string version = "*"); /// /// Removes the package from the ignored updates list, either if it is ignored for all updates or for a specific version only. /// - /// public Task RemoveFromIgnoredUpdatesAsync(); /// /// Returns true if the package's updates are ignored. If the version parameter - /// is passed it will be checked if that version is ignored. Please note that if - /// all updates are ignored, calling this method with a specific version will - /// still return true, although the passed version is not explicitly ignored. + /// is passed it will be checked if that version is ignored. Please note that if + /// all updates are ignored, calling this method with a specific version will + /// still return true, although the passed version is not explicitly ignored. /// - /// - /// public Task HasUpdatesIgnoredAsync(string Version = "*"); /// - /// Returns (as a string) the version for which a package has been ignored. When no versions + /// Returns (as a string) the version for which a package has been ignored. When no versions /// are ignored, an empty string will be returned; and when all versions are ignored an asterisk /// will be returned. /// - /// public Task GetIgnoredUpdatesVersionAsync(); /// @@ -143,13 +130,11 @@ public interface IPackage : INotifyPropertyChanged, IEquatable /// Sets the package tag. You may as well use the Tag property. /// This function is used for compatibility with the ? operator /// - /// public void SetTag(PackageTag tag); /// - /// Checks wether a new version of this package is installed + /// Checks whether a new version of this package is installed /// - /// public bool NewerVersionIsInstalled(); public Task AsSerializable(); diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IPackageDetails.cs b/src/UniGetUI.PAckageEngine.Interfaces/IPackageDetails.cs index 19da1d44d..c1e92fafe 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IPackageDetails.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IPackageDetails.cs @@ -1,11 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UniGetUI.Core.Logging; -using UniGetUI.PackageEngine.Interfaces; - namespace UniGetUI.PackageEngine.Interfaces { public interface IPackageDetails @@ -16,7 +8,7 @@ public interface IPackageDetails public IPackage Package { get; } /// - /// Wether this PackageDetails instance has valid data or not. + /// Whether this PackageDetails instance has valid data or not. /// To load valid data, make use of the `Load()` method /// public bool IsPopulated { get; } diff --git a/src/UniGetUI.PAckageEngine.Interfaces/IPackageManager.cs b/src/UniGetUI.PAckageEngine.Interfaces/IPackageManager.cs index 0fde43360..94f8170e7 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/IPackageManager.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/IPackageManager.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UniGetUI.Core.IconEngine; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces.ManagerProviders; @@ -31,42 +25,34 @@ public interface IPackageManager : ISourceProvider, IPackageDetailsProvider /// /// Initializes the Package Manager (asynchronously). Must be run before using any other method of the manager. /// - /// public Task InitializeAsync(); /// /// Returns true if the manager is enabled, false otherwise /// - /// public bool IsEnabled(); /// /// Returns true if the manager is enabled and available (the required executable files were found). Returns false otherwise /// - /// public bool IsReady(); /// - /// Returns an array of Package objects that the manager lists for the given query. Depending on the manager, the list may + /// Returns an array of Package objects that the manager lists for the given query. Depending on the manager, the list may /// also include similar results. This method is fail-safe and will return an empty array if an error occurs. /// - /// - /// public Task FindPackages(string query); /// - /// Returns an array of UpgradablePackage objects that represent the available updates reported by the manager. + /// Returns an array of UpgradablePackage objects that represent the available updates reported by the manager. /// This method is fail-safe and will return an empty array if an error occurs. /// - /// - /// public Task GetAvailableUpdates(); /// - /// Returns an array of Package objects that represent the installed reported by the manager. + /// Returns an array of Package objects that represent the installed reported by the manager. /// This method is fail-safe and will return an empty array if an error occurs. /// - /// public Task GetInstalledPackages(); /// @@ -135,7 +121,6 @@ public interface IPackageManager : ISourceProvider, IPackageDetailsProvider /// Refreshes the Package Manager sources/indexes /// Each manager MUST implement this method. /// - /// public Task RefreshPackageIndexes(); public IManagerSource GetSourceOrDefault(string SourceName); public IManagerSource? GetSourceIfExists(string SourceName); diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ISourceFactory.cs b/src/UniGetUI.PAckageEngine.Interfaces/ISourceFactory.cs index 8aaf42599..3e4013851 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ISourceFactory.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ISourceFactory.cs @@ -1,5 +1,3 @@ -using UniGetUI.PackageEngine.ManagerClasses.Manager; - namespace UniGetUI.PackageEngine.Interfaces { public interface ISourceFactory @@ -14,20 +12,16 @@ public interface ISourceFactory /// /// Returns the existing source for the given name, or null if it does not exist. /// - /// - /// public IManagerSource? GetSourceIfExists(string name); /// /// Adds a source to the factory, if the given source does not exist /// - /// public void AddSource(IManagerSource source); /// /// Returns the available sources on the factory /// - /// public IManagerSource[] GetAvailableSources(); /// diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs index a179d547c..ab66b2cb0 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs @@ -1,4 +1,3 @@ -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.Interface.Enums; diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/IPackageDetailsProvider.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/IPackageDetailsProvider.cs index 81f3307c3..51a5156c3 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/IPackageDetailsProvider.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/IPackageDetailsProvider.cs @@ -1,4 +1,4 @@ -using UniGetUI.Core.IconEngine; +using UniGetUI.Core.IconEngine; namespace UniGetUI.PackageEngine.Interfaces.ManagerProviders { @@ -6,16 +6,15 @@ public interface IPackageDetailsProvider { /// /// Returns a PackageDetails object that represents the details for the given Package object. - /// This method is fail-safe and will return a valid but empty PackageDetails object with the package + /// This method is fail-safe and will return a valid but empty PackageDetails object with the package /// id if an error occurs. /// /// The PackageDetails instance to load /// A PackageDetails object public abstract Task GetPackageDetails(IPackageDetails details); - /// - /// Returns the available versions to install for the given package. + /// Returns the available versions to install for the given package. /// If the manager does not support listing the versions, an empty array will be returned. /// This method is fail-safe and will return an empty array if an error occurs. /// @@ -24,16 +23,15 @@ public interface IPackageDetailsProvider public abstract Task GetPackageVersions(IPackage package); /// - /// Returns an Uri pointing to the icon of this package. + /// Returns an Uri pointing to the icon of this package. /// The uri may be either a ms-appx:/// url or a http(s):// protocol url /// /// The package from which to load the icon /// A full path to a valid icon file public abstract Task GetPackageIconUrl(IPackage package); - /// - /// Returns the URLs to the screenshots (if any) of this package. + /// Returns the URLs to the screenshots (if any) of this package. /// /// The package from which to load the screenshots /// An array with valid URIs to the screenshots diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/ISourceProvider.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/ISourceProvider.cs index d4eb165f1..bd994b978 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/ISourceProvider.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProviders/ISourceProvider.cs @@ -1,4 +1,4 @@ -using UniGetUI.PackageEngine.Enums; +using UniGetUI.PackageEngine.Enums; namespace UniGetUI.PackageEngine.Interfaces.ManagerProviders { @@ -24,7 +24,7 @@ public interface ISourceProvider /// Checks the result of attempting to add a source /// /// The added (or not) source - /// The returncode of the operation + /// The return code of the operation /// the command-line output of the operation /// An OperationVeredict value public abstract OperationVeredict GetAddSourceOperationVeredict(IManagerSource source, int ReturnCode, string[] Output); @@ -33,7 +33,7 @@ public interface ISourceProvider /// Checks the result of attempting to remove a source /// /// The removed (or not) source - /// The returncode of the operation + /// The return code of the operation /// the command-line output of the operation /// An OperationVeredict value public abstract OperationVeredict GetRemoveSourceOperationVeredict(IManagerSource source, int ReturnCode, string[] Output); diff --git a/src/UniGetUI.PackageEngine.Enums/Enums.cs b/src/UniGetUI.PackageEngine.Enums/Enums.cs index c6b0bb9bd..20f9cece2 100644 --- a/src/UniGetUI.PackageEngine.Enums/Enums.cs +++ b/src/UniGetUI.PackageEngine.Enums/Enums.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.PackageEngine.Enums +namespace UniGetUI.PackageEngine.Enums { /// /// Represents the installation scope of a package @@ -27,7 +27,6 @@ public enum BundleFormatType XML } - public enum OperationVeredict { Succeeded, diff --git a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs index cd0c6d036..31cabb9a1 100644 --- a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs +++ b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs @@ -1,5 +1,4 @@ using System.Runtime.InteropServices; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { diff --git a/src/UniGetUI.PackageEngine.Enums/ManagerStatus.cs b/src/UniGetUI.PackageEngine.Enums/ManagerStatus.cs index 1e22648ef..42a95e916 100644 --- a/src/UniGetUI.PackageEngine.Enums/ManagerStatus.cs +++ b/src/UniGetUI.PackageEngine.Enums/ManagerStatus.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers +namespace UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers { public struct ManagerStatus { @@ -7,6 +7,5 @@ public struct ManagerStatus public string ExecutablePath = ""; public ManagerStatus() { } - } } diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs index f968b6b14..fc970d6b5 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs @@ -23,9 +23,9 @@ public class Chocolatey : BaseNuGet public static new string[] FALSE_PACKAGE_IDS = ["Directory", "", "Did", "Features?", "Validation", "-", "being", "It", "Error", "L'accs", "Maximum", "This", "Output is package name ", "operable", "Invalid"]; public static new string[] FALSE_PACKAGE_VERSIONS = ["", "Did", "Features?", "Validation", "-", "being", "It", "Error", "L'accs", "Maximum", "This", "packages", "current version", "installed version", "is", "program", "validations", "argument", "no"]; - public Chocolatey() : base() + public Chocolatey() { - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, CanSkipIntegrityChecks = true, @@ -36,14 +36,14 @@ public Chocolatey() : base() SupportsPreRelease = true, SupportsCustomSources = true, SupportsCustomPackageIcons = true, - Sources = new SourceCapabilities() + Sources = new SourceCapabilities { KnowsPackageCount = false, KnowsUpdateDate = false, } }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "Chocolatey", Description = CoreTools.Translate("The classic package manager for windows. You'll find everything there.
Contains: General Software"), @@ -67,7 +67,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " outdated", @@ -121,7 +121,7 @@ protected override async Task GetInstalledPackages_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " list", @@ -388,7 +388,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = "--version", diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/ChocolateyDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/ChocolateyDetailsProvider.cs index 1113981e7..c16e211f6 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/ChocolateyDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/ChocolateyDetailsProvider.cs @@ -3,7 +3,6 @@ using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.Managers.PowerShellManager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.Chocolatey { @@ -16,7 +15,7 @@ protected override async Task GetPackageVersions_Unsafe(IPackage packa { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { // choco search php --exact --all-versions FileName = Manager.Status.ExecutablePath, diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs index 2d1086e2a..874541c0b 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs @@ -21,7 +21,7 @@ public class DotNet : BaseNuGet public static new string[] FALSE_PACKAGE_IDS = [""]; public static new string[] FALSE_PACKAGE_VERSIONS = [""]; - public DotNet() : base() + public DotNet() { Dependencies = [ new ManagerDependency( @@ -32,7 +32,7 @@ public DotNet() : base() async () => (await CoreTools.Which("dotnet-tools-outdated.exe")).Item1) ]; - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, SupportsCustomScopes = true, @@ -44,7 +44,7 @@ public DotNet() : base() SupportsCustomVersions = true, }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = ".NET Tool", Description = CoreTools.Translate("A repository full of tools and executables designed with Microsoft's .NET ecosystem in mind.
Contains: .NET related tools and scripts"), @@ -68,7 +68,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process proc = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " install --global dotnet-tools-outdated", @@ -92,7 +92,7 @@ protected override async Task GetAvailableUpdates_UnSafe() Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = path, Arguments = "", @@ -155,10 +155,10 @@ protected override async Task GetInstalledPackages_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, - Arguments = Properties.ExecutableCallArgs + $" list" + (scope == PackageScope.Global ? " --global" : ""), + Arguments = Properties.ExecutableCallArgs + " list" + (scope == PackageScope.Global ? " --global" : ""), RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, @@ -292,7 +292,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = "tool -h", @@ -313,7 +313,7 @@ protected override async Task LoadManager() process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = "--version", diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs index bad990478..ce3f49228 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs @@ -2,7 +2,6 @@ using System.Web; using UniGetUI.Core.Data; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; @@ -16,7 +15,7 @@ public abstract class BaseNuGet : PackageManager public static new string[] FALSE_PACKAGE_IDS = [""]; public static new string[] FALSE_PACKAGE_VERSIONS = [""]; - public BaseNuGet() : base() + public BaseNuGet() { PackageDetailsProvider = new BaseNuGetDetailsProvider(this); } @@ -67,7 +66,7 @@ protected sealed override async Task FindPackages_UnSafe(string query foreach(IManagerSource source in sources) { Uri SearchUrl = new($"{source.Url}/Search()?searchTerm=%27{HttpUtility.UrlEncode(query)}%27&targetFramework=%27%27&includePrerelease=false"); - logger.Log($"Begin package search with url={SearchUrl} on manager {Name}"); ; + logger.Log($"Begin package search with url={SearchUrl} on manager {Name}"); using HttpClient client = new(CoreData.GenericHttpClientParameters); client.DefaultRequestHeaders.UserAgent.ParseAdd(CoreData.UserAgentString); diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsProvider.cs index 9a7406c54..1a1820184 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsProvider.cs @@ -6,10 +6,8 @@ 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.Managers.Generic.NuGet.Internal; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.PowerShellManager { @@ -47,20 +45,20 @@ protected override async Task GetPackageDetails_Unsafe(IPackageDetails details) Logger.Warn($"Failed to parse NuGet Installer URL on package Id={details.Package.Id} for value={match.Groups[1].Value}: " + ex.Message); } } - + foreach (Match match in Regex.Matches(PackageManifestContents, @"<(d\:)?PackageSize (m\:type=""[^""]+"")?>([0-9]+)<\/")) { try { - details.InstallerSize = long.Parse(match.Groups[3].Value)/1000000.0; + details.InstallerSize = long.Parse(match.Groups[3].Value) / 1000000.0; break; } catch (Exception ex) { Logger.Warn($"Failed to parse NuGet Installer Size on package Id={details.Package.Id} for value={match.Groups[1].Value}: " + ex.Message); - } + } } - + foreach (Match match in Regex.Matches(PackageManifestContents, @"[^<>]+<\/name>")) { details.Author = match.Value.Replace("", "").Replace("", ""); diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/Internal/PackageManifestLoader.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/Internal/PackageManifestLoader.cs index b3fac0190..00d00b750 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/Internal/PackageManifestLoader.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/Internal/PackageManifestLoader.cs @@ -1,7 +1,6 @@ using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.Generic.NuGet.Internal { diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs index b71ae9954..5200e2529 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs @@ -17,9 +17,9 @@ public class Npm : PackageManager public static new string[] FALSE_PACKAGE_IDS = [""]; public static new string[] FALSE_PACKAGE_VERSIONS = [""]; - public Npm() : base() + public Npm() { - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, SupportsCustomVersions = true, @@ -27,7 +27,7 @@ public Npm() : base() SupportsPreRelease = true, }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "Npm", Description = CoreTools.Translate("Node JS's package manager. Full of libraries and other utilities that orbit the javascript world
Contains: Node javascript libraries and other related utilities"), @@ -50,7 +50,7 @@ protected override async Task FindPackages_UnSafe(string query) { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " search \"" + query + "\" --parseable", @@ -104,7 +104,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " outdated --parseable" + (scope == PackageScope.Global ? " --global" : ""), @@ -156,7 +156,7 @@ protected override async Task GetInstalledPackages_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " list" + (scope == PackageScope.Global ? " --global" : ""), @@ -282,7 +282,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " --version", diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/NpmPackageDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Npm/NpmPackageDetailsProvider.cs index d5c4ef45e..863dbc5b8 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/NpmPackageDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/NpmPackageDetailsProvider.cs @@ -6,7 +6,6 @@ using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.NpmManager { @@ -23,7 +22,7 @@ protected override async Task GetPackageDetails_Unsafe(IPackageDetails details) details.ReleaseNotesUrl = new Uri($"https://www.npmjs.com/package/{details.Package.Id}?activeTab=versions"); using Process p = new(); - p.StartInfo = new ProcessStartInfo() + p.StartInfo = new ProcessStartInfo { FileName = Manager.Status.ExecutablePath, Arguments = Manager.Properties.ExecutableCallArgs + " info " + details.Package.Id, @@ -115,7 +114,7 @@ protected override async Task GetPackageVersions_Unsafe(IPackage packa { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Manager.Status.ExecutablePath, Arguments = Manager.Properties.ExecutableCallArgs + " show " + package.Id + " versions --json", diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs index 47a2bd3cd..bbd917bf1 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs @@ -18,9 +18,9 @@ public class Pip : PackageManager public static new string[] FALSE_PACKAGE_IDS = ["", "WARNING:", "[notice]", "Package", "DEPRECATION:"]; public static new string[] FALSE_PACKAGE_VERSIONS = ["", "Ignoring", "invalid"]; - public Pip() : base() + public Pip() { - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, SupportsCustomVersions = true, @@ -28,7 +28,7 @@ public Pip() : base() SupportsPreRelease = true, }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "Pip", Description = CoreTools.Translate("Python's library manager. Full of python libraries and other python-related utilities
Contains: Python libraries and related utilities"), @@ -57,7 +57,7 @@ protected override async Task FindPackages_UnSafe(string query) { Process proc = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " install parse_pip_search", @@ -80,7 +80,7 @@ protected override async Task FindPackages_UnSafe(string query) Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = path, Arguments = "\"" + query + "\"", @@ -140,7 +140,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " list --outdated", @@ -202,7 +202,7 @@ protected override async Task GetInstalledPackages_UnSafe() Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " list", @@ -342,7 +342,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " --version", diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/PipPackageDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Pip/PipPackageDetailsProvider.cs index e8f4d66b6..b61ceb80f 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/PipPackageDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/PipPackageDetailsProvider.cs @@ -7,7 +7,6 @@ using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.PipManager { @@ -24,7 +23,6 @@ protected override async Task GetPackageDetails_Unsafe(IPackageDetails details) client.DefaultRequestHeaders.UserAgent.ParseAdd(CoreData.UserAgentString); JsonString = await client.GetStringAsync($"https://pypi.org/pypi/{details.Package.Id}/json"); - if (JsonObject.Parse(JsonString) is not JsonObject RawInfo) { logger.Error($"Can't load package info on manager {Manager.Name}, JsonObject? RawInfo was null"); @@ -155,7 +153,7 @@ protected override async Task GetPackageVersions_Unsafe(IPackage packa { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Manager.Status.ExecutablePath, Arguments = Manager.Properties.ExecutableCallArgs + " index versions " + package.Id, diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs index 083235e95..f080c2a7e 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs @@ -19,9 +19,9 @@ public class PowerShell : BaseNuGet public static new string[] FALSE_PACKAGE_IDS = [""]; public static new string[] FALSE_PACKAGE_VERSIONS = [""]; - public PowerShell() : base() + public PowerShell() { - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, CanSkipIntegrityChecks = true, @@ -30,14 +30,14 @@ public PowerShell() : base() SupportsCustomSources = true, SupportsPreRelease = true, SupportsCustomPackageIcons = true, - Sources = new SourceCapabilities() + Sources = new SourceCapabilities { KnowsPackageCount = false, KnowsUpdateDate = false, } }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "PowerShell", DisplayName = "PowerShell 5.x", @@ -60,7 +60,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = "", @@ -146,7 +146,7 @@ protected override async Task GetInstalledPackages_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " Get-InstalledModule", @@ -289,7 +289,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " \"echo $PSVersionTable\"", diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs index 06efdf317..a68d8301b 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs @@ -20,9 +20,9 @@ public class PowerShell7 : BaseNuGet public static new string[] FALSE_PACKAGE_IDS = [""]; public static new string[] FALSE_PACKAGE_VERSIONS = [""]; - public PowerShell7() : base() + public PowerShell7() { - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, CanSkipIntegrityChecks = true, @@ -31,14 +31,14 @@ public PowerShell7() : base() SupportsCustomSources = true, SupportsPreRelease = true, SupportsCustomPackageIcons = true, - Sources = new SourceCapabilities() + Sources = new SourceCapabilities { KnowsPackageCount = false, KnowsUpdateDate = false, } }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "PowerShell7", DisplayName = "PowerShell 7.x (beta)", @@ -61,7 +61,7 @@ protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = "", @@ -147,7 +147,7 @@ protected override async Task GetInstalledPackages_UnSafe() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " Get-InstalledModule", @@ -292,7 +292,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = " -Version", diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7SourceProvider.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7SourceProvider.cs index 3f21fcfdc..b3eb3ca1b 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7SourceProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7SourceProvider.cs @@ -2,7 +2,6 @@ using System.Text.RegularExpressions; using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs index 377cde940..0483f24bc 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs @@ -25,7 +25,7 @@ public class Scoop : PackageManager private long LastScoopSourceUpdateTime; - public Scoop() : base() + public Scoop() { Dependencies = [ // Scoop-Search is required for search to work @@ -44,7 +44,7 @@ public Scoop() : base() async () => (await CoreTools.Which("git.exe")).Item1) ]; - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, CanSkipIntegrityChecks = true, @@ -53,14 +53,14 @@ public Scoop() : base() SupportedCustomArchitectures = [Architecture.X86, Architecture.X64, Architecture.Arm64], SupportsCustomScopes = true, SupportsCustomSources = true, - Sources = new SourceCapabilities() + Sources = new SourceCapabilities { KnowsPackageCount = true, KnowsUpdateDate = true } }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "Scoop", Description = CoreTools.Translate("Great repository of unknown but useful utilities and other interesting packages.
Contains: Utilities, Command-line programs, General Software (extras bucket required)"), @@ -98,7 +98,7 @@ protected override async Task FindPackages_UnSafe(string query) { Process proc = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " install main/scoop-search", @@ -119,7 +119,7 @@ protected override async Task FindPackages_UnSafe(string query) Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = path, Arguments = query, @@ -186,7 +186,7 @@ protected override async Task GetAvailableUpdates_UnSafe() Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " status", @@ -252,7 +252,7 @@ protected override async Task GetInstalledPackages_UnSafe() Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " list", @@ -455,7 +455,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " --version", @@ -486,7 +486,7 @@ private async void RunCleanup() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " " + command, diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/ScoopPackageDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/ScoopPackageDetailsProvider.cs index 3ba310de7..14804f97f 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/ScoopPackageDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/ScoopPackageDetailsProvider.cs @@ -7,7 +7,6 @@ using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Managers.ScoopManager { @@ -32,7 +31,7 @@ protected override async Task GetPackageDetails_Unsafe(IPackageDetails details) Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Manager.Status.ExecutablePath, Arguments = Manager.Properties.ExecutableCallArgs + " cat " + details.Package.Source.Name + "/" + details.Package.Id, diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/BundledWinGetLegacyMethods.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/BundledWinGetLegacyMethods.cs index 42a133dbd..de53d64f6 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/BundledWinGetLegacyMethods.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/BundledWinGetLegacyMethods.cs @@ -1,6 +1,5 @@ using System.Diagnostics; using UniGetUI.Core.Logging; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; @@ -289,7 +288,7 @@ private static IManagerSource GetLocalSource(WinGet Manager, string id) return Manager.AndroidSubsystemSource; } - // Check if source is Steama + // Check if source is Steam if ((id == "Steam" || id.Contains("Steam App ")) && id.Split("Steam App").Length >= 2 && !id.Split("Steam App")[1].Trim().Any(x => !"1234567890".Contains(x))) { return Manager.SteamSource; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs index fd5aacd7e..9869a6e25 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs @@ -34,7 +34,7 @@ public class WinGet : PackageManager public readonly string PowerShellInlineArgs; public string WinGetBundledPath; - public WinGet() : base() + public WinGet() { PowerShellPath = Path.Join(Environment.SystemDirectory, "windowspowershell\\v1.0\\powershell.exe"); PowerShellPromptArgs = "-ExecutionPolicy Bypass -NoLogo -NoProfile"; @@ -58,7 +58,8 @@ public WinGet() : base() Process p = new() { - StartInfo = new ProcessStartInfo() { + StartInfo = new ProcessStartInfo + { FileName = PowerShellPath, Arguments = PowerShellPromptArgs, RedirectStandardInput = true, @@ -73,7 +74,7 @@ public WinGet() : base() }) ]; - Capabilities = new ManagerCapabilities() + Capabilities = new ManagerCapabilities { CanRunAsAdmin = true, CanSkipIntegrityChecks = true, @@ -86,7 +87,7 @@ public WinGet() : base() SupportsCustomSources = true, SupportsCustomPackageIcons = true, SupportsCustomPackageScreenshots = true, - Sources = new SourceCapabilities() + Sources = new SourceCapabilities { KnowsPackageCount = false, KnowsUpdateDate = true, @@ -94,7 +95,7 @@ public WinGet() : base() } }; - Properties = new ManagerProperties() + Properties = new ManagerProperties { Name = "Winget", DisplayName = "WinGet", @@ -181,7 +182,7 @@ public ManagerSource GetLocalSource(string id) return MicrosoftStoreSource; } - // Otherwise, Source is localpc + // Otherwise, Source is Local PC return LocalPcSource; } catch (Exception ex) @@ -348,7 +349,7 @@ protected override async Task LoadManager() Process process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " --version", @@ -370,7 +371,7 @@ protected override async Task LoadManager() process = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = PowerShellPath, Arguments = PowerShellInlineArgs + " -Command Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version", @@ -416,7 +417,7 @@ public override async Task RefreshPackageIndexes() { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Status.ExecutablePath, Arguments = Properties.ExecutableCallArgs + " source update --disable-interactivity", diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs index 45c54bdc8..ecfba14c5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs @@ -6,7 +6,6 @@ using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; @@ -16,10 +15,6 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager; internal sealed class BundledWinGetHelper : IWinGetManagerHelper { - public BundledWinGetHelper() - { - } - public async Task GetAvailableUpdates_UnSafe(WinGet Manager) { if (Settings.Get("ForceLegacyBundledWinGet")) @@ -31,7 +26,7 @@ public async Task GetAvailableUpdates_UnSafe(WinGet Manager) Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C " + Manager.PowerShellPath + " " + Manager.PowerShellPromptArgs, @@ -123,7 +118,7 @@ public async Task GetInstalledPackages_UnSafe(WinGet Manager) List Packages = []; Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C " + Manager.PowerShellPath + " " + Manager.PowerShellPromptArgs, @@ -221,7 +216,7 @@ public async Task FindPackages_UnSafe(WinGet Manager, string query) Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C " + Manager.PowerShellPath + " " + Manager.PowerShellPromptArgs, @@ -399,7 +394,6 @@ public async Task GetPackageDetails_UnSafe(WinGet Manager, IPackageDetails detai output.Clear(); Logger.Info("Winget could not found culture data for package Id=" + details.Package.Id + " and Culture=en-US. Loading default"); - LocaleFound = true; process = new Process(); startInfo = new() { @@ -467,7 +461,7 @@ public async Task GetPackageDetails_UnSafe(WinGet Manager, IPackageDetails detai IsLoadingTags = false; } - // Check for singleline fields + // Check for single-line fields if (line.Contains("Publisher:")) { details.Publisher = line.Split(":")[1].Trim(); @@ -539,7 +533,7 @@ public async Task GetPackageVersions_Unsafe(WinGet Manager, IPackage p { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = Manager.WinGetBundledPath, Arguments = Manager.Properties.ExecutableCallArgs + " show --id " + package.Id + diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/IWinGetManagerHelpers.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/IWinGetManagerHelpers.cs index 2cc00cf4a..f3aa00eb7 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/IWinGetManagerHelpers.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/IWinGetManagerHelpers.cs @@ -1,4 +1,3 @@ -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.PackageClasses; @@ -35,5 +34,3 @@ internal interface IWinGetManagerHelper public Task GetPackageDetails_UnSafe(WinGet Manager, IPackageDetails details); } } - - diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetPackageDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetPackageDetailsProvider.cs index b5d16f3b4..7fe0a177d 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetPackageDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetPackageDetailsProvider.cs @@ -1,4 +1,3 @@ -using Microsoft.Management.Deployment; using System.Globalization; using System.Net; using System.Text.RegularExpressions; @@ -6,7 +5,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 @@ -21,7 +19,7 @@ private struct MicrosoftStoreProductType } public WinGetPackageDetailsProvider(WinGet manager) : base(manager) { } - + protected override async Task GetPackageVersions_Unsafe(IPackage package) { return await WinGetHelper.Instance.GetPackageVersions_Unsafe((WinGet)Manager, package); @@ -61,7 +59,7 @@ protected override async Task GetPackageScreenshots_Unsafe(IPackage packa Match IconArray = Regex.Match(ResponseContent, "(?:\"|')Images(?:\"|'): ?\\[([^\\]]+)\\]"); if (!IconArray.Success) { - Logger.Warn($"Could not parse Images array from Microsoft Store response"); + Logger.Warn("Could not parse Images array from Microsoft Store response"); return []; } @@ -93,7 +91,6 @@ protected override async Task GetPackageScreenshots_Unsafe(IPackage packa return FoundIcons.ToArray(); } - private static async Task GetMicrosoftStorePackageManifest(IPackage package) { if (__msstore_package_manifests.TryGetValue(package.Id, out var manifest)) @@ -147,7 +144,7 @@ protected override async Task GetPackageScreenshots_Unsafe(IPackage packa Match IconArray = Regex.Match(ResponseContent, "(?:\"|')Images(?:\"|'): ?\\[([^\\]]+)\\]"); if (!IconArray.Success) { - Logger.Warn($"Could not parse Images array from Microsoft Store response"); + Logger.Warn("Could not parse Images array from Microsoft Store response"); return null; } @@ -192,10 +189,9 @@ protected override async Task GetPackageScreenshots_Unsafe(IPackage packa return new CacheableIcon(new Uri(uri)); } - - private static async Task GetWinGetPackageIcon(IPackage package) - { // TODO: Need to work on retrieving WinGet icons - + // TODO: Need to work on retrieving WinGet icons + /*private static async Task GetWinGetPackageIcon(IPackage package) + { if (WinGetHelper.Instance is not NativeWinGetHelper) { Logger.Warn("WinGet will not attempt to load icon since the helper is using bundled WinGet"); @@ -254,7 +250,6 @@ protected override async Task GetPackageScreenshots_Unsafe(IPackage packa } return Icon; - } - + }*/ } } diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetSourceProvider.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetSourceProvider.cs index 97ca10010..f9bacabd1 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetSourceProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetSourceProvider.cs @@ -1,5 +1,3 @@ -using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/UniGetUI.PackageEngine.PackageEngine/PEInterface.cs b/src/UniGetUI.PackageEngine.PackageEngine/PEInterface.cs index e9d9376e6..1b3757fde 100644 --- a/src/UniGetUI.PackageEngine.PackageEngine/PEInterface.cs +++ b/src/UniGetUI.PackageEngine.PackageEngine/PEInterface.cs @@ -1,7 +1,5 @@ -using System.Diagnostics; using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.ChocolateyManager; using UniGetUI.PackageEngine.Managers.DotNetManager; using UniGetUI.PackageEngine.Managers.NpmManager; @@ -10,7 +8,6 @@ using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.Managers.ScoopManager; using UniGetUI.PackageEngine.Managers.WingetManager; -using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.PackageEngine.PackageLoader; namespace UniGetUI.PackageEngine diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index 014e4e3a8..d49b9c354 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -1,8 +1,5 @@ -using System.Collections.ObjectModel; using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.PackageLoader { @@ -39,10 +36,10 @@ public abstract class AbstractPackageLoader ///
public event EventHandler? StartedLoading; - readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS = false; - readonly bool DISABLE_RELOAD = false; + readonly bool ALLOW_MULTIPLE_PACKAGE_VERSIONS; + readonly bool DISABLE_RELOAD; protected string LOADER_IDENTIFIER; - private int LoadOperationIdentifier = 0; + private int LoadOperationIdentifier; protected IEnumerable Managers { get; private set; } public AbstractPackageLoader(IEnumerable managers, string identifier, bool AllowMultiplePackageVersions = false, bool DisableReload = false) @@ -81,7 +78,6 @@ protected void InvokeFinishedLoadingEvent() /// /// Will trigger a forceful reload of the packages /// - /// public virtual async Task ReloadPackages() { if(DISABLE_RELOAD) @@ -169,30 +165,28 @@ public void ClearPackages(bool emitFinishSignal = true) /// Checks whether the package is valid or must be skipped /// /// The package to check - /// True if the package can be added, false otherwhise + /// True if the package can be added, false otherwise protected abstract Task IsPackageValid(IPackage package); /// /// A method to post-process packages after they have been added. /// /// The package to process - /// protected abstract Task WhenAddingPackage(IPackage package); /// - /// Checks wether a package is contained on the current Loader + /// Checks whether a package is contained on the current Loader /// /// The package to check against - /// public bool Contains(IPackage package) { return PackageReference.ContainsKey(HashPackage(package)); } /// - /// Returns the appropiate hash of the package, according to the current loader configuration + /// Returns the appropriate hash of the package, according to the current loader configuration /// - /// The pakage to hash + /// The package to hash /// A long int containing the hash protected long HashPackage(IPackage package) { @@ -234,7 +228,6 @@ public void AddForeign(IPackage? package) /// /// Removes the given package from the list. /// - /// public void Remove(IPackage? package) { if (package == null) @@ -255,7 +248,6 @@ public void Remove(IPackage? package) /// Gets the corresponding package on the current loader. /// This method follows the equivalence settings for this loader /// - /// /// A Package? object public IPackage? GetEquivalentPackage(IPackage? package) { diff --git a/src/UniGetUI.PackageEngine.PackageLoader/DiscoverablePackagesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/DiscoverablePackagesLoader.cs index cfc8f53cc..780cff0fa 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/DiscoverablePackagesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/DiscoverablePackagesLoader.cs @@ -1,8 +1,6 @@ using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.PackageLoader { diff --git a/src/UniGetUI.PackageEngine.PackageLoader/InstalledPackagesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/InstalledPackagesLoader.cs index e9435a192..157718edd 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/InstalledPackagesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/InstalledPackagesLoader.cs @@ -1,7 +1,5 @@ using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.PackageLoader { diff --git a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs index 6dbe74166..a493bbffe 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs @@ -1,9 +1,6 @@ using UniGetUI.Core.Logging; using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Serializable; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.PackageLoader diff --git a/src/UniGetUI.PackageEngine.PackageLoader/UpgradablePackagesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/UpgradablePackagesLoader.cs index df337221e..260598202 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/UpgradablePackagesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/UpgradablePackagesLoader.cs @@ -2,8 +2,6 @@ using UniGetUI.Core.SettingsEngine; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.PackageLoader { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BasePackageDetailsProvider.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BasePackageDetailsProvider.cs index 53a5b215b..31480aff3 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BasePackageDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BasePackageDetailsProvider.cs @@ -2,7 +2,6 @@ using UniGetUI.Core.Logging; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Interfaces.ManagerProviders; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Classes.Manager.BaseProviders { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BaseSourceProvider.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BaseSourceProvider.cs index a5fcc08fd..d891ceff4 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BaseSourceProvider.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/BaseProviders/BaseSourceProvider.cs @@ -1,7 +1,6 @@ using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Interfaces.ManagerProviders; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Classes.Manager.Providers { @@ -24,7 +23,6 @@ public BaseSourceProvider(ManagerT manager) /// /// Loads the sources for the manager. This method SHOULD NOT handle exceptions /// - /// protected abstract Task GetSources_UnSafe(); public virtual async Task GetSources() { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerDependency.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerDependency.cs index 1c8c5b8ca..6072783b1 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerDependency.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerDependency.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.PackageEngine.Classes.Manager.Classes +namespace UniGetUI.PackageEngine.Classes.Manager.Classes { public readonly struct ManagerDependency { @@ -20,7 +20,6 @@ public ManagerDependency( InstallArguments = installArguments; IsInstalled = isInstalled; FancyInstallCommand = fancyInstallCommand; - } } } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerLogger.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerLogger.cs index 1ea5fbfa7..4f7177b38 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerLogger.cs @@ -1,9 +1,6 @@ using System.Diagnostics; -using System.Net; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.ManagerClasses.Classes { @@ -77,7 +74,7 @@ public void Close(int returnCode) } /// - /// Returns the output with a preceeding digit representing the color of the line: + /// Returns the output with a preceding digit representing the color of the line: /// 0. White /// 1. Grey /// 2. Red @@ -85,7 +82,6 @@ public void Close(int returnCode) /// 4. Green /// 5. Yellow /// - /// public abstract IEnumerable AsColoredString(bool verbose = false); } @@ -100,7 +96,7 @@ public class ProcessTaskLogger : TaskLogger, IProcessTaskLogger private readonly List StdOut = []; private readonly List StdErr = []; - public ProcessTaskLogger(IPackageManager manager, LoggableTaskType type, string executable, string arguments) : base() + public ProcessTaskLogger(IPackageManager manager, LoggableTaskType type, string executable, string arguments) { Type = type; Manager = manager; @@ -198,7 +194,7 @@ public override IEnumerable AsColoredString(bool verbose = false) $"0Subprocess executable: \"{Executable}\"", $"0Command-line arguments: \"{Arguments}\"", $"0Process start time: {StartTime}", - EndTime == null ? $"2Process end time: UNFINISHED" : $"0Process end time: {EndTime}", + EndTime == null ? "2Process end time: UNFINISHED" : $"0Process end time: {EndTime}", ]; if (StdIn.Count > 0) @@ -281,7 +277,7 @@ public class NativeTaskLogger : TaskLogger, INativeTaskLogger private readonly List Info = []; private readonly List Errors = []; - public NativeTaskLogger(IPackageManager manager, LoggableTaskType type) : base() + public NativeTaskLogger(IPackageManager manager, LoggableTaskType type) { Type = type; Manager = manager; @@ -359,7 +355,7 @@ public override IEnumerable AsColoredString(bool verbose = false) [ $"0Logged native task on manager {Manager.Name}. Task type is {Type}", $"0Process start time: {StartTime}", - EndTime == null ? $"2Process end time: UNFINISHED" : $"0Process end time: {EndTime}", + EndTime == null ? "2Process end time: UNFINISHED" : $"0Process end time: {EndTime}", ]; if (Info.Count > 0) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerSource.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerSource.cs index a9a07928e..8ef2794bb 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerSource.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/ManagerSource.cs @@ -1,7 +1,5 @@ -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Classes.Manager { @@ -51,7 +49,6 @@ public override string ToString() /// /// Replaces the current URL with the new one. Must be used only when a placeholder URL is used. /// - /// public void ReplaceUrl(Uri newUrl) { Url = newUrl; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/NullPackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/NullPackageManager.cs index 3223f0059..d94f3d80c 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/NullPackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/NullPackageManager.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UniGetUI.Core.Classes; using UniGetUI.Core.IconEngine; -using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; @@ -45,7 +38,7 @@ public NullPackageManager() SourceProvider = new NullSourceProvider(this); PackageDetailsProvider = new NullPackageDetailsProvider(this); SourceFactory = new SourceFactory(this); - Properties = new ManagerProperties() + Properties = new ManagerProperties { IsDummy = true, Name = CoreTools.Translate("Unknown"), @@ -63,7 +56,7 @@ public NullPackageManager() Capabilities = new ManagerCapabilities(); - Status = new ManagerStatus() + Status = new ManagerStatus { ExecutablePath = "C:/file.exe", Found = false, diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index bfe81deae..977d1d6df 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -15,8 +15,6 @@ using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.Core.Tools; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { @@ -31,7 +29,7 @@ public abstract class PackageManager : SingletonBase, ISourcePro public static string[] FALSE_PACKAGE_NAMES = [""]; public static string[] FALSE_PACKAGE_IDS = [""]; public static string[] FALSE_PACKAGE_VERSIONS = [""]; - public bool ManagerReady { get; set; } = false; + public bool ManagerReady { get; set; } public IManagerLogger TaskLogger { get; } public ISourceProvider SourceProvider { get; set; } @@ -39,7 +37,7 @@ public abstract class PackageManager : SingletonBase, ISourcePro public IEnumerable Dependencies { get; protected set; } = []; public IPackageDetailsProvider? PackageDetailsProvider { get; set; } - private readonly bool __base_constructor_called = false; + private readonly bool __base_constructor_called; public PackageManager() { @@ -51,11 +49,9 @@ public PackageManager() PackageDetailsProvider = new NullPackageDetailsProvider(this); } - /// /// Initializes the Package Manager (asynchronously). Must be run before using any other method of the manager. /// - /// public virtual async Task InitializeAsync() { // BEGIN integrity check @@ -134,17 +130,14 @@ public virtual async Task InitializeAsync() } } - /// /// Returns a ManagerStatus object representing the current status of the package manager. This method runs asynchronously. /// - /// protected abstract Task LoadManager(); /// /// Returns true if the manager is enabled, false otherwise /// - /// public bool IsEnabled() { return !Settings.Get("Disable" + Name); @@ -153,7 +146,6 @@ public bool IsEnabled() /// /// Returns true if the manager is enabled and available (the required executable files were found). Returns false otherwise /// - /// public bool IsReady() { return IsEnabled() && Status.Found; @@ -163,11 +155,9 @@ public bool IsReady() /// Returns an array of Package objects that the manager lists for the given query. Depending on the manager, the list may /// also include similar results. This method is fail-safe and will return an empty array if an error occurs. /// - /// - /// public async Task FindPackages(string query) { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet FindPackages was called"); return []; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet FindPackages was called"); return []; } try { Package[] packages = await FindPackages_UnSafe(query).WaitAsync(TimeSpan.FromSeconds(60)); @@ -190,11 +180,9 @@ public async Task FindPackages(string query) /// Returns an array of UpgradablePackage objects that represent the available updates reported by the manager. /// This method is fail-safe and will return an empty array if an error occurs. /// - /// - /// public async Task GetAvailableUpdates() { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetAvailableUpdates was called"); return []; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetAvailableUpdates was called"); return []; } try { await RefreshPackageIndexes().WaitAsync(TimeSpan.FromSeconds(60)); @@ -219,10 +207,9 @@ public async Task GetAvailableUpdates() /// Returns an array of Package objects that represent the installed reported by the manager. /// This method is fail-safe and will return an empty array if an error occurs. /// - /// public async Task GetInstalledPackages() { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetInstalledPackages was called"); return []; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetInstalledPackages was called"); return []; } try { Package[] packages = await GetInstalledPackages_UnSafe().WaitAsync(TimeSpan.FromSeconds(60)); @@ -242,7 +229,6 @@ public async Task GetInstalledPackages() } } - /// /// Returns the available packages to install for the given query. /// Each manager MUST implement this method. @@ -265,7 +251,6 @@ public async Task GetInstalledPackages() /// An array of Package objects protected abstract Task GetInstalledPackages_UnSafe(); - /// /// Returns the command-line parameters to install the given package. /// Each manager MUST implement this method. @@ -275,7 +260,6 @@ public async Task GetInstalledPackages() /// An array of strings containing the parameters without the manager executable file public abstract string[] GetInstallParameters(IPackage package, IInstallationOptions options); - /// /// Returns the command-line parameters to update the given package. /// Each manager MUST implement this method. @@ -305,7 +289,6 @@ public async Task GetInstalledPackages() /// An OperationVeredict value representing the result of the installation public abstract OperationVeredict GetInstallOperationVeredict(IPackage package, IInstallationOptions options, int ReturnCode, string[] Output); - /// /// Decides and returns the verdict of the update operation. /// Each manager MUST implement this method. @@ -332,7 +315,6 @@ public async Task GetInstalledPackages() /// Refreshes the Package Manager sources/indexes /// Each manager MUST implement this method. /// - /// #pragma warning disable CS1998 public virtual async Task RefreshPackageIndexes() { @@ -345,8 +327,7 @@ public virtual async Task RefreshPackageIndexes() /// /// Will check if the Manager supports custom sources, and throw an exception if not /// - /// - /// + /// private void AssertSourceCompatibility(string MethodName) { if (!Capabilities.SupportsCustomSources) @@ -393,7 +374,7 @@ public OperationVeredict GetRemoveSourceOperationVeredict(IManagerSource source, public virtual async Task GetSources() { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetSources was called"); return []; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetSources was called"); return []; } try { AssertSourceCompatibility("GetSources"); @@ -403,7 +384,7 @@ public virtual async Task GetSources() } catch (Exception e) { - Logger.Error($"Error finding sources for manager " + Name); + Logger.Error("Error finding sources for manager " + Name); Logger.Error(e); return []; } @@ -411,19 +392,12 @@ public virtual async Task GetSources() #pragma warning restore CS8602 // END SOURCE-RELATED METHODS - - - - - - - // BEGIN PACKAGEDEAILS-RELATED METHODS - private void AssertPackageDetailsCompatibility(string MethodName) + private void AssertPackageDetailsCompatibility(string methodName) { if (PackageDetailsProvider == null) { - throw new InvalidOperationException($"Manager {Name} does not have a valid PackageDetailsProvider helper, when attemtping to call {MethodName}"); + throw new InvalidOperationException($"Manager {Name} does not have a valid PackageDetailsProvider helper, when attemtping to call {methodName}"); } } #pragma warning disable CS8602 @@ -436,7 +410,7 @@ private void AssertPackageDetailsCompatibility(string MethodName) public async Task GetPackageDetails(IPackageDetails details) { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetPackageDetails was called"); return; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetPackageDetails was called"); return; } try { AssertPackageDetailsCompatibility("GetPackageDetails"); @@ -452,7 +426,7 @@ public async Task GetPackageDetails(IPackageDetails details) public async Task GetPackageVersions(IPackage package) { - if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetPackageVersions was called"); return []; }; + if (!IsReady()) { Logger.Warn($"Manager {Name} is disabled but yet GetPackageVersions was called"); return []; } try { AssertPackageDetailsCompatibility("GetPackageVersions"); @@ -503,8 +477,6 @@ public async Task GetPackageScreenshotsUrl(IPackage package) #pragma warning restore CS8602 // END PACKAGEDETAILS-RELATED METHODS - - public void LogOperation(Process process, string output) { output = Regex.Replace(output, "\n.{0,6}\n", "\n"); diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/SourceFactory.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/SourceFactory.cs index 238376eac..3b6482549 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/SourceFactory.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/SourceFactory.cs @@ -1,10 +1,8 @@ using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; -using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Classes.Manager { - public class SourceFactory: ISourceFactory + public class SourceFactory : ISourceFactory { private readonly IPackageManager __manager; private readonly Dictionary __reference; @@ -28,8 +26,7 @@ public void Reset() /// A valid ManagerSource public IManagerSource GetSourceOrDefault(string name) { - IManagerSource? source; - if (__reference.TryGetValue(name, out source) && source != null) + if (__reference.TryGetValue(name, out IManagerSource? source) && source != null) { return source; } @@ -42,15 +39,13 @@ public IManagerSource GetSourceOrDefault(string name) /// /// Returns the existing source for the given name, or null if it does not exist. /// - /// - /// public IManagerSource? GetSourceIfExists(string name) { - IManagerSource? source; - if (__reference.TryGetValue(name, out source)) + if (__reference.TryGetValue(name, out IManagerSource? source)) { return source; } + return null; } diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs index e88e5d02d..1bf962305 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ImportedPackage.cs @@ -1,17 +1,5 @@ -using System.ComponentModel; -using System.Runtime.CompilerServices; -using System.Text.Json.Nodes; -using UniGetUI.Core.Data; -using UniGetUI.Core.IconEngine; -using UniGetUI.Core.Logging; -using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Packages; using UniGetUI.PackageEngine.Classes.Serializable; -using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Serializable; namespace UniGetUI.PackageEngine.PackageClasses @@ -19,12 +7,8 @@ namespace UniGetUI.PackageEngine.PackageClasses public class ImportedPackage : Package { /// - /// Constuct an invalid package with a given name, id, version, source and manager, and an optional scope. + /// Construct an invalid package with a given name, id, version, source and manager, and an optional scope. /// - /// - /// - /// - /// public SerializableUpdatesOptions_v1 updates_options; public SerializableInstallationOptions_v1 installation_options; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InstallationOptions.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InstallationOptions.cs index fd14e7835..dcb2bc55d 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InstallationOptions.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InstallationOptions.cs @@ -13,7 +13,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// /// This class represents the options in which a package must be installed, updated or uninstalled. /// - public class InstallationOptions: IInstallationOptions + public class InstallationOptions : IInstallationOptions { private static readonly Dictionary OptionsCache = []; @@ -43,7 +43,7 @@ private InstallationOptions(IPackage package) /// /// The package from which to load the InstallationOptions /// The package's InstallationOptions instance - public static InstallationOptions FromPackage(IPackage package, bool? elevated = null, bool? + public static InstallationOptions FromPackage(IPackage package, bool? elevated = null, bool? interactive = null, bool? no_integrity = null, bool? remove_data = null) { InstallationOptions instance; @@ -87,7 +87,7 @@ public static InstallationOptions FromPackage(IPackage package, bool? elevated = /// /// The package from which to load the InstallationOptions /// The package's InstallationOptions instance - public static async Task FromPackageAsync(IPackage package, bool? elevated = null, + public static async Task FromPackageAsync(IPackage package, bool? elevated = null, bool? interactive = null, bool? no_integrity = null, bool? remove_data = null) { return await Task.Run(() => FromPackage(package, elevated, interactive, no_integrity, remove_data)); @@ -96,9 +96,6 @@ public static async Task FromPackageAsync(IPackage package, /// /// Returns a new InstallationOptions object from a given SerializableInstallationOptions_v1 and a package. /// - /// - /// - /// public static InstallationOptions FromSerialized(SerializableInstallationOptions_v1 options, IPackage package) { InstallationOptions instance = new(package); @@ -109,7 +106,6 @@ public static InstallationOptions FromSerialized(SerializableInstallationOptions /// /// Loads and applies the options from the given SerializableInstallationOptions_v1 object to the current object. /// - /// public void FromSerializable(SerializableInstallationOptions_v1 options) { SkipHashCheck = options.SkipHashCheck; @@ -135,7 +131,6 @@ public void FromSerializable(SerializableInstallationOptions_v1 options) /// /// Returns a SerializableInstallationOptions_v1 object containing the options of the current instance. /// - /// public SerializableInstallationOptions_v1 AsSerializable() { SerializableInstallationOptions_v1 options = new() @@ -172,7 +167,7 @@ private FileInfo GetPackageOptionsFile() /// public async Task SaveToDiskAsync() { - await Task.Run(() => SaveToDisk()); + await Task.Run(SaveToDisk); } /// @@ -237,7 +232,6 @@ public void LoadFromDisk() /// /// Returns a string representation of the current options. /// - /// public override string ToString() { string customparams = CustomParameters != null ? string.Join(",", CustomParameters) : "[]"; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs index d8be394e3..26fb524b4 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/InvalidImportedPackage.cs @@ -1,20 +1,11 @@ using System.ComponentModel; -using System.ComponentModel.DataAnnotations; using System.Runtime.CompilerServices; -using System.Text.Json.Nodes; -using UniGetUI.Core.Classes; -using UniGetUI.Core.Data; -using UniGetUI.Core.IconEngine; -using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; -using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; -using UniGetUI.PackageEngine.Classes.Packages; using UniGetUI.PackageEngine.Classes.Serializable; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.PackageClasses { @@ -24,7 +15,7 @@ public class InvalidImportedPackage : IPackage, INotifyPropertyChanged public PackageTag Tag { get => PackageTag.Unavailable; set { } } - private bool __is_checked = false; + private bool __is_checked; public bool IsChecked { get { return __is_checked; } @@ -88,8 +79,8 @@ public Task AsSerializable() public SerializableIncompatiblePackage_v1 AsSerializable_Incompatible() { - return new SerializableIncompatiblePackage_v1() - { + return new SerializableIncompatiblePackage_v1 + { Name = Name, Id = Id, Version = Version, @@ -180,7 +171,7 @@ public void SetTag(PackageTag tag) #pragma warning restore CS1998 } - public class NullSource: IManagerSource + public class NullSource : IManagerSource { public static NullSource Instance = new(CoreTools.Translate("Unknown")); public IconType IconId { get; } @@ -206,7 +197,6 @@ public NullSource(string name) /// /// Returns a human-readable string representing the source name /// - /// public override string ToString() { return Name; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs index 96fc5712a..6214f66bf 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs @@ -1,7 +1,4 @@ -using System.ComponentModel; using UniGetUI.Core.Classes; -using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; namespace UniGetUI.PackageEngine.PackageClasses @@ -22,16 +19,13 @@ public enum Sorter } public ObservablePackageCollection() - : base() { SortingSelector = x => x.Package.Name; } - /// /// Add a package to the collection /// - /// public void Add(IPackage p) { base.Add(new PackageWrapper(p)); @@ -85,9 +79,8 @@ public void SetSorter(Sorter field) } /// - /// Returns a list containing the packwges in this collection + /// Returns a list containing the packages in this collection /// - /// public List GetPackages() { List packages = new(); @@ -102,7 +95,6 @@ public List GetPackages() /// /// Returns a list containing the checked packages on this collection /// - /// public List GetCheckedPackages() { List packages = []; diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs index 3dd9530c2..c5d9c5061 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs @@ -1,16 +1,11 @@ -using System; using System.ComponentModel; -using System.ComponentModel.Design; using System.Runtime.CompilerServices; using System.Text.Json.Nodes; -using System.Xml.Linq; -using UniGetUI.Core.Classes; using UniGetUI.Core.Data; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Packages; using UniGetUI.PackageEngine.Classes.Serializable; using UniGetUI.PackageEngine.Enums; @@ -60,7 +55,7 @@ public bool IsChecked public IManagerSource Source { get; } /// - /// IPackageManager is guaranteed to be IPackageManager, but C# doesn't allow covariant attributes + /// IPackageManager is guaranteed to be IPackageManager, but C# doesn't allow covariant attributes /// public IPackageManager Manager { get; } public string NewVersion { get; } @@ -69,14 +64,8 @@ public bool IsChecked public string SourceAsString { get => Source.AsString; } /// - /// Constuct a package with a given name, id, version, source and manager, and an optional scope. + /// Construct a package with a given name, id, version, source and manager, and an optional scope. /// - /// - /// - /// - /// - /// - /// public Package(string name, string id, string version, IManagerSource source, IPackageManager manager, PackageScope scope = PackageScope.Local) { Name = name; @@ -97,13 +86,6 @@ public Package(string name, string id, string version, IManagerSource source, IP /// /// Creates an UpgradablePackage object representing a package that can be upgraded; given its name, id, installed version, new version, source and manager, and an optional scope. /// - /// - /// - /// - /// - /// - /// - /// public Package(string name, string id, string installed_version, string new_version, IManagerSource source, IPackageManager manager, PackageScope scope = PackageScope.Local) : this(name, id, installed_version, source, manager, scope) { @@ -136,14 +118,14 @@ public override int GetHashCode() } /// - /// Check wether two package instances represent the same package. + /// Check whether two package instances represent the same package. /// What is taken into account: /// - Manager and Source /// - Package Identifier - /// For more specific comparsion use package.Equals(object? other) + /// For more specific comparison use package.Equals(object? other) /// /// A package - /// Wether the two instances refer to the same instance + /// Whether the two instances refer to the same instance public bool IsEquivalentTo(IPackage? other) { return __hash == other?.GetHash(); @@ -262,8 +244,6 @@ public virtual async Task RemoveFromIgnoredUpdatesAsync() /// all updates are ignored, calling this method with a specific version will /// still return true, although the passed version is not explicitly ignored. /// - /// - /// public async Task HasUpdatesIgnoredAsync(string Version = "*") { try @@ -296,7 +276,6 @@ public async Task HasUpdatesIgnoredAsync(string Version = "*") /// are ignored, an empty string will be returned; and when all versions are ignored an asterisk /// will be returned. /// - /// public async Task GetIgnoredUpdatesVersionAsync() { try @@ -360,7 +339,7 @@ public virtual bool NewerVersionIsInstalled() public async Task AsSerializable() { - return new SerializablePackage_v1() + return new SerializablePackage_v1 { Id = Id, Name = Name, @@ -368,7 +347,7 @@ public async Task AsSerializable() Source = Source.Name, ManagerName = Manager.Name, InstallationOptions = (await InstallationOptions.FromPackageAsync(this)).AsSerializable(), - Updates = new SerializableUpdatesOptions_v1() + Updates = new SerializableUpdatesOptions_v1 { IgnoredVersion = await GetIgnoredUpdatesVersionAsync(), UpdatesIgnored = await HasUpdatesIgnoredAsync(), @@ -378,7 +357,7 @@ public async Task AsSerializable() public SerializableIncompatiblePackage_v1 AsSerializable_Incompatible() { - return new SerializableIncompatiblePackage_v1() + return new SerializableIncompatiblePackage_v1 { Id = Id, Name = Name, diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageCacher.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageCacher.cs index 52dd77708..43e3fc82a 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageCacher.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageCacher.cs @@ -1,4 +1,3 @@ -using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.PackageClasses; namespace UniGetUI.PackageEngine.Classes.Packages @@ -14,7 +13,7 @@ internal static class PackageCacher /// This checks only the "Discover Packages" cache /// /// The package to check - /// The already existing package if any, otherwhise p + /// The already existing package if any, otherwise p public static Package GetAvailablePackage(Package p) { Package? new_package = GetAvailablePackageOrNull(p); @@ -31,7 +30,7 @@ public static Package GetAvailablePackage(Package p) /// This checks only the "Software Updates" cache /// /// The package to check - /// The already existing package if any, otherwhise p + /// The already existing package if any, otherwise p public static Package GetUpgradablePackage(Package p) { Package? new_package = GetUpgradablePackageOrNull(p); @@ -48,7 +47,7 @@ public static Package GetUpgradablePackage(Package p) /// This checks only the "Installed Packages" cache /// /// The package to check - /// The already existing package if any, otherwhise p + /// The already existing package if any, otherwise p public static Package GetInstalledPackage(Package p) { Package? new_package = GetInstalledPackageOrNull(p); @@ -65,14 +64,10 @@ public static Package GetInstalledPackage(Package p) /// This checks only the "Discover Packages" cache /// /// The package to check - /// The already existing package if any, otherwhise null + /// The already existing package if any, otherwise null public static Package? GetAvailablePackageOrNull(Package other) { - if(__available_pkgs.TryGetValue(other.GetHash(), out Package? equivalent_package)) - { - return equivalent_package; - } - return null; + return __available_pkgs.GetValueOrDefault(other.GetHash()); } /// @@ -80,14 +75,10 @@ public static Package GetInstalledPackage(Package p) /// This checks only the "Software Updates" cache /// /// The package to check - /// The already existing package if any, otherwhise null + /// The already existing package if any, otherwise null public static Package? GetUpgradablePackageOrNull(Package other) { - if (__upgradable_pkgs.TryGetValue(other.GetHash(), out Package? equivalent_package)) - { - return equivalent_package; - } - return null; + return __upgradable_pkgs.GetValueOrDefault(other.GetHash()); } /// @@ -95,21 +86,17 @@ public static Package GetInstalledPackage(Package p) /// This checks only the "Installed Packages" cache /// /// The package to check - /// The already existing package if any, otherwhise null + /// The already existing package if any, otherwise null public static Package? GetInstalledPackageOrNull(Package other) { - if (__installed_pkgs.TryGetValue(other.GetVersionedHash(), out Package? equivalent_package)) - { - return equivalent_package; - } - return null; + return __installed_pkgs.GetValueOrDefault(other.GetVersionedHash()); } /// - /// Checks wether a Package with a newer version has been found in the Installed Packages cache + /// Checks whether a Package with a newer version has been found in the Installed Packages cache /// - /// The package to check agains - /// True if a newer version was found, false otherwhise + /// The package to check again + /// True if a newer version was found, false otherwise public static bool NewerVersionIsInstalled(Package other) { foreach (Package found in __installed_pkgs.Values) diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageDetails.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageDetails.cs index 0df6da1d5..a13ec8831 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageDetails.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/PackageDetails.cs @@ -6,7 +6,7 @@ namespace UniGetUI.PackageEngine.PackageClasses /// /// Holds the details of a Package. /// - public class PackageDetails: IPackageDetails + public class PackageDetails : IPackageDetails { /// /// The package to which this details instance corresponds @@ -14,7 +14,7 @@ public class PackageDetails: IPackageDetails public IPackage Package { get; } /// - /// Wether this PackageDetails instance has valid data or not. + /// Whether this PackageDetails instance has valid data or not. /// To load valid data, make use of the `Load()` method /// public bool IsPopulated { get; private set; } @@ -113,5 +113,4 @@ public async Task Load() } } } - } diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs index 01889c7c5..ec5210ab2 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UniGetUI.PackageEngine.Classes.Serializable +namespace UniGetUI.PackageEngine.Classes.Serializable { public class SerializableBundle_v1 { diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs index 11505ea00..1796e3178 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UniGetUI.PackageEngine.Classes.Serializable +namespace UniGetUI.PackageEngine.Classes.Serializable { public class SerializableIncompatiblePackage_v1 { diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializablePackage_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializablePackage_v1.cs index 04a8c17ab..5e7b93c91 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializablePackage_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializablePackage_v1.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UniGetUI.PackageEngine.Serializable; namespace UniGetUI.PackageEngine.Classes.Serializable @@ -48,10 +43,9 @@ public class SerializablePackage_v1 /// Returns an equivalent copy of the current package as an Invalid Serializable Package. /// The reverse operation is not possible, since data is lost. /// - /// public SerializableIncompatiblePackage_v1 GetInvalidEquivalent() { - return new SerializableIncompatiblePackage_v1() + return new SerializableIncompatiblePackage_v1 { Id = Id, Name = Name, diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializableUpdatesOptions_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializableUpdatesOptions_v1.cs index 9e4f41580..574c4045e 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableUpdatesOptions_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableUpdatesOptions_v1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UniGetUI.PackageEngine.Classes.Serializable +namespace UniGetUI.PackageEngine.Classes.Serializable { public class SerializableUpdatesOptions_v1 { diff --git a/src/UniGetUI/App.xaml.cs b/src/UniGetUI/App.xaml.cs index 1f538df2a..57f492961 100644 --- a/src/UniGetUI/App.xaml.cs +++ b/src/UniGetUI/App.xaml.cs @@ -40,13 +40,12 @@ public class __tooltip_options public MainWindow MainWindow; public ThemeListener ThemeListener; - private readonly BackgroundApiRunner BackgroundApi = new(); #pragma warning disable CS8618 public static MainApp Instance; public __tooltip_options TooltipStatus = new(); - public MainApp() : base() + public MainApp() { #pragma warning restore CS8618 try @@ -181,7 +180,6 @@ private void InitializeMainWindow() } } - /// /// Clear the notification history, if possible /// @@ -230,7 +228,6 @@ public void AddOperationToList(AbstractOperation operation) /// /// Background component loader /// - /// private async Task LoadComponentsAsync() { try @@ -395,7 +392,6 @@ private async void UpdateUniGetUIIfPossible(int round = 0) fileContents = await client.GetStringAsync("https://www.marticliment.com/versions/unigetui.ver"); } - if (!fileContents.Contains("///")) { throw new FormatException("The updates file does not follow the FloatVersion///Sha256Hash format"); diff --git a/src/UniGetUI/EntryPoint.cs b/src/UniGetUI/EntryPoint.cs index e145c1302..44a01d2bc 100644 --- a/src/UniGetUI/EntryPoint.cs +++ b/src/UniGetUI/EntryPoint.cs @@ -29,7 +29,7 @@ private static void Main(string[] args) else { // Otherwise, run UniGetUI as normal - _ = AsyncMain(args); + _ = AsyncMain(); } } catch (Exception e) @@ -41,9 +41,7 @@ private static void Main(string[] args) /// /// UniGetUI app main entry point /// - /// Call arguments - /// - private static async Task AsyncMain(string[] args) + private static async Task AsyncMain() { try { @@ -86,12 +84,11 @@ Welcome to UniGetUI Version {CoreData.VersionName} /// /// Default WinUI Redirector /// - /// private static async Task DecideRedirection() { try { - // Idk how does this work, I copied it from the MS Docs + // IDK how does this work, I copied it from the MS Docs // example on single-instance apps using unpackaged AppSdk + WinUI3 bool isRedirect = false; AppActivationArguments args = AppInstance.GetCurrent().GetActivatedEventArgs(); diff --git a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs index c8c993146..132392e5a 100644 --- a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs @@ -5,7 +5,6 @@ using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.PackageEngine.Serializable; // To learn more about WinUI, the WinUI project structure, @@ -43,7 +42,6 @@ public InstallOptionsPage(IPackage package, OperationType Operation, Serializabl ArchitectureComboBox.Items.Add(CoreTools.Translate("Default")); ArchitectureComboBox.SelectedIndex = 0; - if (Package.Manager.Capabilities.SupportsCustomArchitectures) { foreach (Architecture arch in Package.Manager.Capabilities.SupportedCustomArchitectures) @@ -106,7 +104,6 @@ public InstallOptionsPage(IPackage package, OperationType Operation, Serializabl } } - ResetDir.IsEnabled = Package.Manager.Capabilities.SupportsCustomLocations; SelectDir.IsEnabled = Package.Manager.Capabilities.SupportsCustomLocations; CustomInstallLocation.Text = Options.CustomInstallLocation; diff --git a/src/UniGetUI/Interface/Dialogs/ReleaseNotes.xaml.cs b/src/UniGetUI/Interface/Dialogs/ReleaseNotes.xaml.cs index 816ea9c06..b130f8688 100644 --- a/src/UniGetUI/Interface/Dialogs/ReleaseNotes.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/ReleaseNotes.xaml.cs @@ -31,7 +31,5 @@ public void Dispose() { WebView.Close(); } - - } } diff --git a/src/UniGetUI/Interface/MainView.xaml.cs b/src/UniGetUI/Interface/MainView.xaml.cs index f02607968..92c9f8269 100644 --- a/src/UniGetUI/Interface/MainView.xaml.cs +++ b/src/UniGetUI/Interface/MainView.xaml.cs @@ -76,7 +76,6 @@ public MainView() WarnAboutAdminRights(); } - Dictionary NextPageReference = new() { { DiscoverPage, UpdatesNavButton }, @@ -271,8 +270,8 @@ public async Task ShowOperationFailedDialog( VerticalAlignment = VerticalAlignment.Stretch, }; - grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); + grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); + grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); TextBlock headerContent = new() { @@ -302,7 +301,6 @@ public async Task ShowOperationFailedDialog( VerticalAlignment = VerticalAlignment.Center }); - RichTextBlock CommandLineOutput = new() { FontFamily = new FontFamily("Consolas"), @@ -321,8 +319,8 @@ public async Task ShowOperationFailedDialog( Grid OutputGrid = new(); OutputGrid.Children.Add(ScrollView); - OutputGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); - OutputGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); + OutputGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); + OutputGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); Grid.SetColumn(ScrollView, 0); Grid.SetRow(ScrollView, 0); @@ -378,10 +376,8 @@ public async void WarnAboutAdminRights() } /// - /// Will update the Installation Options for the given Package, and will return wether the user choose to continue + /// Will update the Installation Options for the given Package, and will return whether the user choose to continue /// - /// - /// public async Task ShowInstallationSettingsAndContinue(IPackage package, OperationType operation) { var options = (await InstallationOptions.FromPackageAsync(package)).AsSerializable(); @@ -397,8 +393,6 @@ public async Task ShowInstallationSettingsAndContinue(IPackage package, Op /// /// Will update the Installation Options for the given imported package /// - /// - /// public async Task<(SerializableInstallationOptions_v1, ContentDialogResult)> ShowInstallOptionsDialog_ImportedPackage(ImportedPackage importedPackage) { var result = await ShowInstallOptionsDialog(importedPackage, OperationType.None, importedPackage.installation_options); diff --git a/src/UniGetUI/Interface/MainWindow.xaml.cs b/src/UniGetUI/Interface/MainWindow.xaml.cs index 68675c58f..74c93d5e5 100644 --- a/src/UniGetUI/Interface/MainWindow.xaml.cs +++ b/src/UniGetUI/Interface/MainWindow.xaml.cs @@ -17,7 +17,6 @@ using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Classes.Manager.Classes; -using UniGetUI.PackageEngine.PackageClasses; using Windows.ApplicationModel.DataTransfer; using Windows.Foundation.Collections; using Microsoft.UI.Xaml.Media; @@ -125,12 +124,9 @@ public void HandleNotificationActivation(ToastArguments args, ValueSet input) Logger.Debug("Notification activated: " + args.ToString() + " " + input.ToString()); } - /// /// Handle the window closing event, and divert it when the window must be hidden. /// - /// - /// public async void HandleClosingEvent(AppWindow sender, AppWindowClosingEventArgs args) { SaveGeometry(Force: true); @@ -255,7 +251,6 @@ private void LoadTrayMenu() TrayMenu.Items.Add(new MenuFlyoutItem { Command = ShowUniGetUI }); TrayMenu.Items.Add(new MenuFlyoutItem { Command = QuitUniGetUI }); - TrayMenu.AreOpenCloseAnimationsEnabled = false; TrayIcon = new TaskbarIcon(); @@ -560,7 +555,7 @@ public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, s TextBlock infotext = new() { - Text = CoreTools.Translate($"Click on Install to begin the installation process. If you skip the installation, UniGetUI may not work as expected."), + Text = CoreTools.Translate("Click on Install to begin the installation process. If you skip the installation, UniGetUI may not work as expected."), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 0, 0, 10), Opacity = .7F, @@ -588,7 +583,6 @@ public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, s }; p.Children.Add(manualInstallCommand); - CheckBox c = new(); if (NotFirstTime) { @@ -599,7 +593,6 @@ public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, s p.Children.Add(c); } - ProgressBar progress = new() { IsIndeterminate = false, @@ -625,7 +618,7 @@ public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, s infotext.Text = CoreTools.Translate("Please wait while {0} is being installed. A black window may show up. Please wait until it closes.", dep_name); Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = exe_name, Arguments = exe_args, @@ -652,7 +645,7 @@ public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, s } catch (Exception ex) { - // If an error occurrs + // If an error occurs Logger.Error(ex); dialog.IsPrimaryButtonEnabled = true; dialog.IsSecondaryButtonEnabled = true; @@ -767,8 +760,6 @@ private void RestoreGeometry() { Logger.Warn("Restored geometry was outside of desktop bounds"); } - - } private static bool IsRectangleFullyVisible(int x, int y, int width, int height) { diff --git a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs index ad5ef2d33..c9d7ce147 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs @@ -11,9 +11,6 @@ namespace UniGetUI.Interface.Pages.AboutPages /// /// An empty page that can be used on its own or navigated to within a Frame. /// - /// - - public sealed partial class Contributors : Page { public ObservableCollection ContributorList = []; diff --git a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs index c5f9ed43c..38d8ea605 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs @@ -30,7 +30,7 @@ public ThirdPartyLicenses() InitializeComponent(); foreach (string license in LicenseData.LicenseNames.Keys) { - Licenses.Add(new LibraryLicense() + Licenses.Add(new LibraryLicense { Name = license, License = LicenseData.LicenseNames[license], diff --git a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs index a723f3a1e..c04cd6a9e 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs @@ -15,8 +15,6 @@ namespace UniGetUI.Interface.Pages /// /// An empty page that can be used on its own or navigated to within a Frame. /// - /// - public abstract partial class BaseLogPage : Page, IPageWithKeyboardShortcuts { protected int LOG_LEVEL = 4; @@ -25,7 +23,6 @@ public abstract partial class BaseLogPage : Page, IPageWithKeyboardShortcuts protected abstract void LoadLogLevels(); public abstract void LoadLog(); - public BaseLogPage(bool log_level_enabled) { LogLevelEnabled = log_level_enabled; @@ -33,7 +30,7 @@ public BaseLogPage(bool log_level_enabled) if (LogLevelEnabled) { LoadLogLevels(); - } + } else { LogLevelPane.Visibility = Visibility.Collapsed; @@ -99,7 +96,7 @@ public async void ExportButton_Click(object sender, RoutedEventArgs e) LogTextBox.SelectAll(); await File.WriteAllTextAsync(file.Path, LogTextBox.SelectedText); LogTextBox.Select(LogTextBox.SelectionStart, LogTextBox.SelectionStart); - Process.Start(new ProcessStartInfo() + Process.Start(new ProcessStartInfo { FileName = "explorer.exe", Arguments = @$"/select, ""{file.Path}""" diff --git a/src/UniGetUI/Interface/Pages/LogPage/ManagerLogsPage.cs b/src/UniGetUI/Interface/Pages/LogPage/ManagerLogsPage.cs index c3fa091f4..c2409fcb1 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/ManagerLogsPage.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/ManagerLogsPage.cs @@ -25,9 +25,9 @@ public override void LoadLog() IManagerLogger TaskLogger = manager.TaskLogger; LogTextBox.Blocks.Clear(); Paragraph versionParagraph = new(); - versionParagraph.Inlines.Add(new Run() { Text = $"Manager {manager.DisplayName} with version:\n" }); - versionParagraph.Inlines.Add(new Run() { Text = manager.Status.Version }); - versionParagraph.Inlines.Add(new Run() { Text = $"\n\n——————————————————————————————————————————\n\n" }); + versionParagraph.Inlines.Add(new Run { Text = $"Manager {manager.DisplayName} with version:\n" }); + versionParagraph.Inlines.Add(new Run { Text = manager.Status.Version }); + versionParagraph.Inlines.Add(new Run { Text = "\n\n——————————————————————————————————————————\n\n" }); LogTextBox.Blocks.Add(versionParagraph); foreach (ITaskLogger operation in TaskLogger.Operations) @@ -45,7 +45,7 @@ public override void LoadLog() '5' => new SolidColorBrush { Color = IS_DARK ? DARK_YELLOW : LIGHT_YELLOW }, _ => new SolidColorBrush { Color = IS_DARK ? DARK_YELLOW : LIGHT_YELLOW }, }; - p.Inlines.Add(new Run() { Text = line[1..] + "\n", Foreground = color }); + p.Inlines.Add(new Run { Text = line[1..] + "\n", Foreground = color }); } ((Run)p.Inlines[^1]).Text = ((Run)p.Inlines[^1]).Text.TrimEnd(); LogTextBox.Blocks.Add(p); diff --git a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs index 2ba937e48..3659b383f 100644 --- a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs @@ -17,7 +17,6 @@ using Windows.UI; using Windows.UI.Text; using UniGetUI.PackageEngine.Managers.PowerShellManager; -using Windows.ApplicationModel; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -44,7 +43,6 @@ private enum LayoutMode Unloaded } - private LayoutMode __layout_mode = LayoutMode.Unloaded; public PackageDetailsPage(IPackage package, OperationType operationRole) { @@ -117,7 +115,7 @@ public PackageDetailsPage(IPackage package, OperationType operationRole) SetTextToItem(InstallerHash_Content, LoadingString); SetTextToItem(InstallerUrl_Label, CoreTools.Translate("Installer URL") + ": "); SetTextToItem(InstallerUrl_Content, LoadingString); - DownloadInstaller_Button.Click += (s, e) => { DownloadInstallerButton_Click(s, e); }; + DownloadInstaller_Button.Click += DownloadInstallerButton_Click; SetTextToItem(DownloadInstaller_Button, CoreTools.Translate("Download installer")); SetTextToItem(UpdateDate_Label, CoreTools.Translate("Last updated:") + " "); SetTextToItem(UpdateDate_Content, LoadingString); @@ -136,8 +134,6 @@ public async Task LoadInformation() LoadIcon(); LoadScreenshots(); - string NotFound = CoreTools.Translate("Not available"); - IPackageDetails details = Package.Details; if (!details.IsPopulated) { @@ -222,7 +218,7 @@ public async Task LoadInformation() ShowableTags.Clear(); foreach (string tag in details.Tags) { - ShowableTags.Add(new TextBlock() + ShowableTags.Add(new TextBlock { Text = tag, VerticalAlignment = VerticalAlignment.Center, @@ -250,7 +246,7 @@ public void SetTextToItem(Hyperlink h, Uri? u, string prefix = "", string suffix if (u == null) { h.Inlines.Clear(); - h.Inlines.Add(new Run() + h.Inlines.Add(new Run { Text = CoreTools.Translate("Not available"), TextDecorations = TextDecorations.None, @@ -261,14 +257,14 @@ public void SetTextToItem(Hyperlink h, Uri? u, string prefix = "", string suffix else { h.Inlines.Clear(); - h.Inlines.Add(new Run() { Text = prefix + u.ToString() + suffix }); + h.Inlines.Add(new Run { Text = prefix + u.ToString() + suffix }); h.NavigateUri = u; } } public void SetTextToItem(Hyperlink h, string s) { h.Inlines.Clear(); - h.Inlines.Add(new Run() { Text = s }); + h.Inlines.Add(new Run { Text = s }); h.NavigateUri = new Uri("about:blank"); } @@ -374,7 +370,7 @@ public async void DownloadInstallerButton_Click(object sender, RoutedEventArgs e while (running) { DownloadInstaller_Button.Inlines.Clear(); - DownloadInstaller_Button.Inlines.Add(new Run() { Text = baseString + " " + texts[i++ % 6] }); + DownloadInstaller_Button.Inlines.Add(new Run { Text = baseString + " " + texts[i++ % 6] }); await Task.Delay(500); } }; @@ -389,7 +385,7 @@ public async void DownloadInstallerButton_Click(object sender, RoutedEventArgs e await s.CopyToAsync(fs); fs.Dispose(); DownloadInstaller_Button.Inlines.Clear(); - DownloadInstaller_Button.Inlines.Add(new Run() { Text = CoreTools.Translate("Download installer") }); + DownloadInstaller_Button.Inlines.Add(new Run { Text = CoreTools.Translate("Download installer") }); running = false; Logger.ImportantInfo($"Installer for {Package.Id} has been downloaded successfully"); MainApp.Instance.MainWindow.HideLoadingDialog(); @@ -398,16 +394,14 @@ public async void DownloadInstallerButton_Click(object sender, RoutedEventArgs e } catch (Exception ex) { - running = false; Logger.Error($"An error occurred while downloading the installer for the package {Package.Id}"); Logger.Error(ex); DownloadInstaller_Button.Inlines.Clear(); - DownloadInstaller_Button.Inlines.Add(new Run() { Text = CoreTools.Translate("An error occurred") + ": " + ex.Message }); + DownloadInstaller_Button.Inlines.Add(new Run { Text = CoreTools.Translate("An error occurred") + ": " + ex.Message }); } - - } + public void CloseButton_Click(object sender, RoutedEventArgs e) { Close?.Invoke(this, EventArgs.Empty); diff --git a/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs index f52fabd59..c9c820e37 100644 --- a/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs @@ -28,7 +28,6 @@ public sealed partial class SettingsInterface : Page private readonly HyperlinkButton OpenBackupDirectory; private readonly TextBlock BackupDirectoryLabel; - public SettingsInterface() { InitializeComponent(); @@ -99,7 +98,6 @@ public SettingsInterface() // Experimental Settings Section ExperimentalSettingsExpander.HideRestartRequiredBanner(); - // Package Manager banners; Dictionary PackageManagerExpanders = []; Dictionary> ExtraSettingsCards = []; @@ -109,7 +107,6 @@ public SettingsInterface() ExtraSettingsCards.Add(Manager, []); } - ButtonCard Winget_ResetSources = new() { Text = CoreTools.AutoTranslated("Reset Winget sources (might help if no packages are listed)"), ButtonText = CoreTools.AutoTranslated("Reset") }; Winget_ResetSources.Click += (s, e) => { @@ -169,7 +166,6 @@ public SettingsInterface() ExtraSettingsCards[PEInterface.Chocolatey].Add(Chocolatey_SystemChoco); - foreach (PackageManager Manager in PEInterface.Managers) { @@ -303,7 +299,6 @@ void EnableOrDisableEntries() ParallelCard._checkbox.Content = (ParallelCard._checkbox.Content.ToString() ?? "").Replace("{pm}", Manager.DisplayName); ExtraSettingsCards[Manager].Insert(index++, ParallelCard); - if (Manager.Capabilities.SupportsCustomSources) { SettingsCard SourceManagerCard = new(); @@ -482,11 +477,9 @@ private void UseSystemGSudo_StateChanged(object sender, EventArgs e) private void DisableWidgetsApi_StateChanged(object sender, EventArgs e) { ExperimentalSettingsExpander.ShowRestartRequiredBanner(); } - private void UseSystemWinget_StateChanged(object sender, EventArgs e) { ExperimentalSettingsExpander.ShowRestartRequiredBanner(); } - private void DisableDownloadingNewTranslations_StateChanged(object sender, EventArgs e) { ExperimentalSettingsExpander.ShowRestartRequiredBanner(); } @@ -521,7 +514,7 @@ private void EditAutostartSettings_Click(object sender, EventArgs e) { Process p = new() { - StartInfo = new ProcessStartInfo() + StartInfo = new ProcessStartInfo { FileName = "ms-settings:startupapps", UseShellExecute = true, diff --git a/src/UniGetUI/Interface/SoftwarePages/AbstractPackagesPage.xaml.cs b/src/UniGetUI/Interface/SoftwarePages/AbstractPackagesPage.xaml.cs index 775899a5e..65fbf450d 100644 --- a/src/UniGetUI/Interface/SoftwarePages/AbstractPackagesPage.xaml.cs +++ b/src/UniGetUI/Interface/SoftwarePages/AbstractPackagesPage.xaml.cs @@ -2,18 +2,12 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using System.Diagnostics; -using System.Runtime.InteropServices.WindowsRuntime; -using System.Runtime.Serialization.Formatters; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Pages; using UniGetUI.Interface.Widgets; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Operations; using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.PackageEngine.PackageLoader; @@ -467,8 +461,6 @@ protected void ClearPackageList() /// Reload the packages for this Page /// Calling this method will trigger a reload on the associated PackageLoader, unless it is already loading packages. /// - /// - /// protected async Task LoadPackages(ReloadReason reason) { if (!Loader.IsLoading && (!Loader.IsLoaded || reason == ReloadReason.External || reason == ReloadReason.Manual || reason == ReloadReason.Automated)) @@ -480,7 +472,7 @@ protected async Task LoadPackages(ReloadReason reason) } /// - /// Will filter the packages with the query on QueryBlock.Text and put the + /// Will filter the packages with the query on QueryBlock.Text and put the /// resulting packages on the ItemsView /// public void FilterPackages() @@ -765,11 +757,10 @@ private void PackageItemContainer_KeyUp(object sender, KeyRoutedEventArgs e) IPackage? package = (sender as PackageItemContainer)?.Package; bool IS_CONTROL_PRESSED = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - bool IS_SHIFT_PRESSED = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + //bool IS_SHIFT_PRESSED = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); bool IS_ALT_PRESSED = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.LeftMenu).HasFlag(CoreVirtualKeyStates.Down); IS_ALT_PRESSED |= InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.RightMenu).HasFlag(CoreVirtualKeyStates.Down); - if (e.Key == VirtualKey.Enter && package is not null) { if (IS_ALT_PRESSED) diff --git a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs index 9b9810beb..14baab446 100644 --- a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs @@ -20,7 +20,7 @@ public class DiscoverSoftwarePage : AbstractPackagesPage private BetterMenuItem? MenuInteractive; private BetterMenuItem? MenuSkipHash; public DiscoverSoftwarePage() - : base(new PackagesPageData() + : base(new PackagesPageData { DisableAutomaticPackageLoadOnStart = true, MegaQueryBlockEnabled = true, diff --git a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs index 3d803d0b0..ab351817c 100644 --- a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs @@ -7,7 +7,6 @@ using UniGetUI.Interface.Enums; using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine; -using UniGetUI.PackageEngine.Classes; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Operations; @@ -24,7 +23,7 @@ public class InstalledPackagesPage : AbstractPackagesPage private BetterMenuItem? MenuRemoveData; public InstalledPackagesPage() - : base(new PackagesPageData() + : base(new PackagesPageData { DisableAutomaticPackageLoadOnStart = false, MegaQueryBlockEnabled = false, diff --git a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs index 9fd798196..8c94f38ad 100644 --- a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs @@ -1,33 +1,19 @@ using ExternalLibraries.Pickers; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; -using System.Linq; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using System.Text; using System.Text.Json; -using System.Threading.Tasks; using System.Xml.Serialization; -using UniGetUI.Core.Data; using UniGetUI.Core.Logging; -using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine; -using UniGetUI.PackageEngine.Classes; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Serializable; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Operations; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.PackageLoader; -using Windows.Media.Devices; namespace UniGetUI.Interface.SoftwarePages { @@ -38,7 +24,7 @@ public class PackageBundlesPage : AbstractPackagesPage BetterMenuItem? MenuSkipHash; public PackageBundlesPage() - : base(new PackagesPageData() + : base(new PackagesPageData { DisableAutomaticPackageLoadOnStart = true, MegaQueryBlockEnabled = false, @@ -371,7 +357,7 @@ public async Task OpenFile() { // Select file FileOpenPicker picker = new(MainApp.Instance.MainWindow.GetWindowHandle()); - string file = picker.Show(new List() { "*.json", "*.yaml", "*.xml" }); + string file = picker.Show(new List { "*.json", "*.yaml", "*.xml" }); if (file == String.Empty) return; @@ -408,7 +394,7 @@ public async Task SaveFile() { // Get file // Save file - string file = (new FileSavePicker(MainApp.Instance.MainWindow.GetWindowHandle())).Show(new List() { "*.json", "*.yaml", "*.xml" }, CoreTools.Translate("Package bundle") + ".json"); + string file = (new FileSavePicker(MainApp.Instance.MainWindow.GetWindowHandle())).Show(new List { "*.json", "*.yaml", "*.xml" }, CoreTools.Translate("Package bundle") + ".json"); if (file != String.Empty) { // Loading dialog @@ -429,7 +415,7 @@ public async Task SaveFile() MainApp.Instance.MainWindow.HideLoadingDialog(); // Launch file - Process.Start(new ProcessStartInfo() + Process.Start(new ProcessStartInfo { FileName = "explorer.exe", Arguments = @$"/select, ""{file}""" diff --git a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs index 5c0b4a8e1..58a56f09f 100644 --- a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs @@ -22,7 +22,7 @@ public class SoftwareUpdatesPage : AbstractPackagesPage private BetterMenuItem? MenuskipHash; public SoftwareUpdatesPage() - : base(new PackagesPageData() + : base(new PackagesPageData { DisableAutomaticPackageLoadOnStart = false, MegaQueryBlockEnabled = false, @@ -69,21 +69,21 @@ public override BetterMenu GenerateContextMenu() ShowInstallationOptionsForPackage(SelectedItem); }; - MenuAsAdmin = new BetterMenuItem() + MenuAsAdmin = new BetterMenuItem { Text = "Update as administrator", IconName = IconType.UAC, }; MenuAsAdmin.Click += MenuAsAdmin_Invoked; - MenuInteractive = new BetterMenuItem() + MenuInteractive = new BetterMenuItem { Text = "Interactive update", IconName = IconType.Interactive, }; MenuInteractive.Click += MenuInteractive_Invoked; - MenuskipHash = new BetterMenuItem() + MenuskipHash = new BetterMenuItem { Text = "Skip hash check", IconName = IconType.Checksum, @@ -104,7 +104,6 @@ public override BetterMenu GenerateContextMenu() }; menuUninstall.Click += MenuUninstall_Invoked; - BetterMenuItem menuIgnorePackage = new() { Text = "Ignore updates for this package", @@ -344,7 +343,7 @@ protected override void WhenPackagesLoaded(ReloadReason reason) else { title = CoreTools.Translate("Updates found!"); - body = CoreTools.Translate("{0} packages are being updated", upgradablePackages.Count); ; + body = CoreTools.Translate("{0} packages are being updated", upgradablePackages.Count); foreach (IPackage package in upgradablePackages) { attribution += package.Name + ", "; @@ -364,7 +363,7 @@ protected override void WhenPackagesLoaded(ReloadReason reason) else { title = CoreTools.Translate("Updates found!"); - body = CoreTools.Translate("{0} packages can be updated", upgradablePackages.Count); ; + body = CoreTools.Translate("{0} packages can be updated", upgradablePackages.Count); foreach (IPackage package in upgradablePackages) { attribution += package.Name + ", "; diff --git a/src/UniGetUI/Interface/Widgets/Announcer.xaml.cs b/src/UniGetUI/Interface/Widgets/Announcer.xaml.cs index 6979c7567..a54df092b 100644 --- a/src/UniGetUI/Interface/Widgets/Announcer.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/Announcer.xaml.cs @@ -23,7 +23,6 @@ public Uri Url private readonly DependencyProperty UrlProperty; - private static readonly HttpClient NetClient = new(CoreData.GenericHttpClientParameters); public Announcer() { diff --git a/src/UniGetUI/Interface/Widgets/ButtonCard.cs b/src/UniGetUI/Interface/Widgets/ButtonCard.cs index cdcec6b6e..6de3712eb 100644 --- a/src/UniGetUI/Interface/Widgets/ButtonCard.cs +++ b/src/UniGetUI/Interface/Widgets/ButtonCard.cs @@ -1,5 +1,4 @@ using CommunityToolkit.WinUI.Controls; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs index 6cc272f9b..52543cfbd 100644 --- a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs @@ -3,7 +3,6 @@ using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using Windows.UI.ApplicationSettings; // 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/Interface/Widgets/ComboboxCard.cs b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs index e4cbee209..92bb85ad8 100644 --- a/src/UniGetUI/Interface/Widgets/ComboboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs @@ -1,9 +1,7 @@ using CommunityToolkit.WinUI.Controls; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using System.Collections.ObjectModel; -using System.Linq.Expressions; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Widgets/MenuForPackage.cs b/src/UniGetUI/Interface/Widgets/MenuForPackage.cs index b307bd199..983403081 100644 --- a/src/UniGetUI/Interface/Widgets/MenuForPackage.cs +++ b/src/UniGetUI/Interface/Widgets/MenuForPackage.cs @@ -1,8 +1,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.PackageClasses; using UniGetUI.Interface.Enums; namespace UniGetUI.Interface.Widgets @@ -10,7 +8,7 @@ namespace UniGetUI.Interface.Widgets public class BetterMenu : MenuFlyout { private readonly Style menuyStyle = (Style)Application.Current.Resources["BetterContextMenu"]; - public BetterMenu() : base() + public BetterMenu() { MenuFlyoutPresenterStyle = menuyStyle; } @@ -18,7 +16,7 @@ public BetterMenu() : base() public class BetterMenuItem : MenuFlyoutItem { - private readonly Style menuyStyle = (Style)Application.Current.Resources["BetterMenuItem"]; + private readonly Style menuStyle = (Style)Application.Current.Resources["BetterMenuItem"]; public IconType IconName { @@ -35,9 +33,9 @@ public IconType IconName set => base.Text = CoreTools.Translate(value); } - public BetterMenuItem() : base() + public BetterMenuItem() { - Style = menuyStyle; + Style = menuStyle; } } } diff --git a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs index 64d31b647..eff2ec60b 100644 --- a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs @@ -44,10 +44,4 @@ public void ForceClick() Click?.Invoke(this, EventArgs.Empty); } } -} - - -/* - - -*/ +} \ No newline at end of file diff --git a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs index 9320f4e9f..3d054533b 100644 --- a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs @@ -5,9 +5,7 @@ using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Operations; -using UniGetUI.PackageEngine.PackageClasses; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -82,7 +80,6 @@ public SourceManager(IPackageManager Manager) p1.Children.Add(new TextBlock { Text = CoreTools.Translate("Source name:"), VerticalAlignment = VerticalAlignment.Center }); p1.Children.Add(SourceNameTextBox); - StackPanel p2 = new() { Spacing = 2, HorizontalAlignment = HorizontalAlignment.Stretch }; p2.Children.Add(new TextBlock { Text = CoreTools.Translate("Source URL:"), VerticalAlignment = VerticalAlignment.Center }); p2.Children.Add(SourceUrlTextBox); diff --git a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs index 3490785e4..cbf186edd 100644 --- a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs +++ b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs @@ -12,7 +12,6 @@ using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Enums; - // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -33,7 +32,6 @@ private enum WidgetLayout Compact, } - private string __button_text = ""; private string __line_info_text = "Please wait..."; private Uri __icon_source = new("ms-appx:///Assets/Images/package_color.png"); @@ -129,7 +127,7 @@ protected SolidColorBrush? ProgressBarColor { __progressbar_color = value; if (ProgressIndicator != null) { - ProgressIndicator.Foreground = (__progressbar_color != null) ? __progressbar_color : null; + ProgressIndicator.Foreground = __progressbar_color ?? null; } } } @@ -156,8 +154,8 @@ public OperationStatus Status { /* - * - * + * + * @@ -235,7 +233,6 @@ public AbstractOperation(bool IgnoreParallelInstalls = false) OutputDialog.Title = CoreTools.Translate("Live output"); OutputDialog.CloseButtonText = CoreTools.Translate("Close"); - OutputDialog.SizeChanged += (s, e) => { if (!IsDialogOpen) @@ -470,8 +467,6 @@ protected async Task MainThread() ProcessOutput.Add("Process Exit Code : " + Process.ExitCode.ToString()); ProcessOutput.Add("Process End Time : " + DateTime.Now.ToString()); - - AfterFinshAction postAction = AfterFinshAction.ManualClose; OperationVeredict OperationVeredict = GetProcessVeredict(Process.ExitCode, ProcessOutput.ToArray()); @@ -562,8 +557,6 @@ protected async Task MainThread() try { Status = OperationStatus.Failed; } catch { } } MainApp.Instance.TooltipStatus.OperationsInProgress = MainApp.Instance.TooltipStatus.OperationsInProgress - 1; - - } protected async Task Close() { diff --git a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs index 6b736737d..559c5b513 100644 --- a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.WinUI.Notifications; +using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml.Controls; using System.Diagnostics; using UniGetUI.Core.Data; @@ -343,7 +343,6 @@ protected override async Task BuildProcessInstance(ProcessStartInfo sta StartInfo = startInfo }; - return process; } diff --git a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs index 2aaa9150e..636e9a79f 100644 --- a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs @@ -5,7 +5,6 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassesDefinition.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassesDefinition.cs index 9cac955bb..7b9946f0b 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassesDefinition.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassesDefinition.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.Management.Deployment; @@ -13,7 +13,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(PackageManager), InterfaceType = typeof(IPackageManager), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("C53A4F16-787E-42A4-B304-29EFFB4BF597"), [ClsidContext.Dev] = new Guid("74CB3139-B7C5-4B9E-9388-E6616DEA288C"), @@ -24,7 +24,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(FindPackagesOptions), InterfaceType = typeof(IFindPackagesOptions), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("572DED96-9C60-4526-8F92-EE7D91D38C1A"), [ClsidContext.Dev] = new Guid("1BD8FF3A-EC50-4F69-AEEE-DF4C9D3BAA96"), @@ -35,7 +35,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(CreateCompositePackageCatalogOptions), InterfaceType = typeof(ICreateCompositePackageCatalogOptions), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("526534B8-7E46-47C8-8416-B1685C327D37"), [ClsidContext.Dev] = new Guid("EE160901-B317-4EA7-9CC6-5355C6D7D8A7"), @@ -46,7 +46,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(InstallOptions), InterfaceType = typeof(IInstallOptions), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("1095F097-EB96-453B-B4E6-1613637F3B14"), [ClsidContext.Dev] = new Guid("44FE0580-62F7-44D4-9E91-AA9614AB3E86"), @@ -57,7 +57,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(UninstallOptions), InterfaceType = typeof(IUninstallOptions), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("E1D9A11E-9F85-4D87-9C17-2B93143ADB8D"), [ClsidContext.Dev] = new Guid("AA2A5C04-1AD9-46C4-B74F-6B334AD7EB8C"), @@ -68,7 +68,7 @@ internal static class ClassesDefinition { ProjectedClassType = typeof(PackageMatchFilter), InterfaceType = typeof(IPackageMatchFilter), - Clsids = new Dictionary() + Clsids = new Dictionary { [ClsidContext.Prod] = new Guid("D02C9DAF-99DC-429C-B503-4E504E4AB000"), [ClsidContext.Dev] = new Guid("3F85B9F4-487A-4C48-9035-2903F8A6D9E8"), @@ -104,7 +104,6 @@ public static Guid GetIid() /// /// Validate that the provided type is defined. /// - /// Projected class type /// Throws an exception if type is not a project class. private static void ValidateType() { diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerStandardFactory.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerStandardFactory.cs index 2af63e07e..3ff835e0a 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerStandardFactory.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerStandardFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Runtime.InteropServices; @@ -29,7 +29,6 @@ protected override T CreateInstance(Guid clsid, Guid iid) // above are met. Marshal.ThrowExceptionForHR(hr); - pUnknown = Marshal.GetIUnknownForObject(result); return MarshalGeneric.FromAbi(pUnknown); }