From 2321ca8b8962f05d47b72adf98dbd9616d2c16b5 Mon Sep 17 00:00:00 2001 From: SkandaBT <9980056379Skanda@gmail.com> Date: Thu, 22 Aug 2024 16:23:04 +0530 Subject: [PATCH 1/9] Update bug-issue.yml (#37) --- .github/ISSUE_TEMPLATE/bug-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issue.yml b/.github/ISSUE_TEMPLATE/bug-issue.yml index 394fe444e..5558b7771 100644 --- a/.github/ISSUE_TEMPLATE/bug-issue.yml +++ b/.github/ISSUE_TEMPLATE/bug-issue.yml @@ -20,7 +20,7 @@ body: - type: input attributes: label: UniGetUI Version - placeholder: 3.0.2 + placeholder: 'x.y.z (e.g., 3.1.0)' validations: required: true - type: input From 98c9793bf575c20342b85228a2e9df1dcb2ec0f4 Mon Sep 17 00:00:00 2001 From: "deepsource-io[bot]" <42547082+deepsource-io[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:17:50 +0000 Subject: [PATCH 2/9] ci: add .deepsource.toml --- .deepsource.toml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 000000000..07dedbe86 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,28 @@ +version = 1 + +[[analyzers]] +name = "python" + + [analyzers.meta] + runtime_version = "3.x.x" + +[[analyzers]] +name = "csharp" + +[[transformers]] +name = "dotnet-format" + +[[transformers]] +name = "autopep8" + +[[transformers]] +name = "isort" + +[[transformers]] +name = "black" + +[[transformers]] +name = "yapf" + +[[transformers]] +name = "ruff" \ No newline at end of file From 5ec4ab8314794d03b27e3fa12a9201f5cca954a9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 17:51:29 +0530 Subject: [PATCH 3/9] style: format code with Autopep8, Black, dotnet-format, isort, Ruff Formatter and Yapf (#38) This commit fixes the style issues introduced in 98c9793 according to the output from Autopep8, Black, dotnet-format, isort, Ruff Formatter and Yapf. Details: None Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- WebBasedData/test_urls.py | 59 +++++-- scripts/Languages/LangData.py | 64 +++++--- scripts/Languages/LangReference.py | 6 +- scripts/apply_versions.py | 62 +++++--- scripts/download_translations.py | 83 ++++++---- scripts/generate_json_from_excel.py | 44 ++++-- scripts/get_contributors.py | 22 ++- scripts/purge_unusedtranslations.py | 2 +- scripts/tolgee_requests.py | 17 +- scripts/translation_commands.py | 33 ++-- scripts/translation_utils.py | 145 ++++++++++++++---- scripts/verify_translations.py | 40 +++-- .../Classes/FileOpenDialogRCW.cs | 4 +- .../Classes/FileSaveDialogRCW.cs | 2 +- .../Classes/Helper.cs | 4 +- .../Enums/FDAP.cs | 2 +- .../Enums/FDE_OVERWRITE_RESPONSE.cs | 2 +- .../Enums/FDE_SHAREVIOLATION_RESPONSE.cs | 2 +- .../Enums/FOS.cs | 2 +- .../Enums/HRESULT.cs | 2 +- .../Enums/SIGDN.cs | 2 +- .../FileOpenPicker.cs | 2 +- .../FileSavePicker.cs | 2 +- .../FolderPicker.cs | 2 +- .../Guids/CLSIDGuid.cs | 2 +- .../Guids/IIDGuid.cs | 2 +- .../Guids/KFIDGuid.cs | 2 +- .../Interfaces/FileOpenDialog.cs | 6 +- .../Interfaces/FileSaveDialog.cs | 4 +- .../Interfaces/IFileDialog.cs | 6 +- .../Interfaces/IFileDialogEvents.cs | 4 +- .../Interfaces/IFileOpenDialog.cs | 4 +- .../Interfaces/IModalWindow.cs | 2 +- .../Interfaces/IShellItem.cs | 4 +- .../Interfaces/IShellItemArray.cs | 6 +- .../Structures/COMDLG_FILTERSPEC.cs | 2 +- .../Structures/PROPERTYKEY.cs | 2 +- src/SharedAssemblyInfo.cs | 2 +- .../PersonTests.cs | 2 +- .../IIndexableListItem.cs | 2 +- src/UniGetUI.Core.Classes/Person.cs | 2 +- .../ContributorsTests.cs | 2 +- src/UniGetUI.Core.Data.Tests/CoreTests.cs | 12 +- src/UniGetUI.Core.Data.Tests/LicensesTest.cs | 2 +- src/UniGetUI.Core.Data/Contributors.cs | 2 +- src/UniGetUI.Core.Data/CoreData.cs | 6 +- src/UniGetUI.Core.Data/Licenses.cs | 129 ++++++++-------- .../IconDatabaseTests.cs | 2 +- src/UniGetUI.Core.IconStore/Serializable.cs | 2 +- .../LanguageData.cs | 7 +- .../LanguageEngine.cs | 2 +- .../LogEntryTests.cs | 2 +- .../SettingsTest.cs | 2 +- src/UniGetUI.Core.Structs/Person.cs | 2 +- .../BackgroundApi.cs | 2 +- .../ManagerProperties.cs | 2 +- .../ManagerCapabilities.cs | 2 +- .../ManagerLogger.cs | 22 +-- .../Chocolatey.cs | 6 +- .../Providers/ChocolateyDetailsProvider.cs | 2 +- .../Providers/ChocolateyOperationProvider.cs | 9 +- .../DotNet.cs | 4 +- .../Providers/DotNetOperationProvider.cs | 3 +- .../BaseNuGet.cs | 6 +- .../Npm.cs | 6 +- .../Providers/NpmOperationProvider.cs | 5 +- .../Pip.cs | 4 +- .../Providers/PipOperationProvider.cs | 5 +- .../PowerShell.cs | 27 ++-- .../Providers/PowerShellOperationProvider.cs | 7 +- .../PowerShell7.cs | 25 +-- .../Providers/PowerShell7OperationProvider.cs | 7 +- .../Providers/ScoopOperationProvider.cs | 5 +- .../Scoop.cs | 4 +- .../Providers/WinGetOperationProvider.cs | 12 +- .../WinGet.cs | 12 +- .../WinGetHelpers/BundledWinGetHelper.cs | 75 ++++----- .../WinGetHelpers/NativeWinGetHelper.cs | 2 +- .../InstallationOptions.cs | 2 +- src/UniGetUI.PackageEngine.Package/Package.cs | 8 +- .../PackageDetails.cs | 2 +- .../UpgradablePackage.cs | 2 +- .../AbstractPackageLoader.cs | 4 +- .../PackageBundlesLoader.cs | 6 +- .../Manager/Classes/ManagerSource.cs | 2 +- .../Manager/PackageManager.cs | 6 +- .../Packages/ObservablePackageCollection.cs | 2 +- .../SerializableBundle_v1.cs | 2 +- .../SerializableIncompatiblePackage_v1.cs | 2 +- src/UniGetUI/App.xaml.cs | 6 +- src/UniGetUI/EntryPoint.cs | 16 +- .../Interface/Dialogs/IgnoredUpdates.xaml.cs | 2 +- .../Interface/Dialogs/InstallOptions.xaml.cs | 10 +- src/UniGetUI/Interface/MainView.xaml.cs | 2 +- src/UniGetUI/Interface/MainWindow.xaml.cs | 24 +-- .../Pages/AboutPages/Contributors.xaml.cs | 2 +- .../AboutPages/ThirdPartyLicenses.xaml.cs | 2 +- .../Pages/AboutPages/Translators.xaml.cs | 2 +- src/UniGetUI/Interface/Pages/HelpPage.xaml.cs | 2 +- .../Pages/IPageWithKeyboardShortcuts.cs | 2 +- .../Interface/Pages/LogPage/AppLogPage.cs | 2 +- .../Interface/Pages/LogPage/LogPage.xaml.cs | 2 +- .../Pages/LogPage/OperationHistoryPage.cs | 2 +- .../Pages/PackageDetailsPage.xaml.cs | 4 +- .../Interface/Pages/SettingsPage.xaml.cs | 24 +-- .../SoftwarePages/DiscoverSoftwarePage.cs | 36 ++--- .../SoftwarePages/InstalledPackagesPage.cs | 36 ++--- .../SoftwarePages/PackageBundlesPage.cs | 70 ++++----- .../SoftwarePages/SoftwareUpdatesPage.cs | 36 ++--- .../Interface/Widgets/CheckboxCard.cs | 3 +- .../Interface/Widgets/ComboboxCard.cs | 2 +- .../Interface/Widgets/NavButton.xaml.cs | 5 +- .../Interface/Widgets/PackageItemContainer.cs | 2 +- .../Interface/Widgets/SourceManager.xaml.cs | 2 +- src/UniGetUI/Interface/Widgets/TextboxCard.cs | 3 +- .../Operations/OperationControl.xaml.cs | 6 +- .../Operations/PackageOperations.cs | 4 +- .../Operations/SourceOperations.cs | 2 +- .../WinGetConfigurationException.cs | 2 +- .../WindowsPackageManager/ClassModel.cs | 2 +- .../WindowsPackageManager/ClsidContext.cs | 2 +- .../WindowsPackageManagerFactory.cs | 2 +- 122 files changed, 847 insertions(+), 595 deletions(-) diff --git a/WebBasedData/test_urls.py b/WebBasedData/test_urls.py index 50862ae29..d03f9b832 100644 --- a/WebBasedData/test_urls.py +++ b/WebBasedData/test_urls.py @@ -1,11 +1,15 @@ -import requests, time +import time + +import requests try: - import os, sys, json - + import json + import os + import sys + urls = [] - #with open("invalid_urls.txt", "w") as f: + # with open("invalid_urls.txt", "w") as f: # f.write("") with open("screenshot-database-v2.json") as f: @@ -15,31 +19,56 @@ if package <= "nosqlworkbench": continue if data["icons_and_screenshots"][package]["icon"] != "": - print("Package:", package, data["icons_and_screenshots"][package]["icon"]) - response = requests.get(data["icons_and_screenshots"][package]["icon"]) + print( + "Package:", + package, + data["icons_and_screenshots"][package]["icon"], + ) + response = requests.get( + data["icons_and_screenshots"][package]["icon"] + ) if response.status_code == 404: - print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) + print( + "Package failed:", + package, + data["icons_and_screenshots"][package]["icon"], + ) with open("invalid_urls.txt", "a") as f: - f.write(data["icons_and_screenshots"][package]["icon"] + "\n") + f.write( + data["icons_and_screenshots"][package]["icon"] + "\n" + ) elif response.status_code != 200 and response.status_code != 403: - print(response.status_code, "failed for:", data["icons_and_screenshots"][package]["icon"]) + print( + response.status_code, + "failed for:", + data["icons_and_screenshots"][package]["icon"], + ) except requests.exceptions.ConnectionError: time.sleep(0.1) try: if data["icons_and_screenshots"][package]["icon"] != "": - response = requests.get(data["icons_and_screenshots"][package]["icon"]) + response = requests.get( + data["icons_and_screenshots"][package]["icon"] + ) if response.status_code == 403 or response.status_code == 404: - print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) + print( + "Package failed:", + package, + data["icons_and_screenshots"][package]["icon"], + ) elif response.status_code != 200: - response = requests.get(data["icons_and_screenshots"][package]["icon"]) + response = requests.get( + data["icons_and_screenshots"][package]["icon"] + ) if response.status_code != 200: - print("Failed to resolve DNS for:", data["icons_and_screenshots"][package]["icon"]) + print( + "Failed to resolve DNS for:", + data["icons_and_screenshots"][package]["icon"], + ) except requests.exceptions.ConnectionError as e: print(type(e)) - - except Exception as e: print(e) os.system("pause") diff --git a/scripts/Languages/LangData.py b/scripts/Languages/LangData.py index 184d5ecf0..753c715e6 100644 --- a/scripts/Languages/LangData.py +++ b/scripts/Languages/LangData.py @@ -6,32 +6,50 @@ """ -import os import json +import os if os.path.exists("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list"): - f = open("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list", "r", encoding="utf-8") + f = open( + "../src/UniGetUI.Core.Data/Assets/Data/Contributors.list", "r", encoding="utf-8" + ) contributors = f.readlines() else: print("No contributors file!") contributors = [] if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"): - f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json", "r", encoding="utf-8") + f = open( + "../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json", + "r", + encoding="utf-8", + ) languageCredits = json.load(f) else: print("No translators file!") languageCredits = {} -if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"): - f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", "r", encoding="utf-8") +if os.path.exists( + "../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json" +): + f = open( + "../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", + "r", + encoding="utf-8", + ) untranslatedPercentage = json.load(f) else: print("No translated percent file!") untranslatedPercentage = {} -if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json"): - f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json", "r", encoding="utf-8") +if os.path.exists( + "../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json" +): + f = open( + "../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json", + "r", + encoding="utf-8", + ) languageReference = json.load(f) else: print("No translated percent file!") @@ -46,7 +64,6 @@ "zh-Hant": "zh_TW", } - # ISO 3166-1 languageFlagsRemap = { "ar": "sa", @@ -76,12 +93,11 @@ "zh": "cn", "bn": "bd", "tg": "ph", - "sq": "al" + "sq": "al", } def getMarkdownSupportLangs(): - readmeLangs = [ "| Language | Translated | Translator(s) |", "| :-- | :-- | --- |", @@ -89,17 +105,25 @@ def getMarkdownSupportLangs(): dir = os.path.dirname(__file__) for lang, langName in languageReference.items(): - if (not os.path.exists(f"{dir}/../../src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_{lang}.json")): + if not os.path.exists( + f"{dir}/../../src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_{lang}.json" + ): continue - perc = untranslatedPercentage[lang] if (lang in untranslatedPercentage) else "100%" - if (perc == "0%"): + perc = ( + untranslatedPercentage[lang] if (lang in untranslatedPercentage) else "100%" + ) + if perc == "0%": continue langName = languageReference[lang] if (lang in languageReference) else lang flag = languageFlagsRemap[lang] if (lang in languageFlagsRemap) else lang - credits = makeURLFromTranslatorList(languageCredits[lang] if (lang in languageCredits) else "") - readmeLangs.append(f"|   {langName} | {perc} | {credits} |") + credits = makeURLFromTranslatorList( + languageCredits[lang] if (lang in languageCredits) else "" + ) + readmeLangs.append( + f"|   {langName} | {perc} | {credits} |" + ) readmeLangs.append("") return "\n".join(readmeLangs) @@ -113,12 +137,12 @@ def getTranslatorsFromCredits(translators: str) -> list: translatorData = {} for translator in translators.split(","): translatorStriped = translator.strip() - if (translatorStriped != ""): - translatorPrefixed = (translatorStriped[0] == "@") - if (translatorPrefixed): + if translatorStriped != "": + translatorPrefixed = translatorStriped[0] == "@" + if translatorPrefixed: translatorStriped = translatorStriped[1:] link = "" - if (translatorPrefixed or translatorStriped in contributors): + if translatorPrefixed or translatorStriped in contributors: link = f"https://github.com/{translatorStriped}" translatorList.append(translatorStriped) translatorData[translatorStriped] = { @@ -138,7 +162,7 @@ def makeURLFromTranslatorList(translators: list) -> str: for translator in translators: link = translator.get("link") name = translator.get("name") - if (link): + if link: credits.append(f"[{name}]({link})") else: credits.append(name) diff --git a/scripts/Languages/LangReference.py b/scripts/Languages/LangReference.py index 35eea0df7..838799f5c 100644 --- a/scripts/Languages/LangReference.py +++ b/scripts/Languages/LangReference.py @@ -2,11 +2,11 @@ lang = {} englang = {} -languages = {} # will be auto-generated +languages = {} # will be auto-generated -## auto-generate map of files +# auto-generate map of files for key in languageReference.keys(): - if (key != "default"): + if key != "default": languages[key] = f"lang_{key}.json" debugLang = False diff --git a/scripts/apply_versions.py b/scripts/apply_versions.py index dc9367a3b..c457e57b1 100644 --- a/scripts/apply_versions.py +++ b/scripts/apply_versions.py @@ -1,5 +1,5 @@ -import os import glob +import os os.chdir(os.path.join(os.path.dirname(__file__), "..")) # move to root project @@ -20,36 +20,52 @@ def fileReplaceLinesWith(filename: str, list: dict[str, str], encoding="utf-8"): for line in f.readlines(): match = False for key, value in list.items(): - if (key in line): + if key in line: data += f"{key}{value}" match = True continue - if (not match): + if not match: data += line f.seek(0) f.write(data) f.truncate() - fileReplaceLinesWith("src/UniGetUI.Core.Data/CoreData.cs", { - " public const string VersionName = ": f" \"{versionName}\"; // Do not modify this line, use file scripts/apply_versions.py\n", - " public const double VersionNumber = ": f" {versionCode}; // Do not modify this line, use file scripts/apply_versions.py\n", - }, encoding="utf-8-sig") - - fileReplaceLinesWith("src/SharedAssemblyInfo.cs", { - "[assembly: AssemblyVersion(\"": f"{versionISS}\")]\n", - "[assembly: AssemblyFileVersion(\"": f"{versionISS}\")]\n", - "[assembly: AssemblyInformationalVersion(\"": f"{versionName}\")]\n", - # Your replacement dictionary here - }, encoding="utf-8-sig") - - fileReplaceLinesWith("UniGetUI.iss", { - "#define MyAppVersion": f" \"{versionName}\"\n", - "VersionInfoVersion=": f"{versionISS}\n", - }, encoding="utf-8-sig") - - fileReplaceLinesWith("src/UniGetUI/app.manifest", { - " version=": f" \"{versionISS}\"\n", - }, encoding="utf-8-sig") + fileReplaceLinesWith( + "src/UniGetUI.Core.Data/CoreData.cs", + { + " public const string VersionName = ": f' "{versionName}"; // Do not modify this line, use file scripts/apply_versions.py\n', + " public const double VersionNumber = ": f" {versionCode}; // Do not modify this line, use file scripts/apply_versions.py\n", + }, + encoding="utf-8-sig", + ) + + fileReplaceLinesWith( + "src/SharedAssemblyInfo.cs", + { + '[assembly: AssemblyVersion("': f'{versionISS}")]\n', + '[assembly: AssemblyFileVersion("': f'{versionISS}")]\n', + '[assembly: AssemblyInformationalVersion("': f'{versionName}")]\n', + # Your replacement dictionary here + }, + encoding="utf-8-sig", + ) + + fileReplaceLinesWith( + "UniGetUI.iss", + { + "#define MyAppVersion": f' "{versionName}"\n', + "VersionInfoVersion=": f"{versionISS}\n", + }, + encoding="utf-8-sig", + ) + + fileReplaceLinesWith( + "src/UniGetUI/app.manifest", + { + " version=": f' "{versionISS}"\n', + }, + encoding="utf-8-sig", + ) print("done!") except FileNotFoundError as e: diff --git a/scripts/download_translations.py b/scripts/download_translations.py index 69dd7ae68..ce0cc536e 100644 --- a/scripts/download_translations.py +++ b/scripts/download_translations.py @@ -1,14 +1,14 @@ +import glob import json import os import sys import time +import zipfile + import tolgee_requests from Languages.LangData import * -import glob -import zipfile try: - root_dir = os.path.join(os.path.dirname(__file__), "..") os.chdir(root_dir) # move to root project @@ -23,13 +23,17 @@ isSomeChanges = False if len(sys.argv) > 1: - if (sys.argv[1] == "--autocommit"): + if sys.argv[1] == "--autocommit": isAutoCommit = True else: print("nocommit") print(sys.argv[1]) - os.chdir(os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Languages"))) + os.chdir( + os.path.normpath( + os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Languages") + ) + ) print() print("-------------------------------------------------------") @@ -37,10 +41,10 @@ print(" Downloading updated translations...") response = tolgee_requests.export() - if (not response.ok): + if not response.ok: statusCode = response.status_code print(f" Error {statusCode}: {response.text}") - if (statusCode == 403): + if statusCode == 403: print(" APIKEY is probably wrong!") exit(1) with open("langs.zip", "wb") as f: @@ -56,12 +60,13 @@ downloadedLanguages = [] zip_file = zipfile.ZipFile(langArchiveName) - for file in glob.glob('lang_*.json'): # If the downloaded zip file is valid, delete old language files and extract the new ones + # If the downloaded zip file is valid, delete old language files and extract the new ones + for file in glob.glob("lang_*.json"): os.remove(file) for name in zip_file.namelist(): lang = os.path.splitext(name)[0] - if (lang in languageRemap): + if lang in languageRemap: lang = languageRemap[lang] newFilename = f"lang_{lang}.json" downloadedLanguages.append(lang) @@ -73,7 +78,9 @@ except KeyError: print(type(name)) - f = input(f" The file {name} was not expected to be in here. Please write the name for the file. It should follow the following structure: lang_[CODE].json: ") + f = input( + f" The file {name} was not expected to be in here. Please write the name for the file. It should follow the following structure: lang_[CODE].json: " + ) zip_file.extract(f, "./") os.replace(f, newFilename) print(f" Extracted {f}") @@ -91,33 +98,44 @@ langCredits = {} for lang in downloadedLanguages: - with open(f"lang_{lang}.json", "r", encoding='utf-8') as f: + with open(f"lang_{lang}.json", "r", encoding="utf-8") as f: data = dict(json.load(f)) c = 0 a = 0 for key, value in data.items(): c += 1 - if (value is not None): + if value is not None: a += 1 credits = [] try: - if ("0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" in data.keys()): - credits = getTranslatorsFromCredits(data["0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry"]) + if ( + "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" + in data.keys() + ): + credits = getTranslatorsFromCredits( + data[ + "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" + ] + ) else: - credits = getTranslatorsFromCredits(data["{0} {0} {0} Contributors, please add your names/usernames separated by comas (for credit purposes)"]) + credits = getTranslatorsFromCredits( + data[ + "{0} {0} {0} Contributors, please add your names/usernames separated by comas (for credit purposes)" + ] + ) except KeyError as e: print(e) print("Can't get translator list!") langCredits[lang] = credits percNum = a / c perc = f"{percNum:.0%}" - if (perc == "100%" and percNum < 1): + if perc == "100%" and percNum < 1: perc = "99%" - if (perc == "100%" or lang == "en"): + if perc == "100%" or lang == "en": continue langPerc[lang] = perc - if (isAutoCommit): + if isAutoCommit: os.system("git add .") countOfChanges = len(os.popen("git status -s").readlines()) - countOfChanges isSomeChanges = True if countOfChanges > 0 else False @@ -133,10 +151,23 @@ # languageCredits = {json.dumps(langCredits, indent=2, ensure_ascii=False)} # """ - with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"), "w", encoding="utf-8") as f: + with open( + os.path.join( + root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json" + ), + "w", + encoding="utf-8", + ) as f: f.write(json.dumps(langCredits, indent=2, ensure_ascii=False)) - with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"), "w", encoding="utf-8") as f: + with open( + os.path.join( + root_dir, + "src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", + ), + "w", + encoding="utf-8", + ) as f: f.write(json.dumps(langPerc, indent=2, ensure_ascii=False)) # translations_filepath = os.path.normpath(os.path.join(root_dir, "UniGetUI.Core.LanguageEngine/Core/Data/Translations.py")) @@ -157,14 +188,14 @@ data = "" for line in f.readlines(): if "" in line: - data += f'{line}{getMarkdownSupportLangs()}\nLast updated: {str(time.ctime(time.time()))}\n' + data += f"{line}{getMarkdownSupportLangs()}\nLast updated: {str(time.ctime(time.time()))}\n" print(" Text modified") skip = True if "" in line: skip = False - if (not skip): + if not skip: data += line - if (isSomeChanges): + if isSomeChanges: f.seek(0) f.write(data) f.truncate() @@ -174,10 +205,10 @@ print("-------------------------------------------------------") print() - if (isAutoCommit): - if (not isSomeChanges): + if isAutoCommit: + if not isSomeChanges: os.system("git reset --hard") # prevent clean - + except Exception as e: print(e) print(e.__traceback__.tb_lineno) diff --git a/scripts/generate_json_from_excel.py b/scripts/generate_json_from_excel.py index a02e41ab6..491e0e30b 100644 --- a/scripts/generate_json_from_excel.py +++ b/scripts/generate_json_from_excel.py @@ -17,14 +17,19 @@ pass with open("screenshot_database.xlsx", "wb") as f: - f.write(urlopen("https://docs.google.com/spreadsheets/d/1Zxgzs1BiTZipC7EiwNEb9cIchistIdr5/export?format=xlsx").read()) + f.write( + urlopen( + "https://docs.google.com/spreadsheets/d/1Zxgzs1BiTZipC7EiwNEb9cIchistIdr5/export?format=xlsx" + ).read() + ) try: - workbook = xlrd.open_workbook('screenshot_database.xlsx') + workbook = xlrd.open_workbook("screenshot_database.xlsx") except: os.system("python -m pip install xlrd==1.0.0") import xlrd - workbook = xlrd.open_workbook('screenshot_database.xlsx') + + workbook = xlrd.open_workbook("screenshot_database.xlsx") worksheet = workbook.sheet_by_index(0) @@ -56,7 +61,10 @@ packagesWithScreenshot += 1 j = 2 while j < len(worksheet.row_values(i)): - if worksheet.cell_value(i, j) is None or worksheet.cell_value(i, j) == "": + if ( + worksheet.cell_value(i, j) is None + or worksheet.cell_value(i, j) == "" + ): if j == 2: packagesWithScreenshot -= 1 break @@ -65,19 +73,19 @@ j += 1 if j > 23: break - assert (type(data) == list) - assert (len(data) == 3) + assert type(data) == list + assert len(data) == 3 try: - assert (type(data[0]) == str) + assert type(data[0]) == str except AssertionError as e: if data[0] == 115.0: data[0] = "115" else: raise e - assert (type(data[1]) == str) - assert (type(data[2]) == list) + assert type(data[1]) == str + assert type(data[2]) == list if data[1] != "": - if(data[1] in forbidden_string): + if data[1] in forbidden_string: data[1] = "" else: doneCount += 1 @@ -86,12 +94,20 @@ if not data[0] in jsoncontent["icons_and_screenshots"].keys(): jsoncontent["icons_and_screenshots"][data[0]] = { "icon": data[1], - "images": data[2] + "images": data[2], } else: jsoncontent["icons_and_screenshots"][data[0]] = { - "icon": data[1] if jsoncontent["icons_and_screenshots"][data[0]]["icon"] == "" else jsoncontent["icons_and_screenshots"][data[0]]["icon"], - "images": data[2] if jsoncontent["icons_and_screenshots"][data[0]]["images"] == [] else jsoncontent["icons_and_screenshots"][data[0]]["images"] + "icon": ( + data[1] + if jsoncontent["icons_and_screenshots"][data[0]]["icon"] == "" + else jsoncontent["icons_and_screenshots"][data[0]]["icon"] + ), + "images": ( + data[2] + if jsoncontent["icons_and_screenshots"][data[0]]["images"] == [] + else jsoncontent["icons_and_screenshots"][data[0]]["images"] + ), } totalCount += 1 i += 1 @@ -107,6 +123,4 @@ with open("screenshot-database-v2.json", "w") as outfile: json.dump(jsoncontent, outfile, indent=4) - - os.system("pause") diff --git a/scripts/get_contributors.py b/scripts/get_contributors.py index 22540893d..dcf8a7fbd 100644 --- a/scripts/get_contributors.py +++ b/scripts/get_contributors.py @@ -12,20 +12,24 @@ os.system("pip install requests") import requests -response = requests.get("https://api.github.com/repos/marticliment/WingetUI/contributors?anon=1&per_page=100") +response = requests.get( + "https://api.github.com/repos/marticliment/WingetUI/contributors?anon=1&per_page=100" +) contributors = [] contributorsInfo = [] for contributor in response.json(): login = contributor.get("login", None) - if (contributor.get("type") == "User" and login): + if contributor.get("type") == "User" and login: contributors.append(login + "\n") - contributorsInfo.append({ - "name": login, - "link": contributor.get("html_url"), - "contributions": contributor.get("contributions"), - }) + contributorsInfo.append( + { + "name": login, + "link": contributor.get("html_url"), + "contributions": contributor.get("contributions"), + } + ) # output = f""" # Autogenerated file, do not modify it!!! @@ -35,7 +39,9 @@ # contributorsInfo = {json.dumps(contributorsInfo, indent=2, ensure_ascii=False)} # """ -contributors_filepath = os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.Data/Assets/Data/Contributors.list")) +contributors_filepath = os.path.normpath( + os.path.join(root_dir, "src/UniGetUI.Core.Data/Assets/Data/Contributors.list") +) with open(contributors_filepath, "w", encoding="utf-8") as f: f.writelines(contributors) diff --git a/scripts/purge_unusedtranslations.py b/scripts/purge_unusedtranslations.py index 7665a93d2..9fe1c23ec 100644 --- a/scripts/purge_unusedtranslations.py +++ b/scripts/purge_unusedtranslations.py @@ -22,7 +22,7 @@ for key in engfile.keys(): key = key.replace("\n", "\\n") if not key in contents: - if not key.replace("\"", "\\\"") in contents: + if not key.replace('"', '\\"') in contents: print(f"Unused key 😳: {key}") print("Job finished succuessfully! 😎") except Exception as e: diff --git a/scripts/tolgee_requests.py b/scripts/tolgee_requests.py index 58ab2d600..da32fa820 100644 --- a/scripts/tolgee_requests.py +++ b/scripts/tolgee_requests.py @@ -7,14 +7,12 @@ os.system("pip install requests") import requests - -__project_id = 1 # UniGetUI +__project_id = 1 # UniGetUI __api_url = f"https://tolgee.marticliment.com/v2/projects/{__project_id}" __api_key = "" __headers: dict[str, str] = {} __all_keys: dict = None - try: with open("APIKEY.txt", "r") as f: __api_key = f.read().strip() @@ -28,17 +26,16 @@ __headers["X-API-Key"] = __api_key - def check_api_key(): url = f"{__api_url}/activity" response = requests.get(url, headers=__headers) - if (not response.ok): + if not response.ok: print("Issue with API key!") print("Error", response.status_code, response.json().get("error")) exit(1) -def export(format = "JSON", zip = True, langs: list[str] = []): +def export(format="JSON", zip=True, langs: list[str] = []): url = f"{__api_url}/export" params = { "format": format, @@ -57,9 +54,7 @@ def export(format = "JSON", zip = True, langs: list[str] = []): def create_key(key): url = f"{__api_url}/keys/create" - json: dict[str, str] = { - "name": key - } + json: dict[str, str] = {"name": key} response = requests.post(url, headers=__headers, json=json) return response @@ -69,9 +64,7 @@ def get_keys(): if __all_keys: return __all_keys url = f"{__api_url}/keys" - params = { - "size": 1000 - } + params = {"size": 1000} response = requests.get(url, headers=__headers, params=params) if not response.ok: return False diff --git a/scripts/translation_commands.py b/scripts/translation_commands.py index 2655bdeec..8fa1ceabe 100644 --- a/scripts/translation_commands.py +++ b/scripts/translation_commands.py @@ -7,22 +7,31 @@ __parser = argparse.ArgumentParser() __group = __parser.add_mutually_exclusive_group(required=True) -__group.add_argument("-p", "--print", help="Print unused and not translated strings", action="store_true") -__group.add_argument("-c", "--create", help="Create not translated strings", action="store_true") -__group.add_argument("-d", "--delete", help="Delete unused strings", action="store_true") -__parser.add_argument("--online", help="Compare with Tolgee translations via API", action="store_true") +__group.add_argument( + "-p", "--print", help="Print unused and not translated strings", action="store_true" +) +__group.add_argument( + "-c", "--create", help="Create not translated strings", action="store_true" +) +__group.add_argument( + "-d", "--delete", help="Delete unused strings", action="store_true" +) +__parser.add_argument( + "--online", help="Compare with Tolgee translations via API", action="store_true" +) __parser.add_argument("-y", "--yes", help="All answers are YES", action="store_true") __args = __parser.parse_args() -def __confirm(message: str, choices: list[str], defaultValue = ""): +def __confirm(message: str, choices: list[str], defaultValue=""): + def createChoices(): _choices: list[str] = [] for key in choices: if key == defaultValue: key = key.upper() _choices.append(key) - return '/'.join(_choices) + return "/".join(_choices) try: return (input(f"{message} [{createChoices()}]: ") or defaultValue).lower() @@ -30,7 +39,7 @@ def createChoices(): exit(1) -def encode_str(str: str, strip = 0): +def encode_str(str: str, strip=0): new_str = str if strip > 0: new_str = str[:strip].strip() @@ -47,7 +56,7 @@ def create(strs: list[str]): continue print("Creating key... ", end="") response = tolgee_requests.create_key(key) - if (not response.ok): + if not response.ok: print("Failed") print("Error", response.status_code, response.text) return @@ -67,7 +76,7 @@ def delete(strs: list[str]): continue print("Deleting key... ", end="") response = tolgee_requests.delete_key(key) - if (not response.ok): + if not response.ok: print("Failed") print("Error", response.status_code, response.text) return @@ -83,7 +92,11 @@ def __print(strs: list[str]): def __print_all(): - output = json.dumps(translation_utils.compare_strings(online=__args.online), ensure_ascii=False, indent=" ") + output = json.dumps( + translation_utils.compare_strings(online=__args.online), + ensure_ascii=False, + indent=" ", + ) print(output) diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index 563c42088..0b439a4be 100644 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -7,7 +7,6 @@ root_dir = os.path.join(os.path.dirname(__file__), "..") os.chdir(os.path.join(root_dir, "src/UniGetUI/")) - __blacklist_strings = [ "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry", ] @@ -16,9 +15,9 @@ # Function to remove special characters from a string def remove_special_chars(string): # Regular expression for special characters (excluding letters and digits) - special_chars = r'[^a-zA-Z0-9]' + special_chars = r"[^a-zA-Z0-9]" # Use regular expression to remove special characters from the string - return re.sub(special_chars, '', string) + return re.sub(special_chars, "", string) def get_all_strings(): @@ -27,50 +26,144 @@ def get_all_strings(): # Find c# translation strings regex1 = r'(?<=Translate\(["\']).+?(?=["\']\))' regex2 = r'(?<=AutoTranslated\(["\']).+?(?=["\']\))' - for (dirpath, _dirnames, filenames) in os.walk(".", topdown=True): + for dirpath, _dirnames, filenames in os.walk(".", topdown=True): for file in filenames: _file_name, file_ext = os.path.splitext(file) - if (file_ext != ".cs"): + if file_ext != ".cs": continue with open(os.path.join(dirpath, file), "r", encoding="utf-8") as f: file_data = f.read() matches: list[str] = re.findall(regex1, file_data) for match in matches: - translation_strings.append(match.encode('raw_unicode_escape').decode('unicode_escape')) + translation_strings.append( + match.encode("raw_unicode_escape").decode("unicode_escape") + ) matches: list[str] = re.findall(regex2, file_data) for match in matches: - translation_strings.append(match.encode('raw_unicode_escape').decode('unicode_escape')) + translation_strings.append( + match.encode("raw_unicode_escape").decode("unicode_escape") + ) # Find XAML translation strings MAIN_WILDCARD = r'(?:x:|"&#x[a-zA-Z0-9]{4};"|[ a-zA-Z0-9=\"\'\r\n\t_\.\,\:\;\{\}])' regex_data = { - r'(?<=Translate\(["\']).+?(?=["\']\))': lambda match: match.encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:TranslatedTextBlock' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:ButtonCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:ButtonCard' + MAIN_WILDCARD + r'+ButtonText=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" ButtonText=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:CheckboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:ComboboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:BetterMenuItem' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:NavButton' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:SettingsEntry' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:SettingsEntry' + MAIN_WILDCARD + r'+UnderText=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" UnderText=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:SourceManager' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:TextboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), - r'<[a-zA-Z0-9]+:TextboxCard' + MAIN_WILDCARD + r'+Placeholder=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Placeholder=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'(?<=Translate\(["\']).+?(?=["\']\))': lambda match: match.encode( + "raw_unicode_escape" + ).decode("unicode_escape"), + r"<[a-zA-Z0-9]+:TranslatedTextBlock" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:ButtonCard" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:ButtonCard" + + MAIN_WILDCARD + + r'+ButtonText=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' ButtonText="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:CheckboxCard" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:ComboboxCard" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:BetterMenuItem" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:NavButton" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:SettingsEntry" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:SettingsEntry" + + MAIN_WILDCARD + + r'+UnderText=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' UnderText="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:SourceManager" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:TextboxCard" + + MAIN_WILDCARD + + r'+Text=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Text="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), + r"<[a-zA-Z0-9]+:TextboxCard" + + MAIN_WILDCARD + + r'+Placeholder=["\'].+["\']' + + MAIN_WILDCARD + + r"*\/?>": lambda match: match.split(' Placeholder="')[1] + .split('"')[0] + .encode("raw_unicode_escape") + .decode("unicode_escape"), } for regex in regex_data.keys(): - for (dirpath, _dirnames, filenames) in os.walk(".", topdown=True): + for dirpath, _dirnames, filenames in os.walk(".", topdown=True): for file in filenames: _file_name, file_ext = os.path.splitext(file) - if (file_ext != ".xaml"): + if file_ext != ".xaml": continue with open(os.path.join(dirpath, file), "r", encoding="utf-8") as f: matches: list[str] = re.findall(regex, f.read()) for match in matches: - translation_strings.append(regex_data[regex](match.replace("\n", " ").replace("\t", " "))) + translation_strings.append( + regex_data[regex]( + match.replace("\n", " ").replace("\t", " ") + ) + ) translation_strings = list(set(translation_strings)) # uniq translation_strings.sort(key=lambda x: (remove_special_chars(x.lower()), x)) @@ -92,16 +185,16 @@ def compare_strings(online=False): not_used: list[str] = [] translation_obj: dict[str, str] = {} lang_strings: dict[str, str] = {} - if (online): + if online: lang_strings = get_all_translations_online() else: lang_strings = get_all_translations() for key in get_all_strings(): translation_obj[key] = "" for key in lang_strings.keys(): - if (key in __blacklist_strings): + if key in __blacklist_strings: continue - if (key in translation_obj): + if key in translation_obj: del translation_obj[key] else: not_used.append(key) diff --git a/scripts/verify_translations.py b/scripts/verify_translations.py index 3a0c9ffae..7c2711686 100644 --- a/scripts/verify_translations.py +++ b/scripts/verify_translations.py @@ -1,35 +1,43 @@ -import os, sys, glob, re +import glob +import os +import re +import sys + def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) + try: - sys.stdout.reconfigure(encoding='utf-8') + sys.stdout.reconfigure(encoding="utf-8") Correct = True - + os.chdir(os.path.dirname(__file__)) os.chdir("../src/UniGetUI.Core.LanguageEngine/Assets/Languages") for FILE in glob.glob("./lang_*.json"): with open(FILE, "r", encoding="utf-8") as f: - # print(f"Begin analyzing file {FILE}") - + for LINE in f.readlines(): - LINE = LINE.replace('\\"', '\'') - - if len(LINE) <= 2 or LINE.removesuffix("\n").removesuffix(",").endswith("null"): + LINE = LINE.replace('\\"', "'") + + if len(LINE) <= 2 or LINE.removesuffix("\n").removesuffix(",").endswith( + "null" + ): continue - + results = re.match(r'^ +"([^"]+)" ?: ?"([^"]+)"', LINE) - BASE, COMPARE = results[1],results[2] - - for find in re.findall(r'{[a-zA-Z0-9]+}', BASE): + BASE, COMPARE = results[1], results[2] + + for find in re.findall(r"{[a-zA-Z0-9]+}", BASE): if BASE.count(find) > COMPARE.count(find): Correct = False - print(f"Faulting line on file {FILE}, missing key is {find} on translation \"{BASE}\", with translation {COMPARE}") - + print( + f'Faulting line on file {FILE}, missing key is {find} on translation "{BASE}", with translation {COMPARE}' + ) + sys.exit(0 if Correct else 1) - + except Exception as e: print(e) - input("Press to close...") \ No newline at end of file + input("Press to close...") diff --git a/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs b/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs index 1c5f883ae..0a8311fad 100644 --- a/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs +++ b/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs @@ -1,5 +1,5 @@ -using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Classes; @@ -11,4 +11,4 @@ namespace ExternalLibraries.Pickers.Classes; Guid(CLSIDGuid.FileOpenDialog)] internal class FileOpenDialogRCW { -} \ No newline at end of file +} diff --git a/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs b/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs index 40a15914e..76f99e6bd 100644 --- a/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs +++ b/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs @@ -1,5 +1,5 @@ -using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Classes; diff --git a/src/ExternalLibraries.FilePickers/Classes/Helper.cs b/src/ExternalLibraries.FilePickers/Classes/Helper.cs index 840d546bd..5bb7652a8 100644 --- a/src/ExternalLibraries.FilePickers/Classes/Helper.cs +++ b/src/ExternalLibraries.FilePickers/Classes/Helper.cs @@ -1,7 +1,7 @@ -using ExternalLibraries.Pickers.Enums; +using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Enums; using ExternalLibraries.Pickers.Interfaces; using ExternalLibraries.Pickers.Structures; -using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Classes; diff --git a/src/ExternalLibraries.FilePickers/Enums/FDAP.cs b/src/ExternalLibraries.FilePickers/Enums/FDAP.cs index c6347e932..ff698114e 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDAP.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDAP.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fdap internal enum FDAP diff --git a/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs b/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs index 011f2bdaa..330481374 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_overwrite_response internal enum FDE_OVERWRITE_RESPONSE diff --git a/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs b/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs index 71fb59290..8d513a04b 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_shareviolation_response internal enum FDE_SHAREVIOLATION_RESPONSE diff --git a/src/ExternalLibraries.FilePickers/Enums/FOS.cs b/src/ExternalLibraries.FilePickers/Enums/FOS.cs index 5504ea162..d2e3dc0ad 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FOS.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FOS.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; [Flags] // https://learn.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions diff --git a/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs b/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs index 2bbc83dbf..e64edf6d8 100644 --- a/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs +++ b/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; internal enum HRESULT : long { diff --git a/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs b/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs index 0b2456d0d..c7ae4356d 100644 --- a/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs +++ b/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sigdn internal enum SIGDN : uint diff --git a/src/ExternalLibraries.FilePickers/FileOpenPicker.cs b/src/ExternalLibraries.FilePickers/FileOpenPicker.cs index 0f86c05da..365e393a4 100644 --- a/src/ExternalLibraries.FilePickers/FileOpenPicker.cs +++ b/src/ExternalLibraries.FilePickers/FileOpenPicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/FileSavePicker.cs b/src/ExternalLibraries.FilePickers/FileSavePicker.cs index 4f68bcf5a..5de2d7441 100644 --- a/src/ExternalLibraries.FilePickers/FileSavePicker.cs +++ b/src/ExternalLibraries.FilePickers/FileSavePicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/FolderPicker.cs b/src/ExternalLibraries.FilePickers/FolderPicker.cs index 0642f9e2a..f24121723 100644 --- a/src/ExternalLibraries.FilePickers/FolderPicker.cs +++ b/src/ExternalLibraries.FilePickers/FolderPicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs index 228f4ed35..0e42f3115 100644 --- a/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class CLSIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs index a0f187807..22e824da8 100644 --- a/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class IIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs index b51f3740d..a959a87c6 100644 --- a/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class KFIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs index 019c7fdc3..5c9c23b04 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs @@ -1,6 +1,6 @@ -using ExternalLibraries.Pickers.Classes; -using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; @@ -14,4 +14,4 @@ namespace ExternalLibraries.Pickers.Interfaces; CoClass(typeof(FileOpenDialogRCW))] internal interface FileOpenDialog : IFileOpenDialog { -} \ No newline at end of file +} diff --git a/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs index 2d0c13e43..e27a741ac 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs @@ -1,6 +1,6 @@ -using ExternalLibraries.Pickers.Classes; -using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs index cf174c172..12ef55dd9 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs @@ -1,8 +1,8 @@ -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; -using ExternalLibraries.Pickers.Structures; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; +using ExternalLibraries.Pickers.Structures; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs index c126331cb..983b96626 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs @@ -1,7 +1,7 @@ -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs index d3fa50f96..3740df495 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs @@ -1,7 +1,7 @@ -using ExternalLibraries.Pickers.Guids; -using ExternalLibraries.Pickers.Structures; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Guids; +using ExternalLibraries.Pickers.Structures; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs b/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs index a1898c881..7c168475a 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs @@ -1,6 +1,6 @@ -using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs b/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs index cc57899f2..186a51f8f 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs @@ -1,7 +1,7 @@ -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs b/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs index aca6f5307..224119780 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs @@ -1,8 +1,8 @@ -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; -using ExternalLibraries.Pickers.Structures; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; +using ExternalLibraries.Pickers.Structures; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs b/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs index 2fa3b3110..aa5d8278c 100644 --- a/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs +++ b/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Structures; diff --git a/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs b/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs index dbb1a5ab4..3729e2841 100644 --- a/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs +++ b/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Structures; diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index a54efa090..8d9d67339 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.Versioning; [assembly: AssemblyProduct("UniGetUI")] diff --git a/src/UniGetUI.Core.Classes.Tests/PersonTests.cs b/src/UniGetUI.Core.Classes.Tests/PersonTests.cs index 607dbeaac..ef605b262 100644 --- a/src/UniGetUI.Core.Classes.Tests/PersonTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/PersonTests.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes.Tests +namespace UniGetUI.Core.Classes.Tests { public class PersonTests { diff --git a/src/UniGetUI.Core.Classes/IIndexableListItem.cs b/src/UniGetUI.Core.Classes/IIndexableListItem.cs index 76856aab6..5e7b20dee 100644 --- a/src/UniGetUI.Core.Classes/IIndexableListItem.cs +++ b/src/UniGetUI.Core.Classes/IIndexableListItem.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes +namespace UniGetUI.Core.Classes { public interface IIndexableListItem { diff --git a/src/UniGetUI.Core.Classes/Person.cs b/src/UniGetUI.Core.Classes/Person.cs index 6e5996f4d..3e95209cf 100644 --- a/src/UniGetUI.Core.Classes/Person.cs +++ b/src/UniGetUI.Core.Classes/Person.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes +namespace UniGetUI.Core.Classes { public readonly struct Person { diff --git a/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs b/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs index 9fd992549..fbdc99839 100644 --- a/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs +++ b/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Data.Tests +namespace UniGetUI.Core.Data.Tests { public class ContributorsTests { diff --git a/src/UniGetUI.Core.Data.Tests/CoreTests.cs b/src/UniGetUI.Core.Data.Tests/CoreTests.cs index 8f3c41ee4..b5f9746a9 100644 --- a/src/UniGetUI.Core.Data.Tests/CoreTests.cs +++ b/src/UniGetUI.Core.Data.Tests/CoreTests.cs @@ -1,15 +1,15 @@ -namespace UniGetUI.Core.Data.Tests +namespace UniGetUI.Core.Data.Tests { public class CoreTests { public static object[][] Data => [ [CoreData.UniGetUIDataDirectory], - [CoreData.UniGetUIInstallationOptionsDirectory ], - [CoreData.UniGetUICacheDirectory_Data ], - [CoreData.UniGetUICacheDirectory_Icons ], - [CoreData.UniGetUICacheDirectory_Lang ], - [CoreData.UniGetUI_DefaultBackupDirectory ] + [CoreData.UniGetUIInstallationOptionsDirectory], + [CoreData.UniGetUICacheDirectory_Data], + [CoreData.UniGetUICacheDirectory_Icons], + [CoreData.UniGetUICacheDirectory_Lang], + [CoreData.UniGetUI_DefaultBackupDirectory] ]; [Theory] diff --git a/src/UniGetUI.Core.Data.Tests/LicensesTest.cs b/src/UniGetUI.Core.Data.Tests/LicensesTest.cs index ebb8c41e4..2fa4ec8b1 100644 --- a/src/UniGetUI.Core.Data.Tests/LicensesTest.cs +++ b/src/UniGetUI.Core.Data.Tests/LicensesTest.cs @@ -35,4 +35,4 @@ public void EnsureHomepageUrlsExist() } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.Data/Contributors.cs b/src/UniGetUI.Core.Data/Contributors.cs index cd274d57b..d6aac52f5 100644 --- a/src/UniGetUI.Core.Data/Contributors.cs +++ b/src/UniGetUI.Core.Data/Contributors.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Data +namespace UniGetUI.Core.Data { public static class ContributorsData { diff --git a/src/UniGetUI.Core.Data/CoreData.cs b/src/UniGetUI.Core.Data/CoreData.cs index 6c2d3a9bc..3a2b5ad2a 100644 --- a/src/UniGetUI.Core.Data/CoreData.cs +++ b/src/UniGetUI.Core.Data/CoreData.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Net; using UniGetUI.Core.Logging; @@ -34,8 +34,8 @@ private static int GetCodePage() } } - public const string VersionName = "3.1.1"; // Do not modify this line, use file scripts/apply_versions.py - public const double VersionNumber = 3.11; // Do not modify this line, use file scripts/apply_versions.py + public const string VersionName = "3.1.1"; // Do not modify this line, use file scripts/apply_versions.py + public const double VersionNumber = 3.11; // Do not modify this line, use file scripts/apply_versions.py public const string UserAgentString = $"UniGetUI/{VersionName} (https://marticliment.com/unigetui/; contact@marticliment.com)"; diff --git a/src/UniGetUI.Core.Data/Licenses.cs b/src/UniGetUI.Core.Data/Licenses.cs index 076bfb8ab..52a4b6b59 100644 --- a/src/UniGetUI.Core.Data/Licenses.cs +++ b/src/UniGetUI.Core.Data/Licenses.cs @@ -2,91 +2,94 @@ namespace UniGetUI.Core.Data { public static class LicenseData { - public static Dictionary LicenseNames = new() { - {"UniGetUI", "MIT" }, + public static Dictionary LicenseNames = new() + { + { "UniGetUI", "MIT" }, // C# Libraries - {"Pickers", "MIT"}, - {"Community Toolkit", "MIT"}, - {"H.NotifyIcon", "MIT"}, - {"Windows App Sdk", "MIT"}, - {"NancyFx", "MIT"}, - {"YamlDotNet", "MIT"}, - {"InnoDependencyInstaller", "CPOL 1.02" }, + { "Pickers", "MIT" }, + { "Community Toolkit", "MIT" }, + { "H.NotifyIcon", "MIT" }, + { "Windows App Sdk", "MIT" }, + { "NancyFx", "MIT" }, + { "YamlDotNet", "MIT" }, + { "InnoDependencyInstaller", "CPOL 1.02" }, // Package managers and related - {"Winget", "MIT"}, - {"Scoop", "MIT"}, - {"scoop-search", "MIT"}, - {"Chocolatey", "Apache v2"}, - {"Npm", "Artistic License 2.0"}, - {"Pip", "MIT"}, - {"parse_pip_search", "MIT"}, - {"PowerShell Gallery", "Unknown"}, - {".NET Sdk", "MIT"}, - {"dotnet-tools-outdated", "MIT"}, + { "Winget", "MIT" }, + { "Scoop", "MIT" }, + { "scoop-search", "MIT" }, + { "Chocolatey", "Apache v2" }, + { "Npm", "Artistic License 2.0" }, + { "Pip", "MIT" }, + { "parse_pip_search", "MIT" }, + { "PowerShell Gallery", "Unknown" }, + { ".NET Sdk", "MIT" }, + { "dotnet-tools-outdated", "MIT" }, // Other - {"Gsudo", "MIT"}, - {"Icons", "By Icons8"}, + { "Gsudo", "MIT" }, + { "Icons", "By Icons8" }, }; - public static Dictionary LicenseURLs = new(){ - {"UniGetUI", new Uri("https://github.com/marticliment/WingetUI/blob/main/LICENSE")}, + public static Dictionary LicenseURLs = new() + { + { "UniGetUI", new Uri("https://github.com/marticliment/WingetUI/blob/main/LICENSE") }, // 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")}, - {"Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/blob/main/LICENSE")}, - {"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") }, + { "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") }, + { "Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/blob/main/LICENSE") }, + { "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")}, - {"scoop-search", new Uri("https://github.com/shilangyu/scoop-search/blob/master/LICENSE")}, - {"Chocolatey", new Uri("https://github.com/chocolatey/choco/blob/develop/LICENSE")}, - {"Npm", new Uri("https://github.com/npm/cli/blob/latest/LICENSE")}, - {"Pip", new Uri("https://github.com/pypa/pip/blob/main/LICENSE.txt")}, - {"parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md")}, - {".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/")}, + { "Winget", new Uri("https://github.com/microsoft/winget-cli/blob/master/LICENSE") }, + { "Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE") }, + { "scoop-search", new Uri("https://github.com/shilangyu/scoop-search/blob/master/LICENSE") }, + { "Chocolatey", new Uri("https://github.com/chocolatey/choco/blob/develop/LICENSE") }, + { "Npm", new Uri("https://github.com/npm/cli/blob/latest/LICENSE") }, + { "Pip", new Uri("https://github.com/pypa/pip/blob/main/LICENSE.txt") }, + { "parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md") }, + { ".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 - {"Gsudo", new Uri("https://github.com/gerardog/gsudo/blob/master/LICENSE.txt")}, - {"Icons", new Uri("https://icons8.com/license")}, + { "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")}, + 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/")}, - {"H.NotifyIcon", new Uri("https://github.com/HavenDV/H.NotifyIcon/")}, - {"Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/")}, - {"NancyFx", new Uri("https://github.com/NancyFx/Nancy/")}, - {"YamlDotNet", new Uri("https://github.com/aaubry/YamlDotNet/") }, - {"InnoDependencyInstaller", new Uri("https://github.com/DomGries/InnoDependencyInstaller")}, + { "Pickers", new Uri("https://github.com/PavlikBender/Pickers/") }, + { "Community Toolkit", new Uri("https://github.com/CommunityToolkit/Windows/") }, + { "H.NotifyIcon", new Uri("https://github.com/HavenDV/H.NotifyIcon/") }, + { "Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/") }, + { "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/")}, - {"scoop-search", new Uri("https://github.com/shilangyu/scoop-search/")}, - {"Chocolatey", new Uri("https://github.com/chocolatey/choco/")}, - {"Npm", new Uri("https://github.com/npm/cli/")}, - {"Pip", new Uri("https://github.com/pypa/pip/")}, - {"parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/")}, - {".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/")}, + { "Winget", new Uri("https://github.com/microsoft/winget-cli/") }, + { "Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/") }, + { "scoop-search", new Uri("https://github.com/shilangyu/scoop-search/") }, + { "Chocolatey", new Uri("https://github.com/chocolatey/choco/") }, + { "Npm", new Uri("https://github.com/npm/cli/") }, + { "Pip", new Uri("https://github.com/pypa/pip/") }, + { "parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/") }, + { ".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 - {"Gsudo", new Uri("https://github.com/gerardog/gsudo/")}, - {"Icons", new Uri("https://icons8.com")}, + { "Gsudo", new Uri("https://github.com/gerardog/gsudo/") }, + { "Icons", new Uri("https://icons8.com") }, }; } diff --git a/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs b/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs index 486e34f83..e5f8a0bab 100644 --- a/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs +++ b/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs @@ -45,4 +45,4 @@ public async Task TestGetNonExistingIconAndImagesAsync() Assert.Empty(nonexistent_screenshots); } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.IconStore/Serializable.cs b/src/UniGetUI.Core.IconStore/Serializable.cs index 543fa263c..23ec7b04f 100644 --- a/src/UniGetUI.Core.IconStore/Serializable.cs +++ b/src/UniGetUI.Core.IconStore/Serializable.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.IconEngine +namespace UniGetUI.Core.IconEngine { internal struct IconScreenshotDatabase_v2 { diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs index 81631d31c..36613ad5d 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs @@ -153,8 +153,11 @@ public static class CommonTranslations public static readonly Dictionary ScopeNames_NonLang = new() { - { PackageScope.Global, "mac" + - "hine" }, + { + PackageScope.Global, + "mac" + + "hine" + }, { PackageScope.Local, "user" }, }; diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs index 953a6f1f6..e371e0963 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs @@ -1,7 +1,7 @@ -using Jeffijoe.MessageFormat; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.Json.Nodes; +using Jeffijoe.MessageFormat; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs b/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs index 568f12031..d04bc0f74 100644 --- a/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs +++ b/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs @@ -34,4 +34,4 @@ public async Task TestLogEntry() Assert.True(logEntry2.Time < logEntry3.Time); } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs index f884422a5..2a7a65ee3 100644 --- a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs +++ b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs @@ -65,4 +65,4 @@ public void TestValueSettings(string SettingName, string st1, string st2, string Assert.False(File.Exists(Path.Join(CoreData.UniGetUIDataDirectory, SettingName))); } } -} \ No newline at end of file +} diff --git a/src/UniGetUI.Core.Structs/Person.cs b/src/UniGetUI.Core.Structs/Person.cs index 813cc6dac..b93457a68 100644 --- a/src/UniGetUI.Core.Structs/Person.cs +++ b/src/UniGetUI.Core.Structs/Person.cs @@ -1,4 +1,4 @@ -using System.Collections.Specialized; +using System.Collections.Specialized; namespace UniGetUI.Core.Structs { diff --git a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs index 0373cadf4..07bdb5b8f 100644 --- a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs +++ b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs @@ -1,6 +1,6 @@ +using System.Text; using Nancy; using Nancy.Hosting.Self; -using System.Text; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs index ab66b2cb0..1be5a5b38 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs @@ -1,5 +1,5 @@ -using UniGetUI.PackageEngine.Interfaces; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Interfaces; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { diff --git a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs index 31cabb9a1..fb12439cc 100644 --- a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs +++ b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { diff --git a/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs b/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs index e9f349a50..4fd2cbc3a 100644 --- a/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.ManagerLogger @@ -46,27 +46,27 @@ public void AddStdoutLine(string? line) { if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); if (line != null) - StdOut.Add(line); + StdOut.Add(line); } public void AddStdoutLines(IEnumerable lines) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - foreach (string line in lines) + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + foreach (string line in lines) StdOut.Add(line); } public void AddStderrLine(string? line) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - if (line != null) - StdErr.Add(line); + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + if (line != null) + StdErr.Add(line); } public void AddStderrLines(IEnumerable lines) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - foreach (string line in lines) + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + foreach (string line in lines) StdErr.Add(line); } @@ -78,7 +78,7 @@ public void End() Logger.LoadOperation(this); } } - + PackageManager Manager; List Operations = new(); @@ -95,7 +95,7 @@ private void LoadOperation(OperationLog operation) public OperationLog CreateOperationLog(OperationType type, Process process) { - if (process.StartInfo == null) + if (process.StartInfo == null) throw new Exception("Process instance did not have a valid StartInfo value"); return new OperationLog(this, type, process.StartInfo.FileName, process.StartInfo.Arguments); diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs index f75459487..2d5700735 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs @@ -4,16 +4,16 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.Chocolatey; using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.ChocolateyManager { @@ -63,7 +63,7 @@ public Chocolatey() PackageDetailsProvider = new ChocolateyDetailsProvider(this); OperationProvider = new ChocolateyOperationProvider(this); } - + protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs index c16e211f6..2900f1069 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs @@ -29,7 +29,7 @@ protected override async Task GetPackageVersions_Unsafe(IPackage packa } }; - IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.LoadPackageVersions, p); + IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.LoadPackageVersions, p); p.Start(); diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs index d785a4b7f..7eed9ba6a 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs @@ -20,7 +20,8 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -34,7 +35,7 @@ public override IEnumerable GetOperationParameters( if (options.InteractiveInstallation) parameters.Add("--notsilent"); - if(operation is OperationType.Install or OperationType.Update) + if (operation is OperationType.Install or OperationType.Update) { parameters.Add("--no-progress"); @@ -61,7 +62,7 @@ public override OperationVeredict GetOperationResult( IEnumerable processOutput, int returnCode) { - if(returnCode is 3010) + if (returnCode is 3010) { return OperationVeredict.RestartRequired; } @@ -76,7 +77,7 @@ public override OperationVeredict GetOperationResult( if (!options.RunAsAdministrator && (output_string.Contains("Run as administrator") || output_string.Contains("The requested operation requires elevation") - || output_string.Contains("ERROR: Exception calling \"CreateDirectory\" with \"1\" argument(s): \"Access to the path")) ) + || output_string.Contains("ERROR: Exception calling \"CreateDirectory\" with \"1\" argument(s): \"Access to the path"))) { options.RunAsAdministrator = true; return OperationVeredict.AutoRetry; diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs index 4dffb8208..9c57aa1f9 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs @@ -2,16 +2,16 @@ using System.Runtime.InteropServices; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.DotNetManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs index 460a5ceef..a43c8290f 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs @@ -21,7 +21,8 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs index ce3f49228..4184c95fb 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs @@ -60,10 +60,10 @@ protected sealed override async Task FindPackages_UnSafe(string query } else { - sources = [ Properties.DefaultSource ]; + sources = [Properties.DefaultSource]; } - - foreach(IManagerSource source in sources) + + 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}"); diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs index 3eb5ee522..05f80f589 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs @@ -1,13 +1,13 @@ using System.Diagnostics; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.NpmManager { @@ -46,7 +46,7 @@ public Npm() PackageDetailsProvider = new NpmPackageDetailsProvider(this); OperationProvider = new NpmOperationProvider(this); } - + protected override async Task FindPackages_UnSafe(string query) { Process p = new() diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs index 60b0370ed..2aa47cffa 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs @@ -17,8 +17,9 @@ public NpmOperationProvider(Npm manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = operation switch { - OperationType.Install => [Manager.Properties.InstallVerb, $"{package.Id}@{(options.Version == string.Empty? package.Version: options.Version)}"], + List parameters = operation switch + { + OperationType.Install => [Manager.Properties.InstallVerb, $"{package.Id}@{(options.Version == string.Empty ? package.Version : options.Version)}"], OperationType.Update => [Manager.Properties.UpdateVerb, $"{package.Id}@{package.NewVersion}"], OperationType.Uninstall => [Manager.Properties.UninstallVerb, package.Id], _ => throw new InvalidDataException("Invalid package operation") diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs index 4aa818b22..1d37ada62 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; @@ -47,7 +47,7 @@ public Pip() PackageDetailsProvider = new PipPackageDetailsProvider(this); OperationProvider = new PipOperationProvider(this); } - + protected override async Task FindPackages_UnSafe(string query) { List Packages = []; diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs index 7d842f166..e1630f72d 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs @@ -20,14 +20,15 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, _ => throw new InvalidDataException("Invalid package operation") }]; parameters.AddRange([ - options.Version != string.Empty? $"{package.Id}=={options.Version}" : package.Id, + options.Version != string.Empty ? $"{package.Id}=={options.Version}" : package.Id, "--no-input", "--no-color", "--no-python-version-warning", diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs index 2e783d452..ed032710b 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs @@ -2,8 +2,8 @@ using System.Text; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; @@ -81,24 +81,25 @@ protected override async Task GetAvailableUpdates_UnSafe() string command = """ function Test-GalleryModuleUpdate { - param ( - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository, + param( + + [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [version] $Version, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Repository, [switch] $NeedUpdateOnly ) process { - $URLs = @{} - @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) - $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -Maximum 0 -ea Ignore - [version]$latest = Split-Path -Path ($page.Headers.Location -replace "$Name." -replace ".nupkg") -Leaf - $needsupdate = $Latest -gt $Version + $URLs = @{ } + @(Get - PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) + $page = Invoke - WebRequest - Uri($URLs[$Repository] + "/package/$Name") - UseBasicParsing - Maximum 0 - ea Ignore + [version]$latest = Split - Path - Path($page.Headers.Location - replace "$Name." - replace ".nupkg") - Leaf + $needsupdate = $Latest - gt $Version if ($needsupdate) { - Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) + Write - Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) } - } } - Get-InstalledModule | Test-GalleryModuleUpdate + } + Get - InstalledModule | Test - GalleryModuleUpdate exit diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs index 72f79d62b..4a17337c2 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs @@ -16,7 +16,8 @@ public PowerShellOperationProvider(PowerShell manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -27,7 +28,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn if (options.CustomParameters != null) parameters.AddRange(options.CustomParameters); - if(operation is not OperationType.Uninstall) + if (operation is not OperationType.Uninstall) { if (options.PreRelease) parameters.Add("-AllowPrerelease"); @@ -39,7 +40,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["-Scope", "CurrentUser"]); } - if(operation is OperationType.Install) + if (operation is OperationType.Install) { if (options.SkipHashCheck) parameters.Add("-SkipPublisherCheck"); diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs index f0c11f363..52f836f02 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs @@ -82,24 +82,25 @@ protected override async Task GetAvailableUpdates_UnSafe() string command = """ function Test-GalleryModuleUpdate { - param ( - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository, + param( + + [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [version] $Version, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Repository, [switch] $NeedUpdateOnly ) process { - $URLs = @{} - @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) - $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -ea Ignore - [version]$latest = Split-Path -Path ($page.BaseResponse.RequestMessage.RequestUri -replace "$Name." -replace ".nupkg") -Leaf - $needsupdate = $Latest -gt $Version + $URLs = @{ } + @(Get - PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) + $page = Invoke - WebRequest - Uri($URLs[$Repository] + "/package/$Name") - UseBasicParsing - ea Ignore + [version]$latest = Split - Path - Path($page.BaseResponse.RequestMessage.RequestUri - replace "$Name." - replace ".nupkg") - Leaf + $needsupdate = $Latest - gt $Version if ($needsupdate) { - Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) + Write - Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) } - } } - Get-InstalledModule | Test-GalleryModuleUpdate + } + Get - InstalledModule | Test - GalleryModuleUpdate exit diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs index e166c7bd4..983cce00b 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs @@ -16,7 +16,8 @@ public PowerShell7OperationProvider(PowerShell7 manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -27,7 +28,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn if (options.CustomParameters != null) parameters.AddRange(options.CustomParameters); - if(operation is not OperationType.Uninstall) + if (operation is not OperationType.Uninstall) { if (options.PreRelease) parameters.Add("-AllowPrerelease"); @@ -39,7 +40,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["-Scope", "CurrentUser"]); } - if(operation is OperationType.Install) + if (operation is OperationType.Install) { if (options.SkipHashCheck) parameters.Add("-SkipPublisherCheck"); diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs index 0afd8efa3..41ab46f6d 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs @@ -16,7 +16,8 @@ public ScoopOperationProvider(Scoop manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -30,7 +31,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.Add("--global"); } - if(options.CustomParameters is not null) + if (options.CustomParameters is not null) parameters.AddRange(options.CustomParameters); if (operation is OperationType.Uninstall) diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs index c6f711372..3d2d71ede 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs @@ -4,15 +4,15 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.ScoopManager { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs index 861e85015..8814c121a 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs @@ -17,7 +17,8 @@ public WinGetOperationProvider(WinGet manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch { + List parameters = [operation switch + { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -28,7 +29,8 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["--accept-source-agreements", "--disable-interactivity"]); // package.Scope is meaningless in WinGet packages. Default is unspecified, hence the _ => []. - parameters.AddRange(options.InstallationScope switch { + parameters.AddRange(options.InstallationScope switch + { PackageScope.User => ["--scope", "user"], PackageScope.Machine => ["--scope", "machine"], _ => [] @@ -47,7 +49,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(options.CustomParameters); - if(operation is OperationType.Update) + if (operation is OperationType.Update) { if (package.Name.Contains("64-bit") || package.Id.ToLower().Contains("x64")) { @@ -60,7 +62,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.Add("--include-unknown"); } - if(operation is not OperationType.Uninstall) + if (operation is not OperationType.Uninstall) { parameters.AddRange(["--accept-package-agreements", "--force"]); @@ -105,7 +107,7 @@ public override OperationVeredict GetOperationResult(IPackage package, IInstalla return OperationVeredict.Succeeded; } - if(uintCode == 0x8A150056 && options.RunAsAdministrator && !CoreTools.IsAdministrator()) + if (uintCode == 0x8A150056 && options.RunAsAdministrator && !CoreTools.IsAdministrator()) { // Installer can't run elevated options.RunAsAdministrator = false; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs index ccb03eb35..979181d03 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs @@ -5,15 +5,15 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.WingetManager { @@ -71,7 +71,7 @@ public WinGet() p.StandardInput.Close(); await p.WaitForExitAsync(); return p.ExitCode == 0; - }) + }) ]; Capabilities = new ManagerCapabilities @@ -107,8 +107,8 @@ public WinGet() UninstallVerb = "uninstall", UpdateVerb = "update", ExecutableCallArgs = "", - KnownSources = [ new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")), - new ManagerSource(this, "msstore", new Uri("https://storeedgefd.dsx.mp.microsoft.com/v9.0")) ], + KnownSources = [new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")), + new ManagerSource(this, "msstore", new Uri("https://storeedgefd.dsx.mp.microsoft.com/v9.0"))], DefaultSource = new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")) }; @@ -157,7 +157,7 @@ public ManagerSource GetLocalSource(string id) } // Check if source is android - if(MeaningfulId.Count(x => x == '.') >= 2 && MeaningfulId.All(c => (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.')) + if (MeaningfulId.Count(x => x == '.') >= 2 && MeaningfulId.All(c => (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.')) { return AndroidSubsystemSource; } diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs index ecfba14c5..fb20a95cb 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs @@ -46,26 +46,27 @@ public async Task GetAvailableUpdates_UnSafe(WinGet Manager) p.Start(); string command = """ - Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version - Import-Module Microsoft.WinGet.Client - function Print-WinGetPackage { - param ( - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $InstalledVersion, + Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version + Import - Module Microsoft.WinGet.Client + function Print - WinGetPackage { + param( + + [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $InstalledVersion, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - if ($IsUpdateAvailable) + if ($IsUpdateAvailable) { - Write-Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $AvailableVersions[0] + "`t" + $Source) + Write - Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $AvailableVersions[0] + "`t" + $Source) } - } - } + } + } - Get-WinGetPackage | Print-WinGetPackage + Get - WinGetPackage | Print - WinGetPackage exit @@ -137,23 +138,24 @@ public async Task GetInstalledPackages_UnSafe(WinGet Manager) p.Start(); string command = """ - Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version - Import-Module Microsoft.WinGet.Client - function Print-WinGetPackage { - param ( - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $InstalledVersion, + Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version + Import - Module Microsoft.WinGet.Client + function Print - WinGetPackage { + param( + + [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $InstalledVersion, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - Write-Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $Source) + Write - Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $Source) } - } + } - Get-WinGetPackage | Print-WinGetPackage + Get - WinGetPackage | Print - WinGetPackage exit @@ -236,21 +238,22 @@ public async Task FindPackages_UnSafe(WinGet Manager, string query) IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.FindPackages, p); string command = """ - Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version - Import-Module Microsoft.WinGet.Client - function Print-WinGetPackage { - param ( - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, + Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version + Import - Module Microsoft.WinGet.Client + function Print - WinGetPackage { + param( + + [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - Write-Output(""#"" + $Name + ""`t"" + $Id + ""`t"" + $AvailableVersions[0] + ""`t"" + $Source) + Write - Output(""#"" + $Name + ""`t"" + $Id + ""`t"" + $AvailableVersions[0] + ""`t"" + $Source) } - } + } - Find-WinGetPackage -Query {query} | Print-WinGetPackage + Find - WinGetPackage - Query { query} | Print - WinGetPackage exit diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs index 747a7ab21..cbb75f06d 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs @@ -38,7 +38,7 @@ public async Task FindPackages_UnSafe(WinGet Manager, string query) List Packages = []; INativeTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.FindPackages); Dictionary<(PackageCatalogReference, PackageMatchField), Task> FindPackageTasks = []; - + // Load catalogs logger.Log("Loading available catalogs..."); IReadOnlyList AvailableCatalogs = WinGetManager.GetPackageCatalogs(); diff --git a/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs b/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs index f18f6fc53..be791acea 100644 --- a/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs +++ b/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/src/UniGetUI.PackageEngine.Package/Package.cs b/src/UniGetUI.PackageEngine.Package/Package.cs index 6812ef7d5..8b8c8581f 100644 --- a/src/UniGetUI.PackageEngine.Package/Package.cs +++ b/src/UniGetUI.PackageEngine.Package/Package.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -8,10 +8,10 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using UniGetUI.Core.Data; +using UniGetUI.Core.IconEngine; +using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; -using UniGetUI.Core.Logging; -using UniGetUI.Core.IconEngine; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.ManagerClasses.Manager; @@ -190,7 +190,7 @@ public override bool Equals(object? obj) /// a string with the package's normalized icon id public string GetIconId() { - string iconId = Id.ToLower(); + string iconId = Id.ToLower(); if (Manager.Name == "Winget") iconId = string.Join('.', iconId.Split(".")[1..]); else if (Manager.Name == "Chocolatey") diff --git a/src/UniGetUI.PackageEngine.Package/PackageDetails.cs b/src/UniGetUI.PackageEngine.Package/PackageDetails.cs index 76ea02fd9..142f6ca6e 100644 --- a/src/UniGetUI.PackageEngine.Package/PackageDetails.cs +++ b/src/UniGetUI.PackageEngine.Package/PackageDetails.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs b/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs index f64e1634e..190cb172b 100644 --- a/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs +++ b/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index 18499a4b5..7aff455a8 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -42,7 +42,7 @@ public abstract class AbstractPackageLoader private int LoadOperationIdentifier; protected IEnumerable Managers { get; private set; } - public AbstractPackageLoader(IEnumerable managers, string identifier, bool AllowMultiplePackageVersions = false, bool DisableReload = false) + public AbstractPackageLoader(IEnumerable managers, string identifier, bool AllowMultiplePackageVersions = false, bool DisableReload = false) { Managers = managers; PackageReference = new Dictionary(); @@ -80,7 +80,7 @@ protected void InvokeFinishedLoadingEvent() /// public virtual async Task ReloadPackages() { - if(DISABLE_RELOAD) + if (DISABLE_RELOAD) { InvokePackagesChangedEvent(); return; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs index a493bbffe..ce10e9f2d 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs @@ -27,7 +27,7 @@ protected override Task LoadPackagesFromManager(IPackageManager mana #pragma warning disable CS1998 protected override async Task WhenAddingPackage(IPackage package) { - if(package.GetInstalledPackage() != null) + if (package.GetInstalledPackage() != null) package.SetTag(PackageTag.AlreadyInstalled); } #pragma warning restore CS1998 @@ -65,14 +65,14 @@ public async Task AddPackagesAsync(IEnumerable foreign_packages) { Logger.Error($"An IPackage instance id={foreign.Id} did not match the types Package, ImportedPackage or InvalidImportedPackage. This should never be the case"); } - if(package is not null && !Contains(package)) AddPackage(package); + if (package is not null && !Contains(package)) AddPackage(package); } InvokePackagesChangedEvent(); } public void RemoveRange(IEnumerable packages) { - foreach(IPackage package in packages) + foreach (IPackage package in packages) { if (!Contains(package)) continue; PackageReference.Remove(HashPackage(package)); diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs index 3da79880b..4c8934724 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs @@ -1,5 +1,5 @@ -using UniGetUI.PackageEngine.Interfaces; using UniGetUI.Interface.Enums; +using UniGetUI.PackageEngine.Interfaces; namespace UniGetUI.PackageEngine.Classes.Manager { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index 92871a6b8..8392d19cf 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -5,17 +5,17 @@ using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; +using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; -using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Classes.Packages; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.PackageClasses; -using UniGetUI.PackageEngine.Classes.Manager; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { @@ -85,7 +85,7 @@ public virtual async Task InitializeAsync() // END integrity check Properties.DefaultSource.RefreshSourceNames(); - foreach(var source in Properties.KnownSources) source.RefreshSourceNames(); + foreach (var source in Properties.KnownSources) source.RefreshSourceNames(); try { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs index 6214f66bf..b63bf159b 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs @@ -96,7 +96,7 @@ public List GetPackages() /// Returns a list containing the checked packages on this collection /// public List GetCheckedPackages() - { + { List packages = []; foreach (PackageWrapper wrapper in this) { diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs index ec5210ab2..cff17ec16 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs @@ -1,4 +1,4 @@ -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 1796e3178..cc6614889 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.PackageEngine.Classes.Serializable +namespace UniGetUI.PackageEngine.Classes.Serializable { public class SerializableIncompatiblePackage_v1 { diff --git a/src/UniGetUI/App.xaml.cs b/src/UniGetUI/App.xaml.cs index 57f492961..f5585aa53 100644 --- a/src/UniGetUI/App.xaml.cs +++ b/src/UniGetUI/App.xaml.cs @@ -1,10 +1,10 @@ +using System.Diagnostics; +using System.Globalization; +using System.Security.Cryptography; using CommunityToolkit.WinUI.Helpers; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.Diagnostics; -using System.Globalization; -using System.Security.Cryptography; using UniGetUI.Core.Data; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; diff --git a/src/UniGetUI/EntryPoint.cs b/src/UniGetUI/EntryPoint.cs index 44a01d2bc..7bbc44e18 100644 --- a/src/UniGetUI/EntryPoint.cs +++ b/src/UniGetUI/EntryPoint.cs @@ -46,13 +46,15 @@ private static async Task AsyncMain() try { string textart = $""" - __ __ _ ______ __ __ ______ - / / / /___ (_) ____/__ / /_/ / / / _/ - / / / / __ \/ / / __/ _ \/ __/ / / // / - / /_/ / / / / / /_/ / __/ /_/ /_/ // / - \____/_/ /_/_/\____/\___/\__/\____/___/ - Welcome to UniGetUI Version {CoreData.VersionName} - """; + __ __ _ ______ __ __ ______ + / / / / ___(_) ____ / __ / / _ / / / / _ / + + / / / / __ \/ / / __ / _ \/ __ / / / // / + + / / _ / / / / / / / _ / / __ / / _ / / _ / // / + \____ / _ / / _ / _ /\____ /\___ /\__ /\____ / ___ / + Welcome to UniGetUI Version { CoreData.VersionName} + """; Logger.ImportantInfo(textart); Logger.ImportantInfo(" "); diff --git a/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs b/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs index e3bfb3d14..06f95ff77 100644 --- a/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs @@ -1,6 +1,6 @@ +using System.Text.Json.Nodes; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using System.Text.Json.Nodes; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs index 132392e5a..e574f8854 100644 --- a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs @@ -1,6 +1,6 @@ +using System.Runtime.InteropServices; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.Runtime.InteropServices; using UniGetUI.Core.Language; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Enums; @@ -58,14 +58,14 @@ public InstallOptionsPage(IPackage package, OperationType Operation, Serializabl VersionComboBox.SelectionChanged += (s, e) => { IgnoreUpdatesCheckbox.IsChecked = - !(new [] + !(new[] { - CoreTools.Translate("Latest"), - CoreTools.Translate("PreRelease"), + CoreTools.Translate("Latest"), + CoreTools.Translate("PreRelease"), "" }.Contains(VersionComboBox.SelectedValue.ToString())); }; - + VersionComboBox.Items.Add(CoreTools.Translate("Latest")); VersionComboBox.SelectedIndex = 0; if (package.Manager.Capabilities.SupportsPreRelease) diff --git a/src/UniGetUI/Interface/MainView.xaml.cs b/src/UniGetUI/Interface/MainView.xaml.cs index 212375003..e1921773b 100644 --- a/src/UniGetUI/Interface/MainView.xaml.cs +++ b/src/UniGetUI/Interface/MainView.xaml.cs @@ -472,7 +472,7 @@ private async void ReleaseNotesMenu_Click(object sender, RoutedEventArgs e) NotesDialog.CloseButtonText = CoreTools.Translate("Close"); NotesDialog.Title = CoreTools.Translate("Release notes"); ReleaseNotes? notes = new(); - notes.Close += (s, e) => NotesDialog.Hide(); + notes.Close += (s, e) => NotesDialog.Hide(); NotesDialog.Content = notes; NotesDialog.SizeChanged += (s, e) => { diff --git a/src/UniGetUI/Interface/MainWindow.xaml.cs b/src/UniGetUI/Interface/MainWindow.xaml.cs index d41da5ff2..853c92f67 100644 --- a/src/UniGetUI/Interface/MainWindow.xaml.cs +++ b/src/UniGetUI/Interface/MainWindow.xaml.cs @@ -1,3 +1,5 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; using CommunityToolkit.WinUI.Notifications; using H.NotifyIcon; using Microsoft.UI; @@ -5,21 +7,19 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; using Microsoft.Win32; -using System.Diagnostics; -using System.Runtime.InteropServices; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine; -using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.Classes.Manager.Classes; +using UniGetUI.PackageEngine.Interfaces; using Windows.ApplicationModel.DataTransfer; using Windows.Foundation.Collections; -using Microsoft.UI.Xaml.Media; namespace UniGetUI.Interface { @@ -217,12 +217,12 @@ private void LoadTrayMenu() Dictionary Icons = new() { - { DiscoverPackages, "\uF6FA"}, - { AvailableUpdates, "\uE977"}, - { InstalledPackages, "\uE895"}, - { AboutUniGetUI, "\uE946"}, - { ShowUniGetUI, "\uE8A7"}, - { QuitUniGetUI, "\uE711"}, + { DiscoverPackages, "\uF6FA" }, + { AvailableUpdates, "\uE977" }, + { InstalledPackages, "\uE895" }, + { AboutUniGetUI, "\uE946" }, + { ShowUniGetUI, "\uE8A7" }, + { QuitUniGetUI, "\uE711" }, }; foreach (KeyValuePair item in Icons) @@ -514,11 +514,11 @@ public async Task ShowMissingDependenciesQuery(IEnumerable de int total = dependencies.Count(); foreach (ManagerDependency dependency in dependencies) { - await ShowMissingDependencyQuery(dependency.Name, dependency.InstallFileName, dependency.InstallArguments, dependency.FancyInstallCommand, current++, total); + await ShowMissingDependencyQuery(dependency.Name, dependency.InstallFileName, dependency.InstallArguments, dependency.FancyInstallCommand, current++, total); } } - public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, string exe_args, string fancy_command, int current, int total) + public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, string exe_args, string fancy_command, int current, int total) { ContentDialog dialog = new(); diff --git a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs index c9d7ce147..36f5d0dd5 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.UI.Xaml.Controls; using System.Collections.ObjectModel; +using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Classes; using UniGetUI.Core.Data; diff --git a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs index 38d8ea605..8a30b0951 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.UI.Xaml.Controls; using System.Collections.ObjectModel; +using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Data; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs index 8bfbb34bd..92a42fa65 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.UI.Xaml.Controls; using System.Collections.ObjectModel; +using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Classes; using UniGetUI.Core.Language; diff --git a/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs b/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs index d1186012b..0688dfb36 100644 --- a/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs @@ -1,6 +1,6 @@ +using System.Diagnostics; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.Diagnostics; // 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/Pages/IPageWithKeyboardShortcuts.cs b/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs index 27283ca20..a66723797 100644 --- a/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs +++ b/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Interface.Pages +namespace UniGetUI.Interface.Pages { /// /// Any object that can perform any of the following listed actions should diff --git a/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs b/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs index b83338753..f3f5150f4 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs index c04cd6a9e..095f35af1 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs @@ -1,7 +1,7 @@ +using System.Diagnostics; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.Diagnostics; using UniGetUI.Core.Tools; using Windows.Storage; using Windows.Storage.Pickers; diff --git a/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs b/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs index 66a936904..39e022524 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Documents; using UniGetUI.Core.SettingsEngine; namespace UniGetUI.Interface.Pages.LogPage diff --git a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs index 34edb03ec..842c02a23 100644 --- a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs @@ -1,22 +1,22 @@ +using System.Collections.ObjectModel; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; -using System.Collections.ObjectModel; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.Operations; using UniGetUI.PackageEngine.PackageClasses; using Windows.Storage; using Windows.Storage.Pickers; using Windows.UI; using Windows.UI.Text; -using UniGetUI.PackageEngine.Managers.PowerShellManager; // 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/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs index c9c820e37..dffd30d6f 100644 --- a/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs @@ -1,10 +1,10 @@ +using System.Diagnostics; using CommunityToolkit.WinUI.Controls; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; using Newtonsoft.Json; -using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Language; using UniGetUI.Core.Logging; @@ -55,17 +55,17 @@ public SettingsInterface() Dictionary updates_dict = new() { - {CoreTools.Translate("{0} minutes", 10), "600"}, - {CoreTools.Translate("{0} minutes", 30), "1800"}, - {CoreTools.Translate("1 hour"), "3600"}, - {CoreTools.Translate("{0} hours", 2), "7200"}, - {CoreTools.Translate("{0} hours", 4), "14400"}, - {CoreTools.Translate("{0} hours", 8), "28800"}, - {CoreTools.Translate("{0} hours", 12), "43200"}, - {CoreTools.Translate("1 day"), "86400"}, - {CoreTools.Translate("{0} days", 2), "172800"}, - {CoreTools.Translate("{0} days", 3), "259200"}, - {CoreTools.Translate("1 week"), "604800"} + { CoreTools.Translate("{0} minutes", 10), "600" }, + { CoreTools.Translate("{0} minutes", 30), "1800" }, + { CoreTools.Translate("1 hour"), "3600" }, + { CoreTools.Translate("{0} hours", 2), "7200" }, + { CoreTools.Translate("{0} hours", 4), "14400" }, + { CoreTools.Translate("{0} hours", 8), "28800" }, + { CoreTools.Translate("{0} hours", 12), "43200" }, + { CoreTools.Translate("1 day"), "86400" }, + { CoreTools.Translate("{0} days", 2), "172800" }, + { CoreTools.Translate("{0} days", 3), "259200" }, + { CoreTools.Translate("1 week"), "604800" } }; foreach (KeyValuePair entry in updates_dict) diff --git a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs index 14baab446..0cfe1310d 100644 --- a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs @@ -157,15 +157,15 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { InstallSelected, CoreTools.Translate("Install selected packages") }, - { InstallAsAdmin, " " + CoreTools.Translate("Install as administrator") }, - { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { InstallInteractive, " " + CoreTools.Translate("Interactive installation") }, - { InstallationSettings, CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { ExportSelection, CoreTools.Translate("Add selection to bundle") }, - { HelpButton, CoreTools.Translate("Help") } + { InstallSelected, CoreTools.Translate("Install selected packages") }, + { InstallAsAdmin, " " + CoreTools.Translate("Install as administrator") }, + { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { InstallInteractive, " " + CoreTools.Translate("Interactive installation") }, + { InstallationSettings, CoreTools.Translate("Installation options") }, + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { ExportSelection, CoreTools.Translate("Add selection to bundle") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -181,15 +181,15 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { InstallSelected, IconType.Download }, - { InstallAsAdmin, IconType.UAC }, - { InstallSkipHash, IconType.Checksum }, - { InstallInteractive, IconType.Interactive }, + { InstallSelected, IconType.Download }, + { InstallAsAdmin, IconType.UAC }, + { InstallSkipHash, IconType.Checksum }, + { InstallInteractive, IconType.Interactive }, { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { ExportSelection, IconType.AddTo }, - { HelpButton, IconType.Help } + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { ExportSelection, IconType.AddTo }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) @@ -399,7 +399,7 @@ private async void ShowSharedPackage(string pId, string pSource) return; } } - + Logger.Info($"No package was found with Id={pId} and Source={pSource}, checking for Id only."); // Find a package that matches the Id only foreach (IPackage match in FilteredPackages.GetPackages()) diff --git a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs index ab351817c..701e5f84a 100644 --- a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs @@ -181,16 +181,16 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { UninstallSelected, CoreTools.Translate("Uninstall selected packages") }, - { UninstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, + { UninstallSelected, CoreTools.Translate("Uninstall selected packages") }, + { UninstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, { UninstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, { InstallationSettings, " " + CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, - { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, - { ExportSelection, CoreTools.Translate("Add selection to bundle") }, - { HelpButton, CoreTools.Translate("Help") } + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, + { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, + { ExportSelection, CoreTools.Translate("Add selection to bundle") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -206,16 +206,16 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { UninstallSelected, IconType.Delete }, - { UninstallAsAdmin, IconType.UAC }, - { UninstallInteractive, IconType.Interactive }, - { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { IgnoreSelected, IconType.Pin }, - { ManageIgnored, IconType.ClipboardList }, - { ExportSelection, IconType.AddTo }, - { HelpButton, IconType.Help } + { UninstallSelected, IconType.Delete }, + { UninstallAsAdmin, IconType.UAC }, + { UninstallInteractive, IconType.Interactive }, + { InstallationSettings, IconType.Options }, + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { IgnoreSelected, IconType.Pin }, + { ManageIgnored, IconType.ClipboardList }, + { ExportSelection, IconType.AddTo }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) diff --git a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs index 8c94f38ad..7f53b3232 100644 --- a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs @@ -1,9 +1,9 @@ -using ExternalLibraries.Pickers; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using System.Diagnostics; using System.Text.Json; using System.Xml.Serialization; +using ExternalLibraries.Pickers; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; @@ -44,7 +44,7 @@ public PackageBundlesPage() PageTitle = CoreTools.Translate("Package Bundles"), Glyph = "\uF133" - }) + }) { } @@ -159,20 +159,20 @@ public override void GenerateToolBar() ToolBar.PrimaryCommands.Add(HelpButton); Dictionary Labels = new() - { // Entries with a trailing space are collapsed - // Their texts will be used as the tooltip - { NewBundle, CoreTools.Translate("New bundle") }, - { InstallPackages, CoreTools.Translate("Install selection") }, - { InstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, - { InstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, - { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { OpenBundle, CoreTools.Translate("Open existing bundle") }, - { RemoveSelected, CoreTools.Translate("Remove selection from bundle") }, - { ExportBundle, CoreTools.Translate("Save bundle as") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { HelpButton, CoreTools.Translate("Help") } - }; + { // Entries with a trailing space are collapsed + // Their texts will be used as the tooltip + { NewBundle, CoreTools.Translate("New bundle") }, + { InstallPackages, CoreTools.Translate("Install selection") }, + { InstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, + { InstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, + { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { OpenBundle, CoreTools.Translate("Open existing bundle") }, + { RemoveSelected, CoreTools.Translate("Remove selection from bundle") }, + { ExportBundle, CoreTools.Translate("Save bundle as") }, + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { HelpButton, CoreTools.Translate("Help") } + }; foreach (AppBarButton toolButton in Labels.Keys) { @@ -183,19 +183,19 @@ public override void GenerateToolBar() } Dictionary Icons = new() - { - { NewBundle, IconType.AddTo }, - { InstallPackages, IconType.Download }, - { InstallAsAdmin, IconType.UAC }, - { InstallInteractive, IconType.Interactive }, - { InstallSkipHash, IconType.Checksum }, - { OpenBundle, IconType.OpenFolder }, - { RemoveSelected, IconType.Delete}, - { ExportBundle, IconType.SaveAs }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { HelpButton, IconType.Help } - }; + { + { NewBundle, IconType.AddTo }, + { InstallPackages, IconType.Download }, + { InstallAsAdmin, IconType.UAC }, + { InstallInteractive, IconType.Interactive }, + { InstallSkipHash, IconType.Checksum }, + { OpenBundle, IconType.OpenFolder }, + { RemoveSelected, IconType.Delete }, + { ExportBundle, IconType.SaveAs }, + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { HelpButton, IconType.Help } + }; foreach (AppBarButton toolButton in Icons.Keys) toolButton.Icon = new LocalIcon(Icons[toolButton]); @@ -247,8 +247,8 @@ public async Task ImportAndInstallPackage(IEnumerable packages, bool? List packages_to_install = new(); foreach (IPackage package in packages) { - if(package is ImportedPackage imported) - { + if (package is ImportedPackage imported) + { Logger.ImportantInfo($"Registering package {imported.Id} from manager {imported.SourceAsString}"); packages_to_install.Add(await imported.RegisterAndGetPackageAsync()); } @@ -262,8 +262,8 @@ public async Task ImportAndInstallPackage(IEnumerable packages, bool? foreach (Package package in packages_to_install) { - MainApp.Instance.AddOperationToList(new InstallPackageOperation(package, - await InstallationOptions.FromPackageAsync(package, elevated, interactive, skiphash))); + MainApp.Instance.AddOperationToList(new InstallPackageOperation(package, + await InstallationOptions.FromPackageAsync(package, elevated, interactive, skiphash))); } } diff --git a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs index 7b32b55fe..0b0de4527 100644 --- a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs @@ -201,16 +201,16 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { UpdateSelected, CoreTools.Translate("Update selected packages") }, - { UpdateAsAdmin, " " + CoreTools.Translate("Update as administrator") }, - { UpdateSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { UpdateInteractive, " " + CoreTools.Translate("Interactive update") }, + { UpdateSelected, CoreTools.Translate("Update selected packages") }, + { UpdateAsAdmin, " " + CoreTools.Translate("Update as administrator") }, + { UpdateSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { UpdateInteractive, " " + CoreTools.Translate("Interactive update") }, { InstallationSettings, " " + CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, - { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, - { HelpButton, CoreTools.Translate("Help") } + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, + { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -226,16 +226,16 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { UpdateSelected, IconType.Update }, - { UpdateAsAdmin, IconType.UAC }, - { UpdateSkipHash, IconType.Checksum }, - { UpdateInteractive, IconType.Interactive }, + { UpdateSelected, IconType.Update }, + { UpdateAsAdmin, IconType.UAC }, + { UpdateSkipHash, IconType.Checksum }, + { UpdateInteractive, IconType.Interactive }, { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { IgnoreSelected, IconType.Pin }, - { ManageIgnored, IconType.ClipboardList }, - { HelpButton, IconType.Help } + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { IgnoreSelected, IconType.Pin }, + { ManageIgnored, IconType.ClipboardList }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) diff --git a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs index 52543cfbd..88e5cebf3 100644 --- a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs @@ -17,7 +17,8 @@ public sealed class CheckboxCard : SettingsCard private string setting_name = ""; public string SettingName { - set { + set + { setting_name = value; IS_INVERTED = value.StartsWith("Disable"); _checkbox.IsChecked = Settings.Get(setting_name) ^ IS_INVERTED; diff --git a/src/UniGetUI/Interface/Widgets/ComboboxCard.cs b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs index 92bb85ad8..6d4c2ae9f 100644 --- a/src/UniGetUI/Interface/Widgets/ComboboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs @@ -1,7 +1,7 @@ +using System.Collections.ObjectModel; using CommunityToolkit.WinUI.Controls; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; -using System.Collections.ObjectModel; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs index eff2ec60b..7980f122b 100644 --- a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs @@ -11,7 +11,8 @@ public sealed partial class NavButton : UserControl { public string Text { - set { + set + { string val = CoreTools.Translate(value); int count = val.Count(x => x == ' '); TextBlock.Text = val.Replace(" ", "\x0a"); @@ -44,4 +45,4 @@ public void ForceClick() Click?.Invoke(this, EventArgs.Empty); } } -} \ No newline at end of file +} diff --git a/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs b/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs index 75bddf1ee..18cf4b479 100644 --- a/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs +++ b/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.PackageClasses; diff --git a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs index 3d054533b..12c25c114 100644 --- a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs @@ -1,6 +1,6 @@ +using System.Collections.ObjectModel; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System.Collections.ObjectModel; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; diff --git a/src/UniGetUI/Interface/Widgets/TextboxCard.cs b/src/UniGetUI/Interface/Widgets/TextboxCard.cs index deebbc87f..02fcdb06e 100644 --- a/src/UniGetUI/Interface/Widgets/TextboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/TextboxCard.cs @@ -17,7 +17,8 @@ public sealed class TextboxCard : SettingsCard private string setting_name = ""; public string SettingName { - set { + set + { setting_name = value; _textbox.Text = Settings.GetValue(setting_name); _textbox.TextChanged += (_, _) => SaveValue(); diff --git a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs index 17b2ce3dc..38f98ac1f 100644 --- a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs +++ b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs @@ -1,11 +1,11 @@ +using System.Collections.ObjectModel; +using System.Diagnostics; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; -using System.Collections.ObjectModel; -using System.Diagnostics; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; @@ -544,7 +544,7 @@ protected async Task MainThread() oldHistory = oldHistory.Take(1000).ToArray(); } - List newHistory = [.. ProcessOutput, .. oldHistory]; + List newHistory = [..ProcessOutput, ..oldHistory]; Settings.SetValue("OperationHistory", string.Join('\n', newHistory).Replace(" | ", " ║ ")); } diff --git a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs index 7e29f5271..3889d652c 100644 --- a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs @@ -1,6 +1,6 @@ +using System.Diagnostics; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml.Controls; -using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; @@ -224,7 +224,7 @@ public UpdatePackageOperation( IPackage package, bool IgnoreParallelInstalls = false) : base(package, OperationType.Update, IgnoreParallelInstalls) { } - + protected override string[] GenerateProcessLogHeader() { diff --git a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs index 692614125..769a63809 100644 --- a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs @@ -1,6 +1,6 @@ +using System.Diagnostics; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml.Controls; -using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs b/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs index 4d7269bc5..f70c091ca 100644 --- a/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs +++ b/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs index de3672cb5..9bdc1b71f 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs index 93425c1f2..fab200549 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs index a31ca9199..759e6c0f5 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.Management.Deployment; From dd873733c824e72e5b38e950b1b1a9a7382245e0 Mon Sep 17 00:00:00 2001 From: SkandaBT <9980056379Skanda@gmail.com> Date: Thu, 22 Aug 2024 19:15:22 +0530 Subject: [PATCH 4/9] =?UTF-8?q?Revert=20"style:=20format=20code=20with=20A?= =?UTF-8?q?utopep8,=20Black,=20dotnet-format,=20isort,=20Ruff=20F=E2=80=A6?= =?UTF-8?q?"=20(#39)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5ec4ab8314794d03b27e3fa12a9201f5cca954a9. --- WebBasedData/test_urls.py | 59 ++----- scripts/Languages/LangData.py | 64 +++----- scripts/Languages/LangReference.py | 6 +- scripts/apply_versions.py | 62 +++----- scripts/download_translations.py | 83 ++++------ scripts/generate_json_from_excel.py | 44 ++---- scripts/get_contributors.py | 22 +-- scripts/purge_unusedtranslations.py | 2 +- scripts/tolgee_requests.py | 17 +- scripts/translation_commands.py | 33 ++-- scripts/translation_utils.py | 145 ++++-------------- scripts/verify_translations.py | 40 ++--- .../Classes/FileOpenDialogRCW.cs | 4 +- .../Classes/FileSaveDialogRCW.cs | 2 +- .../Classes/Helper.cs | 4 +- .../Enums/FDAP.cs | 2 +- .../Enums/FDE_OVERWRITE_RESPONSE.cs | 2 +- .../Enums/FDE_SHAREVIOLATION_RESPONSE.cs | 2 +- .../Enums/FOS.cs | 2 +- .../Enums/HRESULT.cs | 2 +- .../Enums/SIGDN.cs | 2 +- .../FileOpenPicker.cs | 2 +- .../FileSavePicker.cs | 2 +- .../FolderPicker.cs | 2 +- .../Guids/CLSIDGuid.cs | 2 +- .../Guids/IIDGuid.cs | 2 +- .../Guids/KFIDGuid.cs | 2 +- .../Interfaces/FileOpenDialog.cs | 6 +- .../Interfaces/FileSaveDialog.cs | 4 +- .../Interfaces/IFileDialog.cs | 6 +- .../Interfaces/IFileDialogEvents.cs | 4 +- .../Interfaces/IFileOpenDialog.cs | 4 +- .../Interfaces/IModalWindow.cs | 2 +- .../Interfaces/IShellItem.cs | 4 +- .../Interfaces/IShellItemArray.cs | 6 +- .../Structures/COMDLG_FILTERSPEC.cs | 2 +- .../Structures/PROPERTYKEY.cs | 2 +- src/SharedAssemblyInfo.cs | 2 +- .../PersonTests.cs | 2 +- .../IIndexableListItem.cs | 2 +- src/UniGetUI.Core.Classes/Person.cs | 2 +- .../ContributorsTests.cs | 2 +- src/UniGetUI.Core.Data.Tests/CoreTests.cs | 12 +- src/UniGetUI.Core.Data.Tests/LicensesTest.cs | 2 +- src/UniGetUI.Core.Data/Contributors.cs | 2 +- src/UniGetUI.Core.Data/CoreData.cs | 6 +- src/UniGetUI.Core.Data/Licenses.cs | 129 ++++++++-------- .../IconDatabaseTests.cs | 2 +- src/UniGetUI.Core.IconStore/Serializable.cs | 2 +- .../LanguageData.cs | 7 +- .../LanguageEngine.cs | 2 +- .../LogEntryTests.cs | 2 +- .../SettingsTest.cs | 2 +- src/UniGetUI.Core.Structs/Person.cs | 2 +- .../BackgroundApi.cs | 2 +- .../ManagerProperties.cs | 2 +- .../ManagerCapabilities.cs | 2 +- .../ManagerLogger.cs | 22 +-- .../Chocolatey.cs | 6 +- .../Providers/ChocolateyDetailsProvider.cs | 2 +- .../Providers/ChocolateyOperationProvider.cs | 9 +- .../DotNet.cs | 4 +- .../Providers/DotNetOperationProvider.cs | 3 +- .../BaseNuGet.cs | 6 +- .../Npm.cs | 6 +- .../Providers/NpmOperationProvider.cs | 5 +- .../Pip.cs | 4 +- .../Providers/PipOperationProvider.cs | 5 +- .../PowerShell.cs | 27 ++-- .../Providers/PowerShellOperationProvider.cs | 7 +- .../PowerShell7.cs | 25 ++- .../Providers/PowerShell7OperationProvider.cs | 7 +- .../Providers/ScoopOperationProvider.cs | 5 +- .../Scoop.cs | 4 +- .../Providers/WinGetOperationProvider.cs | 12 +- .../WinGet.cs | 12 +- .../WinGetHelpers/BundledWinGetHelper.cs | 75 +++++---- .../WinGetHelpers/NativeWinGetHelper.cs | 2 +- .../InstallationOptions.cs | 2 +- src/UniGetUI.PackageEngine.Package/Package.cs | 8 +- .../PackageDetails.cs | 2 +- .../UpgradablePackage.cs | 2 +- .../AbstractPackageLoader.cs | 4 +- .../PackageBundlesLoader.cs | 6 +- .../Manager/Classes/ManagerSource.cs | 2 +- .../Manager/PackageManager.cs | 6 +- .../Packages/ObservablePackageCollection.cs | 2 +- .../SerializableBundle_v1.cs | 2 +- .../SerializableIncompatiblePackage_v1.cs | 2 +- src/UniGetUI/App.xaml.cs | 6 +- src/UniGetUI/EntryPoint.cs | 16 +- .../Interface/Dialogs/IgnoredUpdates.xaml.cs | 2 +- .../Interface/Dialogs/InstallOptions.xaml.cs | 10 +- src/UniGetUI/Interface/MainView.xaml.cs | 2 +- src/UniGetUI/Interface/MainWindow.xaml.cs | 24 +-- .../Pages/AboutPages/Contributors.xaml.cs | 2 +- .../AboutPages/ThirdPartyLicenses.xaml.cs | 2 +- .../Pages/AboutPages/Translators.xaml.cs | 2 +- src/UniGetUI/Interface/Pages/HelpPage.xaml.cs | 2 +- .../Pages/IPageWithKeyboardShortcuts.cs | 2 +- .../Interface/Pages/LogPage/AppLogPage.cs | 2 +- .../Interface/Pages/LogPage/LogPage.xaml.cs | 2 +- .../Pages/LogPage/OperationHistoryPage.cs | 2 +- .../Pages/PackageDetailsPage.xaml.cs | 4 +- .../Interface/Pages/SettingsPage.xaml.cs | 24 +-- .../SoftwarePages/DiscoverSoftwarePage.cs | 36 ++--- .../SoftwarePages/InstalledPackagesPage.cs | 36 ++--- .../SoftwarePages/PackageBundlesPage.cs | 70 ++++----- .../SoftwarePages/SoftwareUpdatesPage.cs | 36 ++--- .../Interface/Widgets/CheckboxCard.cs | 3 +- .../Interface/Widgets/ComboboxCard.cs | 2 +- .../Interface/Widgets/NavButton.xaml.cs | 5 +- .../Interface/Widgets/PackageItemContainer.cs | 2 +- .../Interface/Widgets/SourceManager.xaml.cs | 2 +- src/UniGetUI/Interface/Widgets/TextboxCard.cs | 3 +- .../Operations/OperationControl.xaml.cs | 6 +- .../Operations/PackageOperations.cs | 4 +- .../Operations/SourceOperations.cs | 2 +- .../WinGetConfigurationException.cs | 2 +- .../WindowsPackageManager/ClassModel.cs | 2 +- .../WindowsPackageManager/ClsidContext.cs | 2 +- .../WindowsPackageManagerFactory.cs | 2 +- 122 files changed, 595 insertions(+), 847 deletions(-) diff --git a/WebBasedData/test_urls.py b/WebBasedData/test_urls.py index d03f9b832..50862ae29 100644 --- a/WebBasedData/test_urls.py +++ b/WebBasedData/test_urls.py @@ -1,15 +1,11 @@ -import time - -import requests +import requests, time try: - import json - import os - import sys - + import os, sys, json + urls = [] - # with open("invalid_urls.txt", "w") as f: + #with open("invalid_urls.txt", "w") as f: # f.write("") with open("screenshot-database-v2.json") as f: @@ -19,56 +15,31 @@ if package <= "nosqlworkbench": continue if data["icons_and_screenshots"][package]["icon"] != "": - print( - "Package:", - package, - data["icons_and_screenshots"][package]["icon"], - ) - response = requests.get( - data["icons_and_screenshots"][package]["icon"] - ) + print("Package:", package, data["icons_and_screenshots"][package]["icon"]) + response = requests.get(data["icons_and_screenshots"][package]["icon"]) if response.status_code == 404: - print( - "Package failed:", - package, - data["icons_and_screenshots"][package]["icon"], - ) + print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) with open("invalid_urls.txt", "a") as f: - f.write( - data["icons_and_screenshots"][package]["icon"] + "\n" - ) + f.write(data["icons_and_screenshots"][package]["icon"] + "\n") elif response.status_code != 200 and response.status_code != 403: - print( - response.status_code, - "failed for:", - data["icons_and_screenshots"][package]["icon"], - ) + print(response.status_code, "failed for:", data["icons_and_screenshots"][package]["icon"]) except requests.exceptions.ConnectionError: time.sleep(0.1) try: if data["icons_and_screenshots"][package]["icon"] != "": - response = requests.get( - data["icons_and_screenshots"][package]["icon"] - ) + response = requests.get(data["icons_and_screenshots"][package]["icon"]) if response.status_code == 403 or response.status_code == 404: - print( - "Package failed:", - package, - data["icons_and_screenshots"][package]["icon"], - ) + print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) elif response.status_code != 200: - response = requests.get( - data["icons_and_screenshots"][package]["icon"] - ) + response = requests.get(data["icons_and_screenshots"][package]["icon"]) if response.status_code != 200: - print( - "Failed to resolve DNS for:", - data["icons_and_screenshots"][package]["icon"], - ) + print("Failed to resolve DNS for:", data["icons_and_screenshots"][package]["icon"]) except requests.exceptions.ConnectionError as e: print(type(e)) + + except Exception as e: print(e) os.system("pause") diff --git a/scripts/Languages/LangData.py b/scripts/Languages/LangData.py index 753c715e6..184d5ecf0 100644 --- a/scripts/Languages/LangData.py +++ b/scripts/Languages/LangData.py @@ -6,50 +6,32 @@ """ -import json import os +import json if os.path.exists("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list"): - f = open( - "../src/UniGetUI.Core.Data/Assets/Data/Contributors.list", "r", encoding="utf-8" - ) + f = open("../src/UniGetUI.Core.Data/Assets/Data/Contributors.list", "r", encoding="utf-8") contributors = f.readlines() else: print("No contributors file!") contributors = [] if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"): - f = open( - "../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json", - "r", - encoding="utf-8", - ) + f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json", "r", encoding="utf-8") languageCredits = json.load(f) else: print("No translators file!") languageCredits = {} -if os.path.exists( - "../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json" -): - f = open( - "../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", - "r", - encoding="utf-8", - ) +if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"): + f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", "r", encoding="utf-8") untranslatedPercentage = json.load(f) else: print("No translated percent file!") untranslatedPercentage = {} -if os.path.exists( - "../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json" -): - f = open( - "../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json", - "r", - encoding="utf-8", - ) +if os.path.exists("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json"): + f = open("../src/UniGetUI.Core.LanguageEngine/Assets/Data/LanguagesReference.json", "r", encoding="utf-8") languageReference = json.load(f) else: print("No translated percent file!") @@ -64,6 +46,7 @@ "zh-Hant": "zh_TW", } + # ISO 3166-1 languageFlagsRemap = { "ar": "sa", @@ -93,11 +76,12 @@ "zh": "cn", "bn": "bd", "tg": "ph", - "sq": "al", + "sq": "al" } def getMarkdownSupportLangs(): + readmeLangs = [ "| Language | Translated | Translator(s) |", "| :-- | :-- | --- |", @@ -105,25 +89,17 @@ def getMarkdownSupportLangs(): dir = os.path.dirname(__file__) for lang, langName in languageReference.items(): - if not os.path.exists( - f"{dir}/../../src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_{lang}.json" - ): + if (not os.path.exists(f"{dir}/../../src/UniGetUI.Core.LanguageEngine/Assets/Languages/lang_{lang}.json")): continue - perc = ( - untranslatedPercentage[lang] if (lang in untranslatedPercentage) else "100%" - ) - if perc == "0%": + perc = untranslatedPercentage[lang] if (lang in untranslatedPercentage) else "100%" + if (perc == "0%"): continue langName = languageReference[lang] if (lang in languageReference) else lang flag = languageFlagsRemap[lang] if (lang in languageFlagsRemap) else lang - credits = makeURLFromTranslatorList( - languageCredits[lang] if (lang in languageCredits) else "" - ) - readmeLangs.append( - f"|   {langName} | {perc} | {credits} |" - ) + credits = makeURLFromTranslatorList(languageCredits[lang] if (lang in languageCredits) else "") + readmeLangs.append(f"|   {langName} | {perc} | {credits} |") readmeLangs.append("") return "\n".join(readmeLangs) @@ -137,12 +113,12 @@ def getTranslatorsFromCredits(translators: str) -> list: translatorData = {} for translator in translators.split(","): translatorStriped = translator.strip() - if translatorStriped != "": - translatorPrefixed = translatorStriped[0] == "@" - if translatorPrefixed: + if (translatorStriped != ""): + translatorPrefixed = (translatorStriped[0] == "@") + if (translatorPrefixed): translatorStriped = translatorStriped[1:] link = "" - if translatorPrefixed or translatorStriped in contributors: + if (translatorPrefixed or translatorStriped in contributors): link = f"https://github.com/{translatorStriped}" translatorList.append(translatorStriped) translatorData[translatorStriped] = { @@ -162,7 +138,7 @@ def makeURLFromTranslatorList(translators: list) -> str: for translator in translators: link = translator.get("link") name = translator.get("name") - if link: + if (link): credits.append(f"[{name}]({link})") else: credits.append(name) diff --git a/scripts/Languages/LangReference.py b/scripts/Languages/LangReference.py index 838799f5c..35eea0df7 100644 --- a/scripts/Languages/LangReference.py +++ b/scripts/Languages/LangReference.py @@ -2,11 +2,11 @@ lang = {} englang = {} -languages = {} # will be auto-generated +languages = {} # will be auto-generated -# auto-generate map of files +## auto-generate map of files for key in languageReference.keys(): - if key != "default": + if (key != "default"): languages[key] = f"lang_{key}.json" debugLang = False diff --git a/scripts/apply_versions.py b/scripts/apply_versions.py index c457e57b1..dc9367a3b 100644 --- a/scripts/apply_versions.py +++ b/scripts/apply_versions.py @@ -1,5 +1,5 @@ -import glob import os +import glob os.chdir(os.path.join(os.path.dirname(__file__), "..")) # move to root project @@ -20,52 +20,36 @@ def fileReplaceLinesWith(filename: str, list: dict[str, str], encoding="utf-8"): for line in f.readlines(): match = False for key, value in list.items(): - if key in line: + if (key in line): data += f"{key}{value}" match = True continue - if not match: + if (not match): data += line f.seek(0) f.write(data) f.truncate() - fileReplaceLinesWith( - "src/UniGetUI.Core.Data/CoreData.cs", - { - " public const string VersionName = ": f' "{versionName}"; // Do not modify this line, use file scripts/apply_versions.py\n', - " public const double VersionNumber = ": f" {versionCode}; // Do not modify this line, use file scripts/apply_versions.py\n", - }, - encoding="utf-8-sig", - ) - - fileReplaceLinesWith( - "src/SharedAssemblyInfo.cs", - { - '[assembly: AssemblyVersion("': f'{versionISS}")]\n', - '[assembly: AssemblyFileVersion("': f'{versionISS}")]\n', - '[assembly: AssemblyInformationalVersion("': f'{versionName}")]\n', - # Your replacement dictionary here - }, - encoding="utf-8-sig", - ) - - fileReplaceLinesWith( - "UniGetUI.iss", - { - "#define MyAppVersion": f' "{versionName}"\n', - "VersionInfoVersion=": f"{versionISS}\n", - }, - encoding="utf-8-sig", - ) - - fileReplaceLinesWith( - "src/UniGetUI/app.manifest", - { - " version=": f' "{versionISS}"\n', - }, - encoding="utf-8-sig", - ) + fileReplaceLinesWith("src/UniGetUI.Core.Data/CoreData.cs", { + " public const string VersionName = ": f" \"{versionName}\"; // Do not modify this line, use file scripts/apply_versions.py\n", + " public const double VersionNumber = ": f" {versionCode}; // Do not modify this line, use file scripts/apply_versions.py\n", + }, encoding="utf-8-sig") + + fileReplaceLinesWith("src/SharedAssemblyInfo.cs", { + "[assembly: AssemblyVersion(\"": f"{versionISS}\")]\n", + "[assembly: AssemblyFileVersion(\"": f"{versionISS}\")]\n", + "[assembly: AssemblyInformationalVersion(\"": f"{versionName}\")]\n", + # Your replacement dictionary here + }, encoding="utf-8-sig") + + fileReplaceLinesWith("UniGetUI.iss", { + "#define MyAppVersion": f" \"{versionName}\"\n", + "VersionInfoVersion=": f"{versionISS}\n", + }, encoding="utf-8-sig") + + fileReplaceLinesWith("src/UniGetUI/app.manifest", { + " version=": f" \"{versionISS}\"\n", + }, encoding="utf-8-sig") print("done!") except FileNotFoundError as e: diff --git a/scripts/download_translations.py b/scripts/download_translations.py index ce0cc536e..69dd7ae68 100644 --- a/scripts/download_translations.py +++ b/scripts/download_translations.py @@ -1,14 +1,14 @@ -import glob import json import os import sys import time -import zipfile - import tolgee_requests from Languages.LangData import * +import glob +import zipfile try: + root_dir = os.path.join(os.path.dirname(__file__), "..") os.chdir(root_dir) # move to root project @@ -23,17 +23,13 @@ isSomeChanges = False if len(sys.argv) > 1: - if sys.argv[1] == "--autocommit": + if (sys.argv[1] == "--autocommit"): isAutoCommit = True else: print("nocommit") print(sys.argv[1]) - os.chdir( - os.path.normpath( - os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Languages") - ) - ) + os.chdir(os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Languages"))) print() print("-------------------------------------------------------") @@ -41,10 +37,10 @@ print(" Downloading updated translations...") response = tolgee_requests.export() - if not response.ok: + if (not response.ok): statusCode = response.status_code print(f" Error {statusCode}: {response.text}") - if statusCode == 403: + if (statusCode == 403): print(" APIKEY is probably wrong!") exit(1) with open("langs.zip", "wb") as f: @@ -60,13 +56,12 @@ downloadedLanguages = [] zip_file = zipfile.ZipFile(langArchiveName) - # If the downloaded zip file is valid, delete old language files and extract the new ones - for file in glob.glob("lang_*.json"): + for file in glob.glob('lang_*.json'): # If the downloaded zip file is valid, delete old language files and extract the new ones os.remove(file) for name in zip_file.namelist(): lang = os.path.splitext(name)[0] - if lang in languageRemap: + if (lang in languageRemap): lang = languageRemap[lang] newFilename = f"lang_{lang}.json" downloadedLanguages.append(lang) @@ -78,9 +73,7 @@ except KeyError: print(type(name)) - f = input( - f" The file {name} was not expected to be in here. Please write the name for the file. It should follow the following structure: lang_[CODE].json: " - ) + f = input(f" The file {name} was not expected to be in here. Please write the name for the file. It should follow the following structure: lang_[CODE].json: ") zip_file.extract(f, "./") os.replace(f, newFilename) print(f" Extracted {f}") @@ -98,44 +91,33 @@ langCredits = {} for lang in downloadedLanguages: - with open(f"lang_{lang}.json", "r", encoding="utf-8") as f: + with open(f"lang_{lang}.json", "r", encoding='utf-8') as f: data = dict(json.load(f)) c = 0 a = 0 for key, value in data.items(): c += 1 - if value is not None: + if (value is not None): a += 1 credits = [] try: - if ( - "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" - in data.keys() - ): - credits = getTranslatorsFromCredits( - data[ - "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" - ] - ) + if ("0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry" in data.keys()): + credits = getTranslatorsFromCredits(data["0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry"]) else: - credits = getTranslatorsFromCredits( - data[ - "{0} {0} {0} Contributors, please add your names/usernames separated by comas (for credit purposes)" - ] - ) + credits = getTranslatorsFromCredits(data["{0} {0} {0} Contributors, please add your names/usernames separated by comas (for credit purposes)"]) except KeyError as e: print(e) print("Can't get translator list!") langCredits[lang] = credits percNum = a / c perc = f"{percNum:.0%}" - if perc == "100%" and percNum < 1: + if (perc == "100%" and percNum < 1): perc = "99%" - if perc == "100%" or lang == "en": + if (perc == "100%" or lang == "en"): continue langPerc[lang] = perc - if isAutoCommit: + if (isAutoCommit): os.system("git add .") countOfChanges = len(os.popen("git status -s").readlines()) - countOfChanges isSomeChanges = True if countOfChanges > 0 else False @@ -151,23 +133,10 @@ # languageCredits = {json.dumps(langCredits, indent=2, ensure_ascii=False)} # """ - with open( - os.path.join( - root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json" - ), - "w", - encoding="utf-8", - ) as f: + with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/Translators.json"), "w", encoding="utf-8") as f: f.write(json.dumps(langCredits, indent=2, ensure_ascii=False)) - with open( - os.path.join( - root_dir, - "src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json", - ), - "w", - encoding="utf-8", - ) as f: + with open(os.path.join(root_dir, "src/UniGetUI.Core.LanguageEngine/Assets/Data/TranslatedPercentages.json"), "w", encoding="utf-8") as f: f.write(json.dumps(langPerc, indent=2, ensure_ascii=False)) # translations_filepath = os.path.normpath(os.path.join(root_dir, "UniGetUI.Core.LanguageEngine/Core/Data/Translations.py")) @@ -188,14 +157,14 @@ data = "" for line in f.readlines(): if "" in line: - data += f"{line}{getMarkdownSupportLangs()}\nLast updated: {str(time.ctime(time.time()))}\n" + data += f'{line}{getMarkdownSupportLangs()}\nLast updated: {str(time.ctime(time.time()))}\n' print(" Text modified") skip = True if "" in line: skip = False - if not skip: + if (not skip): data += line - if isSomeChanges: + if (isSomeChanges): f.seek(0) f.write(data) f.truncate() @@ -205,10 +174,10 @@ print("-------------------------------------------------------") print() - if isAutoCommit: - if not isSomeChanges: + if (isAutoCommit): + if (not isSomeChanges): os.system("git reset --hard") # prevent clean - + except Exception as e: print(e) print(e.__traceback__.tb_lineno) diff --git a/scripts/generate_json_from_excel.py b/scripts/generate_json_from_excel.py index 491e0e30b..a02e41ab6 100644 --- a/scripts/generate_json_from_excel.py +++ b/scripts/generate_json_from_excel.py @@ -17,19 +17,14 @@ pass with open("screenshot_database.xlsx", "wb") as f: - f.write( - urlopen( - "https://docs.google.com/spreadsheets/d/1Zxgzs1BiTZipC7EiwNEb9cIchistIdr5/export?format=xlsx" - ).read() - ) + f.write(urlopen("https://docs.google.com/spreadsheets/d/1Zxgzs1BiTZipC7EiwNEb9cIchistIdr5/export?format=xlsx").read()) try: - workbook = xlrd.open_workbook("screenshot_database.xlsx") + workbook = xlrd.open_workbook('screenshot_database.xlsx') except: os.system("python -m pip install xlrd==1.0.0") import xlrd - - workbook = xlrd.open_workbook("screenshot_database.xlsx") + workbook = xlrd.open_workbook('screenshot_database.xlsx') worksheet = workbook.sheet_by_index(0) @@ -61,10 +56,7 @@ packagesWithScreenshot += 1 j = 2 while j < len(worksheet.row_values(i)): - if ( - worksheet.cell_value(i, j) is None - or worksheet.cell_value(i, j) == "" - ): + if worksheet.cell_value(i, j) is None or worksheet.cell_value(i, j) == "": if j == 2: packagesWithScreenshot -= 1 break @@ -73,19 +65,19 @@ j += 1 if j > 23: break - assert type(data) == list - assert len(data) == 3 + assert (type(data) == list) + assert (len(data) == 3) try: - assert type(data[0]) == str + assert (type(data[0]) == str) except AssertionError as e: if data[0] == 115.0: data[0] = "115" else: raise e - assert type(data[1]) == str - assert type(data[2]) == list + assert (type(data[1]) == str) + assert (type(data[2]) == list) if data[1] != "": - if data[1] in forbidden_string: + if(data[1] in forbidden_string): data[1] = "" else: doneCount += 1 @@ -94,20 +86,12 @@ if not data[0] in jsoncontent["icons_and_screenshots"].keys(): jsoncontent["icons_and_screenshots"][data[0]] = { "icon": data[1], - "images": data[2], + "images": data[2] } else: jsoncontent["icons_and_screenshots"][data[0]] = { - "icon": ( - data[1] - if jsoncontent["icons_and_screenshots"][data[0]]["icon"] == "" - else jsoncontent["icons_and_screenshots"][data[0]]["icon"] - ), - "images": ( - data[2] - if jsoncontent["icons_and_screenshots"][data[0]]["images"] == [] - else jsoncontent["icons_and_screenshots"][data[0]]["images"] - ), + "icon": data[1] if jsoncontent["icons_and_screenshots"][data[0]]["icon"] == "" else jsoncontent["icons_and_screenshots"][data[0]]["icon"], + "images": data[2] if jsoncontent["icons_and_screenshots"][data[0]]["images"] == [] else jsoncontent["icons_and_screenshots"][data[0]]["images"] } totalCount += 1 i += 1 @@ -123,4 +107,6 @@ with open("screenshot-database-v2.json", "w") as outfile: json.dump(jsoncontent, outfile, indent=4) + + os.system("pause") diff --git a/scripts/get_contributors.py b/scripts/get_contributors.py index dcf8a7fbd..22540893d 100644 --- a/scripts/get_contributors.py +++ b/scripts/get_contributors.py @@ -12,24 +12,20 @@ os.system("pip install requests") import requests -response = requests.get( - "https://api.github.com/repos/marticliment/WingetUI/contributors?anon=1&per_page=100" -) +response = requests.get("https://api.github.com/repos/marticliment/WingetUI/contributors?anon=1&per_page=100") contributors = [] contributorsInfo = [] for contributor in response.json(): login = contributor.get("login", None) - if contributor.get("type") == "User" and login: + if (contributor.get("type") == "User" and login): contributors.append(login + "\n") - contributorsInfo.append( - { - "name": login, - "link": contributor.get("html_url"), - "contributions": contributor.get("contributions"), - } - ) + contributorsInfo.append({ + "name": login, + "link": contributor.get("html_url"), + "contributions": contributor.get("contributions"), + }) # output = f""" # Autogenerated file, do not modify it!!! @@ -39,9 +35,7 @@ # contributorsInfo = {json.dumps(contributorsInfo, indent=2, ensure_ascii=False)} # """ -contributors_filepath = os.path.normpath( - os.path.join(root_dir, "src/UniGetUI.Core.Data/Assets/Data/Contributors.list") -) +contributors_filepath = os.path.normpath(os.path.join(root_dir, "src/UniGetUI.Core.Data/Assets/Data/Contributors.list")) with open(contributors_filepath, "w", encoding="utf-8") as f: f.writelines(contributors) diff --git a/scripts/purge_unusedtranslations.py b/scripts/purge_unusedtranslations.py index 9fe1c23ec..7665a93d2 100644 --- a/scripts/purge_unusedtranslations.py +++ b/scripts/purge_unusedtranslations.py @@ -22,7 +22,7 @@ for key in engfile.keys(): key = key.replace("\n", "\\n") if not key in contents: - if not key.replace('"', '\\"') in contents: + if not key.replace("\"", "\\\"") in contents: print(f"Unused key 😳: {key}") print("Job finished succuessfully! 😎") except Exception as e: diff --git a/scripts/tolgee_requests.py b/scripts/tolgee_requests.py index da32fa820..58ab2d600 100644 --- a/scripts/tolgee_requests.py +++ b/scripts/tolgee_requests.py @@ -7,12 +7,14 @@ os.system("pip install requests") import requests -__project_id = 1 # UniGetUI + +__project_id = 1 # UniGetUI __api_url = f"https://tolgee.marticliment.com/v2/projects/{__project_id}" __api_key = "" __headers: dict[str, str] = {} __all_keys: dict = None + try: with open("APIKEY.txt", "r") as f: __api_key = f.read().strip() @@ -26,16 +28,17 @@ __headers["X-API-Key"] = __api_key + def check_api_key(): url = f"{__api_url}/activity" response = requests.get(url, headers=__headers) - if not response.ok: + if (not response.ok): print("Issue with API key!") print("Error", response.status_code, response.json().get("error")) exit(1) -def export(format="JSON", zip=True, langs: list[str] = []): +def export(format = "JSON", zip = True, langs: list[str] = []): url = f"{__api_url}/export" params = { "format": format, @@ -54,7 +57,9 @@ def export(format="JSON", zip=True, langs: list[str] = []): def create_key(key): url = f"{__api_url}/keys/create" - json: dict[str, str] = {"name": key} + json: dict[str, str] = { + "name": key + } response = requests.post(url, headers=__headers, json=json) return response @@ -64,7 +69,9 @@ def get_keys(): if __all_keys: return __all_keys url = f"{__api_url}/keys" - params = {"size": 1000} + params = { + "size": 1000 + } response = requests.get(url, headers=__headers, params=params) if not response.ok: return False diff --git a/scripts/translation_commands.py b/scripts/translation_commands.py index 8fa1ceabe..2655bdeec 100644 --- a/scripts/translation_commands.py +++ b/scripts/translation_commands.py @@ -7,31 +7,22 @@ __parser = argparse.ArgumentParser() __group = __parser.add_mutually_exclusive_group(required=True) -__group.add_argument( - "-p", "--print", help="Print unused and not translated strings", action="store_true" -) -__group.add_argument( - "-c", "--create", help="Create not translated strings", action="store_true" -) -__group.add_argument( - "-d", "--delete", help="Delete unused strings", action="store_true" -) -__parser.add_argument( - "--online", help="Compare with Tolgee translations via API", action="store_true" -) +__group.add_argument("-p", "--print", help="Print unused and not translated strings", action="store_true") +__group.add_argument("-c", "--create", help="Create not translated strings", action="store_true") +__group.add_argument("-d", "--delete", help="Delete unused strings", action="store_true") +__parser.add_argument("--online", help="Compare with Tolgee translations via API", action="store_true") __parser.add_argument("-y", "--yes", help="All answers are YES", action="store_true") __args = __parser.parse_args() -def __confirm(message: str, choices: list[str], defaultValue=""): - +def __confirm(message: str, choices: list[str], defaultValue = ""): def createChoices(): _choices: list[str] = [] for key in choices: if key == defaultValue: key = key.upper() _choices.append(key) - return "/".join(_choices) + return '/'.join(_choices) try: return (input(f"{message} [{createChoices()}]: ") or defaultValue).lower() @@ -39,7 +30,7 @@ def createChoices(): exit(1) -def encode_str(str: str, strip=0): +def encode_str(str: str, strip = 0): new_str = str if strip > 0: new_str = str[:strip].strip() @@ -56,7 +47,7 @@ def create(strs: list[str]): continue print("Creating key... ", end="") response = tolgee_requests.create_key(key) - if not response.ok: + if (not response.ok): print("Failed") print("Error", response.status_code, response.text) return @@ -76,7 +67,7 @@ def delete(strs: list[str]): continue print("Deleting key... ", end="") response = tolgee_requests.delete_key(key) - if not response.ok: + if (not response.ok): print("Failed") print("Error", response.status_code, response.text) return @@ -92,11 +83,7 @@ def __print(strs: list[str]): def __print_all(): - output = json.dumps( - translation_utils.compare_strings(online=__args.online), - ensure_ascii=False, - indent=" ", - ) + output = json.dumps(translation_utils.compare_strings(online=__args.online), ensure_ascii=False, indent=" ") print(output) diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index 0b439a4be..563c42088 100644 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -7,6 +7,7 @@ root_dir = os.path.join(os.path.dirname(__file__), "..") os.chdir(os.path.join(root_dir, "src/UniGetUI/")) + __blacklist_strings = [ "0 0 0 Contributors, please add your names/usernames separated by comas (for credit purposes). DO NOT Translate this entry", ] @@ -15,9 +16,9 @@ # Function to remove special characters from a string def remove_special_chars(string): # Regular expression for special characters (excluding letters and digits) - special_chars = r"[^a-zA-Z0-9]" + special_chars = r'[^a-zA-Z0-9]' # Use regular expression to remove special characters from the string - return re.sub(special_chars, "", string) + return re.sub(special_chars, '', string) def get_all_strings(): @@ -26,144 +27,50 @@ def get_all_strings(): # Find c# translation strings regex1 = r'(?<=Translate\(["\']).+?(?=["\']\))' regex2 = r'(?<=AutoTranslated\(["\']).+?(?=["\']\))' - for dirpath, _dirnames, filenames in os.walk(".", topdown=True): + for (dirpath, _dirnames, filenames) in os.walk(".", topdown=True): for file in filenames: _file_name, file_ext = os.path.splitext(file) - if file_ext != ".cs": + if (file_ext != ".cs"): continue with open(os.path.join(dirpath, file), "r", encoding="utf-8") as f: file_data = f.read() matches: list[str] = re.findall(regex1, file_data) for match in matches: - translation_strings.append( - match.encode("raw_unicode_escape").decode("unicode_escape") - ) + translation_strings.append(match.encode('raw_unicode_escape').decode('unicode_escape')) matches: list[str] = re.findall(regex2, file_data) for match in matches: - translation_strings.append( - match.encode("raw_unicode_escape").decode("unicode_escape") - ) + translation_strings.append(match.encode('raw_unicode_escape').decode('unicode_escape')) # Find XAML translation strings MAIN_WILDCARD = r'(?:x:|"&#x[a-zA-Z0-9]{4};"|[ a-zA-Z0-9=\"\'\r\n\t_\.\,\:\;\{\}])' regex_data = { - r'(?<=Translate\(["\']).+?(?=["\']\))': lambda match: match.encode( - "raw_unicode_escape" - ).decode("unicode_escape"), - r"<[a-zA-Z0-9]+:TranslatedTextBlock" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:ButtonCard" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:ButtonCard" - + MAIN_WILDCARD - + r'+ButtonText=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' ButtonText="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:CheckboxCard" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:ComboboxCard" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:BetterMenuItem" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:NavButton" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:SettingsEntry" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:SettingsEntry" - + MAIN_WILDCARD - + r'+UnderText=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' UnderText="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:SourceManager" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:TextboxCard" - + MAIN_WILDCARD - + r'+Text=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Text="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), - r"<[a-zA-Z0-9]+:TextboxCard" - + MAIN_WILDCARD - + r'+Placeholder=["\'].+["\']' - + MAIN_WILDCARD - + r"*\/?>": lambda match: match.split(' Placeholder="')[1] - .split('"')[0] - .encode("raw_unicode_escape") - .decode("unicode_escape"), + r'(?<=Translate\(["\']).+?(?=["\']\))': lambda match: match.encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:TranslatedTextBlock' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:ButtonCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:ButtonCard' + MAIN_WILDCARD + r'+ButtonText=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" ButtonText=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:CheckboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:ComboboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:BetterMenuItem' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:NavButton' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:SettingsEntry' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:SettingsEntry' + MAIN_WILDCARD + r'+UnderText=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" UnderText=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:SourceManager' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:TextboxCard' + MAIN_WILDCARD + r'+Text=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Text=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), + r'<[a-zA-Z0-9]+:TextboxCard' + MAIN_WILDCARD + r'+Placeholder=["\'].+["\']' + MAIN_WILDCARD + r'*\/?>': lambda match: match.split(" Placeholder=\"")[1].split("\"")[0].encode('raw_unicode_escape').decode('unicode_escape'), } for regex in regex_data.keys(): - for dirpath, _dirnames, filenames in os.walk(".", topdown=True): + for (dirpath, _dirnames, filenames) in os.walk(".", topdown=True): for file in filenames: _file_name, file_ext = os.path.splitext(file) - if file_ext != ".xaml": + if (file_ext != ".xaml"): continue with open(os.path.join(dirpath, file), "r", encoding="utf-8") as f: matches: list[str] = re.findall(regex, f.read()) for match in matches: - translation_strings.append( - regex_data[regex]( - match.replace("\n", " ").replace("\t", " ") - ) - ) + translation_strings.append(regex_data[regex](match.replace("\n", " ").replace("\t", " "))) translation_strings = list(set(translation_strings)) # uniq translation_strings.sort(key=lambda x: (remove_special_chars(x.lower()), x)) @@ -185,16 +92,16 @@ def compare_strings(online=False): not_used: list[str] = [] translation_obj: dict[str, str] = {} lang_strings: dict[str, str] = {} - if online: + if (online): lang_strings = get_all_translations_online() else: lang_strings = get_all_translations() for key in get_all_strings(): translation_obj[key] = "" for key in lang_strings.keys(): - if key in __blacklist_strings: + if (key in __blacklist_strings): continue - if key in translation_obj: + if (key in translation_obj): del translation_obj[key] else: not_used.append(key) diff --git a/scripts/verify_translations.py b/scripts/verify_translations.py index 7c2711686..3a0c9ffae 100644 --- a/scripts/verify_translations.py +++ b/scripts/verify_translations.py @@ -1,43 +1,35 @@ -import glob -import os -import re -import sys - +import os, sys, glob, re def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) - try: - sys.stdout.reconfigure(encoding="utf-8") + sys.stdout.reconfigure(encoding='utf-8') Correct = True - + os.chdir(os.path.dirname(__file__)) os.chdir("../src/UniGetUI.Core.LanguageEngine/Assets/Languages") for FILE in glob.glob("./lang_*.json"): with open(FILE, "r", encoding="utf-8") as f: + # print(f"Begin analyzing file {FILE}") - + for LINE in f.readlines(): - LINE = LINE.replace('\\"', "'") - - if len(LINE) <= 2 or LINE.removesuffix("\n").removesuffix(",").endswith( - "null" - ): + LINE = LINE.replace('\\"', '\'') + + if len(LINE) <= 2 or LINE.removesuffix("\n").removesuffix(",").endswith("null"): continue - + results = re.match(r'^ +"([^"]+)" ?: ?"([^"]+)"', LINE) - BASE, COMPARE = results[1], results[2] - - for find in re.findall(r"{[a-zA-Z0-9]+}", BASE): + BASE, COMPARE = results[1],results[2] + + for find in re.findall(r'{[a-zA-Z0-9]+}', BASE): if BASE.count(find) > COMPARE.count(find): Correct = False - print( - f'Faulting line on file {FILE}, missing key is {find} on translation "{BASE}", with translation {COMPARE}' - ) - + print(f"Faulting line on file {FILE}, missing key is {find} on translation \"{BASE}\", with translation {COMPARE}") + sys.exit(0 if Correct else 1) - + except Exception as e: print(e) - input("Press to close...") + input("Press to close...") \ No newline at end of file diff --git a/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs b/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs index 0a8311fad..1c5f883ae 100644 --- a/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs +++ b/src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs @@ -1,5 +1,5 @@ +using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Classes; @@ -11,4 +11,4 @@ namespace ExternalLibraries.Pickers.Classes; Guid(CLSIDGuid.FileOpenDialog)] internal class FileOpenDialogRCW { -} +} \ No newline at end of file diff --git a/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs b/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs index 76f99e6bd..40a15914e 100644 --- a/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs +++ b/src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs @@ -1,5 +1,5 @@ +using ExternalLibraries.Pickers.Guids; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Classes; diff --git a/src/ExternalLibraries.FilePickers/Classes/Helper.cs b/src/ExternalLibraries.FilePickers/Classes/Helper.cs index 5bb7652a8..840d546bd 100644 --- a/src/ExternalLibraries.FilePickers/Classes/Helper.cs +++ b/src/ExternalLibraries.FilePickers/Classes/Helper.cs @@ -1,7 +1,7 @@ -using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Enums; using ExternalLibraries.Pickers.Interfaces; using ExternalLibraries.Pickers.Structures; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Classes; diff --git a/src/ExternalLibraries.FilePickers/Enums/FDAP.cs b/src/ExternalLibraries.FilePickers/Enums/FDAP.cs index ff698114e..c6347e932 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDAP.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDAP.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fdap internal enum FDAP diff --git a/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs b/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs index 330481374..011f2bdaa 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDE_OVERWRITE_RESPONSE.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_overwrite_response internal enum FDE_OVERWRITE_RESPONSE diff --git a/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs b/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs index 8d513a04b..71fb59290 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FDE_SHAREVIOLATION_RESPONSE.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_shareviolation_response internal enum FDE_SHAREVIOLATION_RESPONSE diff --git a/src/ExternalLibraries.FilePickers/Enums/FOS.cs b/src/ExternalLibraries.FilePickers/Enums/FOS.cs index d2e3dc0ad..5504ea162 100644 --- a/src/ExternalLibraries.FilePickers/Enums/FOS.cs +++ b/src/ExternalLibraries.FilePickers/Enums/FOS.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; [Flags] // https://learn.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions diff --git a/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs b/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs index e64edf6d8..2bbc83dbf 100644 --- a/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs +++ b/src/ExternalLibraries.FilePickers/Enums/HRESULT.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; internal enum HRESULT : long { diff --git a/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs b/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs index c7ae4356d..0b2456d0d 100644 --- a/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs +++ b/src/ExternalLibraries.FilePickers/Enums/SIGDN.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Enums; +namespace ExternalLibraries.Pickers.Enums; // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sigdn internal enum SIGDN : uint diff --git a/src/ExternalLibraries.FilePickers/FileOpenPicker.cs b/src/ExternalLibraries.FilePickers/FileOpenPicker.cs index 365e393a4..0f86c05da 100644 --- a/src/ExternalLibraries.FilePickers/FileOpenPicker.cs +++ b/src/ExternalLibraries.FilePickers/FileOpenPicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/FileSavePicker.cs b/src/ExternalLibraries.FilePickers/FileSavePicker.cs index 5de2d7441..4f68bcf5a 100644 --- a/src/ExternalLibraries.FilePickers/FileSavePicker.cs +++ b/src/ExternalLibraries.FilePickers/FileSavePicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/FolderPicker.cs b/src/ExternalLibraries.FilePickers/FolderPicker.cs index f24121723..0642f9e2a 100644 --- a/src/ExternalLibraries.FilePickers/FolderPicker.cs +++ b/src/ExternalLibraries.FilePickers/FolderPicker.cs @@ -1,4 +1,4 @@ -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Enums; namespace ExternalLibraries.Pickers; diff --git a/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs index 0e42f3115..228f4ed35 100644 --- a/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/CLSIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class CLSIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs index 22e824da8..a0f187807 100644 --- a/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/IIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class IIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs b/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs index a959a87c6..b51f3740d 100644 --- a/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs +++ b/src/ExternalLibraries.FilePickers/Guids/KFIDGuid.cs @@ -1,4 +1,4 @@ -namespace ExternalLibraries.Pickers.Guids; +namespace ExternalLibraries.Pickers.Guids; internal static class KFIDGuid { diff --git a/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs index 5c9c23b04..019c7fdc3 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs @@ -1,6 +1,6 @@ -using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Guids; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Interfaces; @@ -14,4 +14,4 @@ namespace ExternalLibraries.Pickers.Interfaces; CoClass(typeof(FileOpenDialogRCW))] internal interface FileOpenDialog : IFileOpenDialog { -} +} \ No newline at end of file diff --git a/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs index e27a741ac..2d0c13e43 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs @@ -1,6 +1,6 @@ -using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Classes; +using ExternalLibraries.Pickers.Classes; using ExternalLibraries.Pickers.Guids; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs index 12ef55dd9..cf174c172 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs @@ -1,8 +1,8 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Enums; using ExternalLibraries.Pickers.Guids; using ExternalLibraries.Pickers.Structures; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs index 983b96626..c126331cb 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs @@ -1,7 +1,7 @@ +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs b/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs index 3740df495..d3fa50f96 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs @@ -1,7 +1,7 @@ +using ExternalLibraries.Pickers.Guids; +using ExternalLibraries.Pickers.Structures; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Guids; -using ExternalLibraries.Pickers.Structures; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs b/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs index 7c168475a..a1898c881 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs @@ -1,6 +1,6 @@ +using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs b/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs index 186a51f8f..cc57899f2 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs @@ -1,7 +1,7 @@ +using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Guids; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Enums; -using ExternalLibraries.Pickers.Guids; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs b/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs index 224119780..aca6f5307 100644 --- a/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs +++ b/src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs @@ -1,8 +1,8 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using ExternalLibraries.Pickers.Enums; +using ExternalLibraries.Pickers.Enums; using ExternalLibraries.Pickers.Guids; using ExternalLibraries.Pickers.Structures; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Interfaces; diff --git a/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs b/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs index aa5d8278c..2fa3b3110 100644 --- a/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs +++ b/src/ExternalLibraries.FilePickers/Structures/COMDLG_FILTERSPEC.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Structures; diff --git a/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs b/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs index 3729e2841..dbb1a5ab4 100644 --- a/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs +++ b/src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace ExternalLibraries.Pickers.Structures; diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index 8d9d67339..a54efa090 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.Versioning; [assembly: AssemblyProduct("UniGetUI")] diff --git a/src/UniGetUI.Core.Classes.Tests/PersonTests.cs b/src/UniGetUI.Core.Classes.Tests/PersonTests.cs index ef605b262..607dbeaac 100644 --- a/src/UniGetUI.Core.Classes.Tests/PersonTests.cs +++ b/src/UniGetUI.Core.Classes.Tests/PersonTests.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes.Tests +namespace UniGetUI.Core.Classes.Tests { public class PersonTests { diff --git a/src/UniGetUI.Core.Classes/IIndexableListItem.cs b/src/UniGetUI.Core.Classes/IIndexableListItem.cs index 5e7b20dee..76856aab6 100644 --- a/src/UniGetUI.Core.Classes/IIndexableListItem.cs +++ b/src/UniGetUI.Core.Classes/IIndexableListItem.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes +namespace UniGetUI.Core.Classes { public interface IIndexableListItem { diff --git a/src/UniGetUI.Core.Classes/Person.cs b/src/UniGetUI.Core.Classes/Person.cs index 3e95209cf..6e5996f4d 100644 --- a/src/UniGetUI.Core.Classes/Person.cs +++ b/src/UniGetUI.Core.Classes/Person.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Classes +namespace UniGetUI.Core.Classes { public readonly struct Person { diff --git a/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs b/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs index fbdc99839..9fd992549 100644 --- a/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs +++ b/src/UniGetUI.Core.Data.Tests/ContributorsTests.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Data.Tests +namespace UniGetUI.Core.Data.Tests { public class ContributorsTests { diff --git a/src/UniGetUI.Core.Data.Tests/CoreTests.cs b/src/UniGetUI.Core.Data.Tests/CoreTests.cs index b5f9746a9..8f3c41ee4 100644 --- a/src/UniGetUI.Core.Data.Tests/CoreTests.cs +++ b/src/UniGetUI.Core.Data.Tests/CoreTests.cs @@ -1,15 +1,15 @@ -namespace UniGetUI.Core.Data.Tests +namespace UniGetUI.Core.Data.Tests { public class CoreTests { public static object[][] Data => [ [CoreData.UniGetUIDataDirectory], - [CoreData.UniGetUIInstallationOptionsDirectory], - [CoreData.UniGetUICacheDirectory_Data], - [CoreData.UniGetUICacheDirectory_Icons], - [CoreData.UniGetUICacheDirectory_Lang], - [CoreData.UniGetUI_DefaultBackupDirectory] + [CoreData.UniGetUIInstallationOptionsDirectory ], + [CoreData.UniGetUICacheDirectory_Data ], + [CoreData.UniGetUICacheDirectory_Icons ], + [CoreData.UniGetUICacheDirectory_Lang ], + [CoreData.UniGetUI_DefaultBackupDirectory ] ]; [Theory] diff --git a/src/UniGetUI.Core.Data.Tests/LicensesTest.cs b/src/UniGetUI.Core.Data.Tests/LicensesTest.cs index 2fa4ec8b1..ebb8c41e4 100644 --- a/src/UniGetUI.Core.Data.Tests/LicensesTest.cs +++ b/src/UniGetUI.Core.Data.Tests/LicensesTest.cs @@ -35,4 +35,4 @@ public void EnsureHomepageUrlsExist() } } -} +} \ No newline at end of file diff --git a/src/UniGetUI.Core.Data/Contributors.cs b/src/UniGetUI.Core.Data/Contributors.cs index d6aac52f5..cd274d57b 100644 --- a/src/UniGetUI.Core.Data/Contributors.cs +++ b/src/UniGetUI.Core.Data/Contributors.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.Data +namespace UniGetUI.Core.Data { public static class ContributorsData { diff --git a/src/UniGetUI.Core.Data/CoreData.cs b/src/UniGetUI.Core.Data/CoreData.cs index 3a2b5ad2a..6c2d3a9bc 100644 --- a/src/UniGetUI.Core.Data/CoreData.cs +++ b/src/UniGetUI.Core.Data/CoreData.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Net; using UniGetUI.Core.Logging; @@ -34,8 +34,8 @@ private static int GetCodePage() } } - public const string VersionName = "3.1.1"; // Do not modify this line, use file scripts/apply_versions.py - public const double VersionNumber = 3.11; // Do not modify this line, use file scripts/apply_versions.py + public const string VersionName = "3.1.1"; // Do not modify this line, use file scripts/apply_versions.py + public const double VersionNumber = 3.11; // Do not modify this line, use file scripts/apply_versions.py public const string UserAgentString = $"UniGetUI/{VersionName} (https://marticliment.com/unigetui/; contact@marticliment.com)"; diff --git a/src/UniGetUI.Core.Data/Licenses.cs b/src/UniGetUI.Core.Data/Licenses.cs index 52a4b6b59..076bfb8ab 100644 --- a/src/UniGetUI.Core.Data/Licenses.cs +++ b/src/UniGetUI.Core.Data/Licenses.cs @@ -2,94 +2,91 @@ namespace UniGetUI.Core.Data { public static class LicenseData { - public static Dictionary LicenseNames = new() - { - { "UniGetUI", "MIT" }, + public static Dictionary LicenseNames = new() { + {"UniGetUI", "MIT" }, // C# Libraries - { "Pickers", "MIT" }, - { "Community Toolkit", "MIT" }, - { "H.NotifyIcon", "MIT" }, - { "Windows App Sdk", "MIT" }, - { "NancyFx", "MIT" }, - { "YamlDotNet", "MIT" }, - { "InnoDependencyInstaller", "CPOL 1.02" }, + {"Pickers", "MIT"}, + {"Community Toolkit", "MIT"}, + {"H.NotifyIcon", "MIT"}, + {"Windows App Sdk", "MIT"}, + {"NancyFx", "MIT"}, + {"YamlDotNet", "MIT"}, + {"InnoDependencyInstaller", "CPOL 1.02" }, // Package managers and related - { "Winget", "MIT" }, - { "Scoop", "MIT" }, - { "scoop-search", "MIT" }, - { "Chocolatey", "Apache v2" }, - { "Npm", "Artistic License 2.0" }, - { "Pip", "MIT" }, - { "parse_pip_search", "MIT" }, - { "PowerShell Gallery", "Unknown" }, - { ".NET Sdk", "MIT" }, - { "dotnet-tools-outdated", "MIT" }, + {"Winget", "MIT"}, + {"Scoop", "MIT"}, + {"scoop-search", "MIT"}, + {"Chocolatey", "Apache v2"}, + {"Npm", "Artistic License 2.0"}, + {"Pip", "MIT"}, + {"parse_pip_search", "MIT"}, + {"PowerShell Gallery", "Unknown"}, + {".NET Sdk", "MIT"}, + {"dotnet-tools-outdated", "MIT"}, // Other - { "Gsudo", "MIT" }, - { "Icons", "By Icons8" }, + {"Gsudo", "MIT"}, + {"Icons", "By Icons8"}, }; - public static Dictionary LicenseURLs = new() - { - { "UniGetUI", new Uri("https://github.com/marticliment/WingetUI/blob/main/LICENSE") }, + public static Dictionary LicenseURLs = new(){ + {"UniGetUI", new Uri("https://github.com/marticliment/WingetUI/blob/main/LICENSE")}, // 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") }, - { "Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/blob/main/LICENSE") }, - { "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") }, + {"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")}, + {"Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/blob/main/LICENSE")}, + {"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") }, - { "scoop-search", new Uri("https://github.com/shilangyu/scoop-search/blob/master/LICENSE") }, - { "Chocolatey", new Uri("https://github.com/chocolatey/choco/blob/develop/LICENSE") }, - { "Npm", new Uri("https://github.com/npm/cli/blob/latest/LICENSE") }, - { "Pip", new Uri("https://github.com/pypa/pip/blob/main/LICENSE.txt") }, - { "parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md") }, - { ".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/") }, + {"Winget", new Uri("https://github.com/microsoft/winget-cli/blob/master/LICENSE")}, + {"Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE")}, + {"scoop-search", new Uri("https://github.com/shilangyu/scoop-search/blob/master/LICENSE")}, + {"Chocolatey", new Uri("https://github.com/chocolatey/choco/blob/develop/LICENSE")}, + {"Npm", new Uri("https://github.com/npm/cli/blob/latest/LICENSE")}, + {"Pip", new Uri("https://github.com/pypa/pip/blob/main/LICENSE.txt")}, + {"parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md")}, + {".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 - { "Gsudo", new Uri("https://github.com/gerardog/gsudo/blob/master/LICENSE.txt") }, - { "Icons", new Uri("https://icons8.com/license") }, + {"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") }, + 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/") }, - { "H.NotifyIcon", new Uri("https://github.com/HavenDV/H.NotifyIcon/") }, - { "Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/") }, - { "NancyFx", new Uri("https://github.com/NancyFx/Nancy/") }, - { "YamlDotNet", new Uri("https://github.com/aaubry/YamlDotNet/") }, - { "InnoDependencyInstaller", new Uri("https://github.com/DomGries/InnoDependencyInstaller") }, + {"Pickers", new Uri("https://github.com/PavlikBender/Pickers/")}, + {"Community Toolkit", new Uri("https://github.com/CommunityToolkit/Windows/")}, + {"H.NotifyIcon", new Uri("https://github.com/HavenDV/H.NotifyIcon/")}, + {"Windows App Sdk", new Uri("https://github.com/microsoft/WindowsAppSDK/")}, + {"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/") }, - { "scoop-search", new Uri("https://github.com/shilangyu/scoop-search/") }, - { "Chocolatey", new Uri("https://github.com/chocolatey/choco/") }, - { "Npm", new Uri("https://github.com/npm/cli/") }, - { "Pip", new Uri("https://github.com/pypa/pip/") }, - { "parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/") }, - { ".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/") }, + {"Winget", new Uri("https://github.com/microsoft/winget-cli/")}, + {"Scoop", new Uri("https://github.com/ScoopInstaller/Scoop/")}, + {"scoop-search", new Uri("https://github.com/shilangyu/scoop-search/")}, + {"Chocolatey", new Uri("https://github.com/chocolatey/choco/")}, + {"Npm", new Uri("https://github.com/npm/cli/")}, + {"Pip", new Uri("https://github.com/pypa/pip/")}, + {"parse_pip_search", new Uri("https://github.com/marticliment/parseable_pip_search/")}, + {".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 - { "Gsudo", new Uri("https://github.com/gerardog/gsudo/") }, - { "Icons", new Uri("https://icons8.com") }, + {"Gsudo", new Uri("https://github.com/gerardog/gsudo/")}, + {"Icons", new Uri("https://icons8.com")}, }; } diff --git a/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs b/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs index e5f8a0bab..486e34f83 100644 --- a/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs +++ b/src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs @@ -45,4 +45,4 @@ public async Task TestGetNonExistingIconAndImagesAsync() Assert.Empty(nonexistent_screenshots); } } -} +} \ No newline at end of file diff --git a/src/UniGetUI.Core.IconStore/Serializable.cs b/src/UniGetUI.Core.IconStore/Serializable.cs index 23ec7b04f..543fa263c 100644 --- a/src/UniGetUI.Core.IconStore/Serializable.cs +++ b/src/UniGetUI.Core.IconStore/Serializable.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Core.IconEngine +namespace UniGetUI.Core.IconEngine { internal struct IconScreenshotDatabase_v2 { diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs index 36613ad5d..81631d31c 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageData.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageData.cs @@ -153,11 +153,8 @@ public static class CommonTranslations public static readonly Dictionary ScopeNames_NonLang = new() { - { - PackageScope.Global, - "mac" + - "hine" - }, + { PackageScope.Global, "mac" + + "hine" }, { PackageScope.Local, "user" }, }; diff --git a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs index e371e0963..953a6f1f6 100644 --- a/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs +++ b/src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs @@ -1,7 +1,7 @@ +using Jeffijoe.MessageFormat; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.Json.Nodes; -using Jeffijoe.MessageFormat; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs b/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs index d04bc0f74..568f12031 100644 --- a/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs +++ b/src/UniGetUI.Core.Logging.Tests/LogEntryTests.cs @@ -34,4 +34,4 @@ public async Task TestLogEntry() Assert.True(logEntry2.Time < logEntry3.Time); } } -} +} \ No newline at end of file diff --git a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs index 2a7a65ee3..f884422a5 100644 --- a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs +++ b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs @@ -65,4 +65,4 @@ public void TestValueSettings(string SettingName, string st1, string st2, string Assert.False(File.Exists(Path.Join(CoreData.UniGetUIDataDirectory, SettingName))); } } -} +} \ No newline at end of file diff --git a/src/UniGetUI.Core.Structs/Person.cs b/src/UniGetUI.Core.Structs/Person.cs index b93457a68..813cc6dac 100644 --- a/src/UniGetUI.Core.Structs/Person.cs +++ b/src/UniGetUI.Core.Structs/Person.cs @@ -1,4 +1,4 @@ -using System.Collections.Specialized; +using System.Collections.Specialized; namespace UniGetUI.Core.Structs { diff --git a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs index 07bdb5b8f..0373cadf4 100644 --- a/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs +++ b/src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs @@ -1,6 +1,6 @@ -using System.Text; using Nancy; using Nancy.Hosting.Self; +using System.Text; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs index 1be5a5b38..ab66b2cb0 100644 --- a/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs +++ b/src/UniGetUI.PAckageEngine.Interfaces/ManagerProperties.cs @@ -1,5 +1,5 @@ -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.Interface.Enums; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { diff --git a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs index fb12439cc..31cabb9a1 100644 --- a/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs +++ b/src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { diff --git a/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs b/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs index 4fd2cbc3a..e9f349a50 100644 --- a/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs +++ b/src/UniGetUI.PackageEngine.ManagerLogger/ManagerLogger.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using UniGetUI.PackageEngine.ManagerClasses.Manager; namespace UniGetUI.PackageEngine.ManagerLogger @@ -46,27 +46,27 @@ public void AddStdoutLine(string? line) { if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); if (line != null) - StdOut.Add(line); + StdOut.Add(line); } public void AddStdoutLines(IEnumerable lines) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - foreach (string line in lines) + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + foreach (string line in lines) StdOut.Add(line); } public void AddStderrLine(string? line) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - if (line != null) - StdErr.Add(line); + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + if (line != null) + StdErr.Add(line); } public void AddStderrLines(IEnumerable lines) { - if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); - foreach (string line in lines) + if (!isOpen) throw new Exception("Attempted to write log into an already-closed OperationLog"); + foreach (string line in lines) StdErr.Add(line); } @@ -78,7 +78,7 @@ public void End() Logger.LoadOperation(this); } } - + PackageManager Manager; List Operations = new(); @@ -95,7 +95,7 @@ private void LoadOperation(OperationLog operation) public OperationLog CreateOperationLog(OperationType type, Process process) { - if (process.StartInfo == null) + if (process.StartInfo == null) throw new Exception("Process instance did not have a valid StartInfo value"); return new OperationLog(this, type, process.StartInfo.FileName, process.StartInfo.Arguments); diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs index 2d5700735..f75459487 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs @@ -4,16 +4,16 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.Chocolatey; using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.ChocolateyManager { @@ -63,7 +63,7 @@ public Chocolatey() PackageDetailsProvider = new ChocolateyDetailsProvider(this); OperationProvider = new ChocolateyOperationProvider(this); } - + protected override async Task GetAvailableUpdates_UnSafe() { Process p = new() diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs index 2900f1069..c16e211f6 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyDetailsProvider.cs @@ -29,7 +29,7 @@ protected override async Task GetPackageVersions_Unsafe(IPackage packa } }; - IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.LoadPackageVersions, p); + IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.LoadPackageVersions, p); p.Start(); diff --git a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs index 7eed9ba6a..d785a4b7f 100644 --- a/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Chocolatey/Providers/ChocolateyOperationProvider.cs @@ -20,8 +20,7 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -35,7 +34,7 @@ public override IEnumerable GetOperationParameters( if (options.InteractiveInstallation) parameters.Add("--notsilent"); - if (operation is OperationType.Install or OperationType.Update) + if(operation is OperationType.Install or OperationType.Update) { parameters.Add("--no-progress"); @@ -62,7 +61,7 @@ public override OperationVeredict GetOperationResult( IEnumerable processOutput, int returnCode) { - if (returnCode is 3010) + if(returnCode is 3010) { return OperationVeredict.RestartRequired; } @@ -77,7 +76,7 @@ public override OperationVeredict GetOperationResult( if (!options.RunAsAdministrator && (output_string.Contains("Run as administrator") || output_string.Contains("The requested operation requires elevation") - || output_string.Contains("ERROR: Exception calling \"CreateDirectory\" with \"1\" argument(s): \"Access to the path"))) + || output_string.Contains("ERROR: Exception calling \"CreateDirectory\" with \"1\" argument(s): \"Access to the path")) ) { options.RunAsAdministrator = true; return OperationVeredict.AutoRetry; diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs index 9c57aa1f9..4dffb8208 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs @@ -2,16 +2,16 @@ using System.Runtime.InteropServices; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.DotNetManager { diff --git a/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs index a43c8290f..460a5ceef 100644 --- a/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Dotnet/Providers/DotNetOperationProvider.cs @@ -21,8 +21,7 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, diff --git a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs index 4184c95fb..ce3f49228 100644 --- a/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs @@ -60,10 +60,10 @@ protected sealed override async Task FindPackages_UnSafe(string query } else { - sources = [Properties.DefaultSource]; + sources = [ Properties.DefaultSource ]; } - - foreach (IManagerSource source in sources) + + 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}"); diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs index 05f80f589..3eb5ee522 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Npm.cs @@ -1,13 +1,13 @@ using System.Diagnostics; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.NpmManager { @@ -46,7 +46,7 @@ public Npm() PackageDetailsProvider = new NpmPackageDetailsProvider(this); OperationProvider = new NpmOperationProvider(this); } - + protected override async Task FindPackages_UnSafe(string query) { Process p = new() diff --git a/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs index 2aa47cffa..60b0370ed 100644 --- a/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Npm/Providers/NpmOperationProvider.cs @@ -17,9 +17,8 @@ public NpmOperationProvider(Npm manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = operation switch - { - OperationType.Install => [Manager.Properties.InstallVerb, $"{package.Id}@{(options.Version == string.Empty ? package.Version : options.Version)}"], + List parameters = operation switch { + OperationType.Install => [Manager.Properties.InstallVerb, $"{package.Id}@{(options.Version == string.Empty? package.Version: options.Version)}"], OperationType.Update => [Manager.Properties.UpdateVerb, $"{package.Id}@{package.NewVersion}"], OperationType.Uninstall => [Manager.Properties.UninstallVerb, package.Id], _ => throw new InvalidDataException("Invalid package operation") diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs index 1d37ada62..4aa818b22 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; @@ -47,7 +47,7 @@ public Pip() PackageDetailsProvider = new PipPackageDetailsProvider(this); OperationProvider = new PipOperationProvider(this); } - + protected override async Task FindPackages_UnSafe(string query) { List Packages = []; diff --git a/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs index e1630f72d..7d842f166 100644 --- a/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Pip/Providers/PipOperationProvider.cs @@ -20,15 +20,14 @@ public override IEnumerable GetOperationParameters( IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, _ => throw new InvalidDataException("Invalid package operation") }]; parameters.AddRange([ - options.Version != string.Empty ? $"{package.Id}=={options.Version}" : package.Id, + options.Version != string.Empty? $"{package.Id}=={options.Version}" : package.Id, "--no-input", "--no-color", "--no-python-version-warning", diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs index ed032710b..2e783d452 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs @@ -2,8 +2,8 @@ using System.Text; using System.Text.RegularExpressions; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; @@ -81,25 +81,24 @@ protected override async Task GetAvailableUpdates_UnSafe() string command = """ function Test-GalleryModuleUpdate { - param( - - [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [version] $Version, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Repository, + param ( + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository, [switch] $NeedUpdateOnly ) process { - $URLs = @{ } - @(Get - PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) - $page = Invoke - WebRequest - Uri($URLs[$Repository] + "/package/$Name") - UseBasicParsing - Maximum 0 - ea Ignore - [version]$latest = Split - Path - Path($page.Headers.Location - replace "$Name." - replace ".nupkg") - Leaf - $needsupdate = $Latest - gt $Version + $URLs = @{} + @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) + $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -Maximum 0 -ea Ignore + [version]$latest = Split-Path -Path ($page.Headers.Location -replace "$Name." -replace ".nupkg") -Leaf + $needsupdate = $Latest -gt $Version if ($needsupdate) { - Write - Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) + Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) } + } } - } - Get - InstalledModule | Test - GalleryModuleUpdate + Get-InstalledModule | Test-GalleryModuleUpdate exit diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs index 4a17337c2..72f79d62b 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell/Providers/PowerShellOperationProvider.cs @@ -16,8 +16,7 @@ public PowerShellOperationProvider(PowerShell manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -28,7 +27,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn if (options.CustomParameters != null) parameters.AddRange(options.CustomParameters); - if (operation is not OperationType.Uninstall) + if(operation is not OperationType.Uninstall) { if (options.PreRelease) parameters.Add("-AllowPrerelease"); @@ -40,7 +39,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["-Scope", "CurrentUser"]); } - if (operation is OperationType.Install) + if(operation is OperationType.Install) { if (options.SkipHashCheck) parameters.Add("-SkipPublisherCheck"); diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs index 52f836f02..f0c11f363 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs @@ -82,25 +82,24 @@ protected override async Task GetAvailableUpdates_UnSafe() string command = """ function Test-GalleryModuleUpdate { - param( - - [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [version] $Version, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Repository, + param ( + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository, [switch] $NeedUpdateOnly ) process { - $URLs = @{ } - @(Get - PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) - $page = Invoke - WebRequest - Uri($URLs[$Repository] + "/package/$Name") - UseBasicParsing - ea Ignore - [version]$latest = Split - Path - Path($page.BaseResponse.RequestMessage.RequestUri - replace "$Name." - replace ".nupkg") - Leaf - $needsupdate = $Latest - gt $Version + $URLs = @{} + @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation}) + $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -ea Ignore + [version]$latest = Split-Path -Path ($page.BaseResponse.RequestMessage.RequestUri -replace "$Name." -replace ".nupkg") -Leaf + $needsupdate = $Latest -gt $Version if ($needsupdate) { - Write - Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) + Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository) } + } } - } - Get - InstalledModule | Test - GalleryModuleUpdate + Get-InstalledModule | Test-GalleryModuleUpdate exit diff --git a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs index 983cce00b..e166c7bd4 100644 --- a/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.PowerShell7/Providers/PowerShell7OperationProvider.cs @@ -16,8 +16,7 @@ public PowerShell7OperationProvider(PowerShell7 manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -28,7 +27,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn if (options.CustomParameters != null) parameters.AddRange(options.CustomParameters); - if (operation is not OperationType.Uninstall) + if(operation is not OperationType.Uninstall) { if (options.PreRelease) parameters.Add("-AllowPrerelease"); @@ -40,7 +39,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["-Scope", "CurrentUser"]); } - if (operation is OperationType.Install) + if(operation is OperationType.Install) { if (options.SkipHashCheck) parameters.Add("-SkipPublisherCheck"); diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs index 41ab46f6d..0afd8efa3 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Providers/ScoopOperationProvider.cs @@ -16,8 +16,7 @@ public ScoopOperationProvider(Scoop manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -31,7 +30,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.Add("--global"); } - if (options.CustomParameters is not null) + if(options.CustomParameters is not null) parameters.AddRange(options.CustomParameters); if (operation is OperationType.Uninstall) diff --git a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs index 3d2d71ede..c6f711372 100644 --- a/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs +++ b/src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs @@ -4,15 +4,15 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.ScoopManager { diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs index 8814c121a..861e85015 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/Providers/WinGetOperationProvider.cs @@ -17,8 +17,7 @@ public WinGetOperationProvider(WinGet manager) : base(manager) { } public override IEnumerable GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation) { - List parameters = [operation switch - { + List parameters = [operation switch { OperationType.Install => Manager.Properties.InstallVerb, OperationType.Update => Manager.Properties.UpdateVerb, OperationType.Uninstall => Manager.Properties.UninstallVerb, @@ -29,8 +28,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(["--accept-source-agreements", "--disable-interactivity"]); // package.Scope is meaningless in WinGet packages. Default is unspecified, hence the _ => []. - parameters.AddRange(options.InstallationScope switch - { + parameters.AddRange(options.InstallationScope switch { PackageScope.User => ["--scope", "user"], PackageScope.Machine => ["--scope", "machine"], _ => [] @@ -49,7 +47,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.AddRange(options.CustomParameters); - if (operation is OperationType.Update) + if(operation is OperationType.Update) { if (package.Name.Contains("64-bit") || package.Id.ToLower().Contains("x64")) { @@ -62,7 +60,7 @@ public override IEnumerable GetOperationParameters(IPackage package, IIn parameters.Add("--include-unknown"); } - if (operation is not OperationType.Uninstall) + if(operation is not OperationType.Uninstall) { parameters.AddRange(["--accept-package-agreements", "--force"]); @@ -107,7 +105,7 @@ public override OperationVeredict GetOperationResult(IPackage package, IInstalla return OperationVeredict.Succeeded; } - if (uintCode == 0x8A150056 && options.RunAsAdministrator && !CoreTools.IsAdministrator()) + if(uintCode == 0x8A150056 && options.RunAsAdministrator && !CoreTools.IsAdministrator()) { // Installer can't run elevated options.RunAsAdministrator = false; diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs index 979181d03..ccb03eb35 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs @@ -5,15 +5,15 @@ using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager; +using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.ManagerClasses.Manager; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.ManagerClasses.Classes; namespace UniGetUI.PackageEngine.Managers.WingetManager { @@ -71,7 +71,7 @@ public WinGet() p.StandardInput.Close(); await p.WaitForExitAsync(); return p.ExitCode == 0; - }) + }) ]; Capabilities = new ManagerCapabilities @@ -107,8 +107,8 @@ public WinGet() UninstallVerb = "uninstall", UpdateVerb = "update", ExecutableCallArgs = "", - KnownSources = [new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")), - new ManagerSource(this, "msstore", new Uri("https://storeedgefd.dsx.mp.microsoft.com/v9.0"))], + KnownSources = [ new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")), + new ManagerSource(this, "msstore", new Uri("https://storeedgefd.dsx.mp.microsoft.com/v9.0")) ], DefaultSource = new ManagerSource(this, "winget", new Uri("https://cdn.winget.microsoft.com/cache")) }; @@ -157,7 +157,7 @@ public ManagerSource GetLocalSource(string id) } // Check if source is android - if (MeaningfulId.Count(x => x == '.') >= 2 && MeaningfulId.All(c => (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.')) + if(MeaningfulId.Count(x => x == '.') >= 2 && MeaningfulId.All(c => (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.')) { return AndroidSubsystemSource; } diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs index fb20a95cb..ecfba14c5 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/BundledWinGetHelper.cs @@ -46,27 +46,26 @@ public async Task GetAvailableUpdates_UnSafe(WinGet Manager) p.Start(); string command = """ - Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version - Import - Module Microsoft.WinGet.Client - function Print - WinGetPackage { - param( - - [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $InstalledVersion, + Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version + Import-Module Microsoft.WinGet.Client + function Print-WinGetPackage { + param ( + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $InstalledVersion, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - if ($IsUpdateAvailable) + if ($IsUpdateAvailable) { - Write - Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $AvailableVersions[0] + "`t" + $Source) + Write-Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $AvailableVersions[0] + "`t" + $Source) } - } - } + } + } - Get - WinGetPackage | Print - WinGetPackage + Get-WinGetPackage | Print-WinGetPackage exit @@ -138,24 +137,23 @@ public async Task GetInstalledPackages_UnSafe(WinGet Manager) p.Start(); string command = """ - Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version - Import - Module Microsoft.WinGet.Client - function Print - WinGetPackage { - param( - - [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $InstalledVersion, + Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version + Import-Module Microsoft.WinGet.Client + function Print-WinGetPackage { + param ( + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $InstalledVersion, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [bool] $IsUpdateAvailable, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - Write - Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $Source) + Write-Output("#" + $Name + "`t" + $Id + "`t" + $InstalledVersion + "`t" + $Source) } - } + } - Get - WinGetPackage | Print - WinGetPackage + Get-WinGetPackage | Print-WinGetPackage exit @@ -238,22 +236,21 @@ public async Task FindPackages_UnSafe(WinGet Manager, string query) IProcessTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.FindPackages, p); string command = """ - Write - Output(Get - Module - Name Microsoft.WinGet.Client).Version - Import - Module Microsoft.WinGet.Client - function Print - WinGetPackage { - param( - - [Parameter(Mandatory, ValueFromPipelineByPropertyName)][string] $Name, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string] $Id, + Write-Output (Get-Module -Name Microsoft.WinGet.Client).Version + Import-Module Microsoft.WinGet.Client + function Print-WinGetPackage { + param ( + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name, + [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Id, [Parameter(ValueFromPipelineByPropertyName)] [string[]] $AvailableVersions, [Parameter(ValueFromPipelineByPropertyName)] [string] $Source - ) + ) process { - Write - Output(""#"" + $Name + ""`t"" + $Id + ""`t"" + $AvailableVersions[0] + ""`t"" + $Source) + Write-Output(""#"" + $Name + ""`t"" + $Id + ""`t"" + $AvailableVersions[0] + ""`t"" + $Source) } - } + } - Find - WinGetPackage - Query { query} | Print - WinGetPackage + Find-WinGetPackage -Query {query} | Print-WinGetPackage exit diff --git a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs index cbb75f06d..747a7ab21 100644 --- a/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs +++ b/src/UniGetUI.PackageEngine.Managers.WinGet/WinGetHelpers/NativeWinGetHelper.cs @@ -38,7 +38,7 @@ public async Task FindPackages_UnSafe(WinGet Manager, string query) List Packages = []; INativeTaskLogger logger = Manager.TaskLogger.CreateNew(LoggableTaskType.FindPackages); Dictionary<(PackageCatalogReference, PackageMatchField), Task> FindPackageTasks = []; - + // Load catalogs logger.Log("Loading available catalogs..."); IReadOnlyList AvailableCatalogs = WinGetManager.GetPackageCatalogs(); diff --git a/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs b/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs index be791acea..f18f6fc53 100644 --- a/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs +++ b/src/UniGetUI.PackageEngine.Package/InstallationOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; diff --git a/src/UniGetUI.PackageEngine.Package/Package.cs b/src/UniGetUI.PackageEngine.Package/Package.cs index 8b8c8581f..6812ef7d5 100644 --- a/src/UniGetUI.PackageEngine.Package/Package.cs +++ b/src/UniGetUI.PackageEngine.Package/Package.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -8,10 +8,10 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using UniGetUI.Core.Data; -using UniGetUI.Core.IconEngine; -using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; +using UniGetUI.Core.Logging; +using UniGetUI.Core.IconEngine; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.ManagerClasses.Manager; @@ -190,7 +190,7 @@ public override bool Equals(object? obj) /// a string with the package's normalized icon id public string GetIconId() { - string iconId = Id.ToLower(); + string iconId = Id.ToLower(); if (Manager.Name == "Winget") iconId = string.Join('.', iconId.Split(".")[1..]); else if (Manager.Name == "Chocolatey") diff --git a/src/UniGetUI.PackageEngine.Package/PackageDetails.cs b/src/UniGetUI.PackageEngine.Package/PackageDetails.cs index 142f6ca6e..76ea02fd9 100644 --- a/src/UniGetUI.PackageEngine.Package/PackageDetails.cs +++ b/src/UniGetUI.PackageEngine.Package/PackageDetails.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs b/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs index 190cb172b..f64e1634e 100644 --- a/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs +++ b/src/UniGetUI.PackageEngine.Package/UpgradablePackage.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs index 7aff455a8..18499a4b5 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/AbstractPackageLoader.cs @@ -42,7 +42,7 @@ public abstract class AbstractPackageLoader private int LoadOperationIdentifier; protected IEnumerable Managers { get; private set; } - public AbstractPackageLoader(IEnumerable managers, string identifier, bool AllowMultiplePackageVersions = false, bool DisableReload = false) + public AbstractPackageLoader(IEnumerable managers, string identifier, bool AllowMultiplePackageVersions = false, bool DisableReload = false) { Managers = managers; PackageReference = new Dictionary(); @@ -80,7 +80,7 @@ protected void InvokeFinishedLoadingEvent() /// public virtual async Task ReloadPackages() { - if (DISABLE_RELOAD) + if(DISABLE_RELOAD) { InvokePackagesChangedEvent(); return; diff --git a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs index ce10e9f2d..a493bbffe 100644 --- a/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs +++ b/src/UniGetUI.PackageEngine.PackageLoader/PackageBundlesLoader.cs @@ -27,7 +27,7 @@ protected override Task LoadPackagesFromManager(IPackageManager mana #pragma warning disable CS1998 protected override async Task WhenAddingPackage(IPackage package) { - if (package.GetInstalledPackage() != null) + if(package.GetInstalledPackage() != null) package.SetTag(PackageTag.AlreadyInstalled); } #pragma warning restore CS1998 @@ -65,14 +65,14 @@ public async Task AddPackagesAsync(IEnumerable foreign_packages) { Logger.Error($"An IPackage instance id={foreign.Id} did not match the types Package, ImportedPackage or InvalidImportedPackage. This should never be the case"); } - if (package is not null && !Contains(package)) AddPackage(package); + if(package is not null && !Contains(package)) AddPackage(package); } InvokePackagesChangedEvent(); } public void RemoveRange(IEnumerable packages) { - foreach (IPackage package in packages) + foreach(IPackage package in packages) { if (!Contains(package)) continue; PackageReference.Remove(HashPackage(package)); diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs index 4c8934724..3da79880b 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/Classes/ManagerSource.cs @@ -1,5 +1,5 @@ -using UniGetUI.Interface.Enums; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.Interface.Enums; namespace UniGetUI.PackageEngine.Classes.Manager { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs index 8392d19cf..92871a6b8 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs @@ -5,17 +5,17 @@ using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; -using UniGetUI.PackageEngine.Classes.Manager; using UniGetUI.PackageEngine.Classes.Manager.BaseProviders; +using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers; using UniGetUI.PackageEngine.Classes.Manager.Providers; using UniGetUI.PackageEngine.Classes.Packages; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.Interfaces.ManagerProviders; using UniGetUI.PackageEngine.ManagerClasses.Classes; using UniGetUI.PackageEngine.PackageClasses; +using UniGetUI.PackageEngine.Classes.Manager; namespace UniGetUI.PackageEngine.ManagerClasses.Manager { @@ -85,7 +85,7 @@ public virtual async Task InitializeAsync() // END integrity check Properties.DefaultSource.RefreshSourceNames(); - foreach (var source in Properties.KnownSources) source.RefreshSourceNames(); + foreach(var source in Properties.KnownSources) source.RefreshSourceNames(); try { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs index b63bf159b..6214f66bf 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/ObservablePackageCollection.cs @@ -96,7 +96,7 @@ public List GetPackages() /// Returns a list containing the checked packages on this collection /// public List GetCheckedPackages() - { + { List packages = []; foreach (PackageWrapper wrapper in this) { diff --git a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs index cff17ec16..ec5210ab2 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableBundle_v1.cs @@ -1,4 +1,4 @@ -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 cc6614889..1796e3178 100644 --- a/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs +++ b/src/UniGetUI.PackageEngine.Serializable/SerializableIncompatiblePackage_v1.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.PackageEngine.Classes.Serializable +namespace UniGetUI.PackageEngine.Classes.Serializable { public class SerializableIncompatiblePackage_v1 { diff --git a/src/UniGetUI/App.xaml.cs b/src/UniGetUI/App.xaml.cs index f5585aa53..57f492961 100644 --- a/src/UniGetUI/App.xaml.cs +++ b/src/UniGetUI/App.xaml.cs @@ -1,10 +1,10 @@ -using System.Diagnostics; -using System.Globalization; -using System.Security.Cryptography; using CommunityToolkit.WinUI.Helpers; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; +using System.Globalization; +using System.Security.Cryptography; using UniGetUI.Core.Data; using UniGetUI.Core.IconEngine; using UniGetUI.Core.Logging; diff --git a/src/UniGetUI/EntryPoint.cs b/src/UniGetUI/EntryPoint.cs index 7bbc44e18..44a01d2bc 100644 --- a/src/UniGetUI/EntryPoint.cs +++ b/src/UniGetUI/EntryPoint.cs @@ -46,15 +46,13 @@ private static async Task AsyncMain() try { string textart = $""" - __ __ _ ______ __ __ ______ - / / / / ___(_) ____ / __ / / _ / / / / _ / - - / / / / __ \/ / / __ / _ \/ __ / / / // / - - / / _ / / / / / / / _ / / __ / / _ / / _ / // / - \____ / _ / / _ / _ /\____ /\___ /\__ /\____ / ___ / - Welcome to UniGetUI Version { CoreData.VersionName} - """; + __ __ _ ______ __ __ ______ + / / / /___ (_) ____/__ / /_/ / / / _/ + / / / / __ \/ / / __/ _ \/ __/ / / // / + / /_/ / / / / / /_/ / __/ /_/ /_/ // / + \____/_/ /_/_/\____/\___/\__/\____/___/ + Welcome to UniGetUI Version {CoreData.VersionName} + """; Logger.ImportantInfo(textart); Logger.ImportantInfo(" "); diff --git a/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs b/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs index 06f95ff77..e3bfb3d14 100644 --- a/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/IgnoredUpdates.xaml.cs @@ -1,6 +1,6 @@ -using System.Text.Json.Nodes; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; +using System.Text.Json.Nodes; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs index e574f8854..132392e5a 100644 --- a/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs +++ b/src/UniGetUI/Interface/Dialogs/InstallOptions.xaml.cs @@ -1,6 +1,6 @@ -using System.Runtime.InteropServices; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Runtime.InteropServices; using UniGetUI.Core.Language; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Enums; @@ -58,14 +58,14 @@ public InstallOptionsPage(IPackage package, OperationType Operation, Serializabl VersionComboBox.SelectionChanged += (s, e) => { IgnoreUpdatesCheckbox.IsChecked = - !(new[] + !(new [] { - CoreTools.Translate("Latest"), - CoreTools.Translate("PreRelease"), + CoreTools.Translate("Latest"), + CoreTools.Translate("PreRelease"), "" }.Contains(VersionComboBox.SelectedValue.ToString())); }; - + VersionComboBox.Items.Add(CoreTools.Translate("Latest")); VersionComboBox.SelectedIndex = 0; if (package.Manager.Capabilities.SupportsPreRelease) diff --git a/src/UniGetUI/Interface/MainView.xaml.cs b/src/UniGetUI/Interface/MainView.xaml.cs index e1921773b..212375003 100644 --- a/src/UniGetUI/Interface/MainView.xaml.cs +++ b/src/UniGetUI/Interface/MainView.xaml.cs @@ -472,7 +472,7 @@ private async void ReleaseNotesMenu_Click(object sender, RoutedEventArgs e) NotesDialog.CloseButtonText = CoreTools.Translate("Close"); NotesDialog.Title = CoreTools.Translate("Release notes"); ReleaseNotes? notes = new(); - notes.Close += (s, e) => NotesDialog.Hide(); + notes.Close += (s, e) => NotesDialog.Hide(); NotesDialog.Content = notes; NotesDialog.SizeChanged += (s, e) => { diff --git a/src/UniGetUI/Interface/MainWindow.xaml.cs b/src/UniGetUI/Interface/MainWindow.xaml.cs index 853c92f67..d41da5ff2 100644 --- a/src/UniGetUI/Interface/MainWindow.xaml.cs +++ b/src/UniGetUI/Interface/MainWindow.xaml.cs @@ -1,5 +1,3 @@ -using System.Diagnostics; -using System.Runtime.InteropServices; using CommunityToolkit.WinUI.Notifications; using H.NotifyIcon; using Microsoft.UI; @@ -7,19 +5,21 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; using Microsoft.Win32; +using System.Diagnostics; +using System.Runtime.InteropServices; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; using UniGetUI.Interface.Widgets; using UniGetUI.PackageEngine; -using UniGetUI.PackageEngine.Classes.Manager.Classes; using UniGetUI.PackageEngine.Interfaces; +using UniGetUI.PackageEngine.Classes.Manager.Classes; using Windows.ApplicationModel.DataTransfer; using Windows.Foundation.Collections; +using Microsoft.UI.Xaml.Media; namespace UniGetUI.Interface { @@ -217,12 +217,12 @@ private void LoadTrayMenu() Dictionary Icons = new() { - { DiscoverPackages, "\uF6FA" }, - { AvailableUpdates, "\uE977" }, - { InstalledPackages, "\uE895" }, - { AboutUniGetUI, "\uE946" }, - { ShowUniGetUI, "\uE8A7" }, - { QuitUniGetUI, "\uE711" }, + { DiscoverPackages, "\uF6FA"}, + { AvailableUpdates, "\uE977"}, + { InstalledPackages, "\uE895"}, + { AboutUniGetUI, "\uE946"}, + { ShowUniGetUI, "\uE8A7"}, + { QuitUniGetUI, "\uE711"}, }; foreach (KeyValuePair item in Icons) @@ -514,11 +514,11 @@ public async Task ShowMissingDependenciesQuery(IEnumerable de int total = dependencies.Count(); foreach (ManagerDependency dependency in dependencies) { - await ShowMissingDependencyQuery(dependency.Name, dependency.InstallFileName, dependency.InstallArguments, dependency.FancyInstallCommand, current++, total); + await ShowMissingDependencyQuery(dependency.Name, dependency.InstallFileName, dependency.InstallArguments, dependency.FancyInstallCommand, current++, total); } } - public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, string exe_args, string fancy_command, int current, int total) + public async Task ShowMissingDependencyQuery(string dep_name, string exe_name, string exe_args, string fancy_command, int current, int total) { ContentDialog dialog = new(); diff --git a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs index 36f5d0dd5..c9d7ce147 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/Contributors.xaml.cs @@ -1,5 +1,5 @@ -using System.Collections.ObjectModel; using Microsoft.UI.Xaml.Controls; +using System.Collections.ObjectModel; using UniGetUI.Core.Classes; using UniGetUI.Core.Data; diff --git a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs index 8a30b0951..38d8ea605 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/ThirdPartyLicenses.xaml.cs @@ -1,5 +1,5 @@ -using System.Collections.ObjectModel; using Microsoft.UI.Xaml.Controls; +using System.Collections.ObjectModel; using UniGetUI.Core.Data; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs b/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs index 92a42fa65..8bfbb34bd 100644 --- a/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs +++ b/src/UniGetUI/Interface/Pages/AboutPages/Translators.xaml.cs @@ -1,5 +1,5 @@ -using System.Collections.ObjectModel; using Microsoft.UI.Xaml.Controls; +using System.Collections.ObjectModel; using UniGetUI.Core.Classes; using UniGetUI.Core.Language; diff --git a/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs b/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs index 0688dfb36..d1186012b 100644 --- a/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/HelpPage.xaml.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; // 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/Pages/IPageWithKeyboardShortcuts.cs b/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs index a66723797..27283ca20 100644 --- a/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs +++ b/src/UniGetUI/Interface/Pages/IPageWithKeyboardShortcuts.cs @@ -1,4 +1,4 @@ -namespace UniGetUI.Interface.Pages +namespace UniGetUI.Interface.Pages { /// /// Any object that can perform any of the following listed actions should diff --git a/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs b/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs index f3f5150f4..b83338753 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/AppLogPage.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs index 095f35af1..c04cd6a9e 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/LogPage.xaml.cs @@ -1,7 +1,7 @@ -using System.Diagnostics; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; using UniGetUI.Core.Tools; using Windows.Storage; using Windows.Storage.Pickers; diff --git a/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs b/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs index 39e022524..66a936904 100644 --- a/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs +++ b/src/UniGetUI/Interface/Pages/LogPage/OperationHistoryPage.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Documents; using UniGetUI.Core.SettingsEngine; namespace UniGetUI.Interface.Pages.LogPage diff --git a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs index 842c02a23..34edb03ec 100644 --- a/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/PackageDetailsPage.xaml.cs @@ -1,22 +1,22 @@ -using System.Collections.ObjectModel; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; +using System.Collections.ObjectModel; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine; using UniGetUI.PackageEngine.Enums; using UniGetUI.PackageEngine.Interfaces; -using UniGetUI.PackageEngine.Managers.PowerShellManager; using UniGetUI.PackageEngine.Operations; using UniGetUI.PackageEngine.PackageClasses; using Windows.Storage; using Windows.Storage.Pickers; using Windows.UI; using Windows.UI.Text; +using UniGetUI.PackageEngine.Managers.PowerShellManager; // 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/Pages/SettingsPage.xaml.cs b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs index dffd30d6f..c9c820e37 100644 --- a/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs +++ b/src/UniGetUI/Interface/Pages/SettingsPage.xaml.cs @@ -1,10 +1,10 @@ -using System.Diagnostics; using CommunityToolkit.WinUI.Controls; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; using Newtonsoft.Json; +using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Language; using UniGetUI.Core.Logging; @@ -55,17 +55,17 @@ public SettingsInterface() Dictionary updates_dict = new() { - { CoreTools.Translate("{0} minutes", 10), "600" }, - { CoreTools.Translate("{0} minutes", 30), "1800" }, - { CoreTools.Translate("1 hour"), "3600" }, - { CoreTools.Translate("{0} hours", 2), "7200" }, - { CoreTools.Translate("{0} hours", 4), "14400" }, - { CoreTools.Translate("{0} hours", 8), "28800" }, - { CoreTools.Translate("{0} hours", 12), "43200" }, - { CoreTools.Translate("1 day"), "86400" }, - { CoreTools.Translate("{0} days", 2), "172800" }, - { CoreTools.Translate("{0} days", 3), "259200" }, - { CoreTools.Translate("1 week"), "604800" } + {CoreTools.Translate("{0} minutes", 10), "600"}, + {CoreTools.Translate("{0} minutes", 30), "1800"}, + {CoreTools.Translate("1 hour"), "3600"}, + {CoreTools.Translate("{0} hours", 2), "7200"}, + {CoreTools.Translate("{0} hours", 4), "14400"}, + {CoreTools.Translate("{0} hours", 8), "28800"}, + {CoreTools.Translate("{0} hours", 12), "43200"}, + {CoreTools.Translate("1 day"), "86400"}, + {CoreTools.Translate("{0} days", 2), "172800"}, + {CoreTools.Translate("{0} days", 3), "259200"}, + {CoreTools.Translate("1 week"), "604800"} }; foreach (KeyValuePair entry in updates_dict) diff --git a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs index 0cfe1310d..14baab446 100644 --- a/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/DiscoverSoftwarePage.cs @@ -157,15 +157,15 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { InstallSelected, CoreTools.Translate("Install selected packages") }, - { InstallAsAdmin, " " + CoreTools.Translate("Install as administrator") }, - { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { InstallInteractive, " " + CoreTools.Translate("Interactive installation") }, - { InstallationSettings, CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { ExportSelection, CoreTools.Translate("Add selection to bundle") }, - { HelpButton, CoreTools.Translate("Help") } + { InstallSelected, CoreTools.Translate("Install selected packages") }, + { InstallAsAdmin, " " + CoreTools.Translate("Install as administrator") }, + { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { InstallInteractive, " " + CoreTools.Translate("Interactive installation") }, + { InstallationSettings, CoreTools.Translate("Installation options") }, + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { ExportSelection, CoreTools.Translate("Add selection to bundle") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -181,15 +181,15 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { InstallSelected, IconType.Download }, - { InstallAsAdmin, IconType.UAC }, - { InstallSkipHash, IconType.Checksum }, - { InstallInteractive, IconType.Interactive }, + { InstallSelected, IconType.Download }, + { InstallAsAdmin, IconType.UAC }, + { InstallSkipHash, IconType.Checksum }, + { InstallInteractive, IconType.Interactive }, { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { ExportSelection, IconType.AddTo }, - { HelpButton, IconType.Help } + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { ExportSelection, IconType.AddTo }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) @@ -399,7 +399,7 @@ private async void ShowSharedPackage(string pId, string pSource) return; } } - + Logger.Info($"No package was found with Id={pId} and Source={pSource}, checking for Id only."); // Find a package that matches the Id only foreach (IPackage match in FilteredPackages.GetPackages()) diff --git a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs index 701e5f84a..ab351817c 100644 --- a/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/InstalledPackagesPage.cs @@ -181,16 +181,16 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { UninstallSelected, CoreTools.Translate("Uninstall selected packages") }, - { UninstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, + { UninstallSelected, CoreTools.Translate("Uninstall selected packages") }, + { UninstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, { UninstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, { InstallationSettings, " " + CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, - { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, - { ExportSelection, CoreTools.Translate("Add selection to bundle") }, - { HelpButton, CoreTools.Translate("Help") } + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, + { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, + { ExportSelection, CoreTools.Translate("Add selection to bundle") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -206,16 +206,16 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { UninstallSelected, IconType.Delete }, - { UninstallAsAdmin, IconType.UAC }, - { UninstallInteractive, IconType.Interactive }, - { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { IgnoreSelected, IconType.Pin }, - { ManageIgnored, IconType.ClipboardList }, - { ExportSelection, IconType.AddTo }, - { HelpButton, IconType.Help } + { UninstallSelected, IconType.Delete }, + { UninstallAsAdmin, IconType.UAC }, + { UninstallInteractive, IconType.Interactive }, + { InstallationSettings, IconType.Options }, + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { IgnoreSelected, IconType.Pin }, + { ManageIgnored, IconType.ClipboardList }, + { ExportSelection, IconType.AddTo }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) diff --git a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs index 7f53b3232..8c94f38ad 100644 --- a/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/PackageBundlesPage.cs @@ -1,9 +1,9 @@ -using System.Diagnostics; -using System.Text.Json; -using System.Xml.Serialization; using ExternalLibraries.Pickers; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; +using System.Text.Json; +using System.Xml.Serialization; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.Interface.Enums; @@ -44,7 +44,7 @@ public PackageBundlesPage() PageTitle = CoreTools.Translate("Package Bundles"), Glyph = "\uF133" - }) + }) { } @@ -159,20 +159,20 @@ public override void GenerateToolBar() ToolBar.PrimaryCommands.Add(HelpButton); Dictionary Labels = new() - { // Entries with a trailing space are collapsed - // Their texts will be used as the tooltip - { NewBundle, CoreTools.Translate("New bundle") }, - { InstallPackages, CoreTools.Translate("Install selection") }, - { InstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, - { InstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, - { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { OpenBundle, CoreTools.Translate("Open existing bundle") }, - { RemoveSelected, CoreTools.Translate("Remove selection from bundle") }, - { ExportBundle, CoreTools.Translate("Save bundle as") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { HelpButton, CoreTools.Translate("Help") } - }; + { // Entries with a trailing space are collapsed + // Their texts will be used as the tooltip + { NewBundle, CoreTools.Translate("New bundle") }, + { InstallPackages, CoreTools.Translate("Install selection") }, + { InstallAsAdmin, " " + CoreTools.Translate("Uninstall as administrator") }, + { InstallInteractive, " " + CoreTools.Translate("Interactive uninstall") }, + { InstallSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { OpenBundle, CoreTools.Translate("Open existing bundle") }, + { RemoveSelected, CoreTools.Translate("Remove selection from bundle") }, + { ExportBundle, CoreTools.Translate("Save bundle as") }, + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { HelpButton, CoreTools.Translate("Help") } + }; foreach (AppBarButton toolButton in Labels.Keys) { @@ -183,19 +183,19 @@ public override void GenerateToolBar() } Dictionary Icons = new() - { - { NewBundle, IconType.AddTo }, - { InstallPackages, IconType.Download }, - { InstallAsAdmin, IconType.UAC }, - { InstallInteractive, IconType.Interactive }, - { InstallSkipHash, IconType.Checksum }, - { OpenBundle, IconType.OpenFolder }, - { RemoveSelected, IconType.Delete }, - { ExportBundle, IconType.SaveAs }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { HelpButton, IconType.Help } - }; + { + { NewBundle, IconType.AddTo }, + { InstallPackages, IconType.Download }, + { InstallAsAdmin, IconType.UAC }, + { InstallInteractive, IconType.Interactive }, + { InstallSkipHash, IconType.Checksum }, + { OpenBundle, IconType.OpenFolder }, + { RemoveSelected, IconType.Delete}, + { ExportBundle, IconType.SaveAs }, + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { HelpButton, IconType.Help } + }; foreach (AppBarButton toolButton in Icons.Keys) toolButton.Icon = new LocalIcon(Icons[toolButton]); @@ -247,8 +247,8 @@ public async Task ImportAndInstallPackage(IEnumerable packages, bool? List packages_to_install = new(); foreach (IPackage package in packages) { - if (package is ImportedPackage imported) - { + if(package is ImportedPackage imported) + { Logger.ImportantInfo($"Registering package {imported.Id} from manager {imported.SourceAsString}"); packages_to_install.Add(await imported.RegisterAndGetPackageAsync()); } @@ -262,8 +262,8 @@ public async Task ImportAndInstallPackage(IEnumerable packages, bool? foreach (Package package in packages_to_install) { - MainApp.Instance.AddOperationToList(new InstallPackageOperation(package, - await InstallationOptions.FromPackageAsync(package, elevated, interactive, skiphash))); + MainApp.Instance.AddOperationToList(new InstallPackageOperation(package, + await InstallationOptions.FromPackageAsync(package, elevated, interactive, skiphash))); } } diff --git a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs index 0b0de4527..7b32b55fe 100644 --- a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs @@ -201,16 +201,16 @@ public override void GenerateToolBar() Dictionary Labels = new() { // Entries with a trailing space are collapsed // Their texts will be used as the tooltip - { UpdateSelected, CoreTools.Translate("Update selected packages") }, - { UpdateAsAdmin, " " + CoreTools.Translate("Update as administrator") }, - { UpdateSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, - { UpdateInteractive, " " + CoreTools.Translate("Interactive update") }, + { UpdateSelected, CoreTools.Translate("Update selected packages") }, + { UpdateAsAdmin, " " + CoreTools.Translate("Update as administrator") }, + { UpdateSkipHash, " " + CoreTools.Translate("Skip integrity checks") }, + { UpdateInteractive, " " + CoreTools.Translate("Interactive update") }, { InstallationSettings, " " + CoreTools.Translate("Installation options") }, - { PackageDetails, " " + CoreTools.Translate("Package details") }, - { SharePackage, " " + CoreTools.Translate("Share") }, - { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, - { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, - { HelpButton, CoreTools.Translate("Help") } + { PackageDetails, " " + CoreTools.Translate("Package details") }, + { SharePackage, " " + CoreTools.Translate("Share") }, + { IgnoreSelected, CoreTools.Translate("Ignore selected packages") }, + { ManageIgnored, CoreTools.Translate("Manage ignored updates") }, + { HelpButton, CoreTools.Translate("Help") } }; foreach (AppBarButton toolButton in Labels.Keys) @@ -226,16 +226,16 @@ public override void GenerateToolBar() Dictionary Icons = new() { - { UpdateSelected, IconType.Update }, - { UpdateAsAdmin, IconType.UAC }, - { UpdateSkipHash, IconType.Checksum }, - { UpdateInteractive, IconType.Interactive }, + { UpdateSelected, IconType.Update }, + { UpdateAsAdmin, IconType.UAC }, + { UpdateSkipHash, IconType.Checksum }, + { UpdateInteractive, IconType.Interactive }, { InstallationSettings, IconType.Options }, - { PackageDetails, IconType.Info_Round }, - { SharePackage, IconType.Share }, - { IgnoreSelected, IconType.Pin }, - { ManageIgnored, IconType.ClipboardList }, - { HelpButton, IconType.Help } + { PackageDetails, IconType.Info_Round }, + { SharePackage, IconType.Share }, + { IgnoreSelected, IconType.Pin }, + { ManageIgnored, IconType.ClipboardList }, + { HelpButton, IconType.Help } }; foreach (AppBarButton toolButton in Icons.Keys) diff --git a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs index 88e5cebf3..52543cfbd 100644 --- a/src/UniGetUI/Interface/Widgets/CheckboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/CheckboxCard.cs @@ -17,8 +17,7 @@ public sealed class CheckboxCard : SettingsCard private string setting_name = ""; public string SettingName { - set - { + set { setting_name = value; IS_INVERTED = value.StartsWith("Disable"); _checkbox.IsChecked = Settings.Get(setting_name) ^ IS_INVERTED; diff --git a/src/UniGetUI/Interface/Widgets/ComboboxCard.cs b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs index 6d4c2ae9f..92bb85ad8 100644 --- a/src/UniGetUI/Interface/Widgets/ComboboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/ComboboxCard.cs @@ -1,7 +1,7 @@ -using System.Collections.ObjectModel; using CommunityToolkit.WinUI.Controls; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; +using System.Collections.ObjectModel; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; diff --git a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs index 7980f122b..eff2ec60b 100644 --- a/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/NavButton.xaml.cs @@ -11,8 +11,7 @@ public sealed partial class NavButton : UserControl { public string Text { - set - { + set { string val = CoreTools.Translate(value); int count = val.Count(x => x == ' '); TextBlock.Text = val.Replace(" ", "\x0a"); @@ -45,4 +44,4 @@ public void ForceClick() Click?.Invoke(this, EventArgs.Empty); } } -} +} \ No newline at end of file diff --git a/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs b/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs index 18cf4b479..75bddf1ee 100644 --- a/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs +++ b/src/UniGetUI/Interface/Widgets/PackageItemContainer.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using UniGetUI.PackageEngine.Interfaces; using UniGetUI.PackageEngine.PackageClasses; diff --git a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs index 12c25c114..3d054533b 100644 --- a/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs +++ b/src/UniGetUI/Interface/Widgets/SourceManager.xaml.cs @@ -1,6 +1,6 @@ -using System.Collections.ObjectModel; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Collections.ObjectModel; using UniGetUI.Core.Logging; using UniGetUI.Core.Tools; using UniGetUI.PackageEngine.Classes.Manager; diff --git a/src/UniGetUI/Interface/Widgets/TextboxCard.cs b/src/UniGetUI/Interface/Widgets/TextboxCard.cs index 02fcdb06e..deebbc87f 100644 --- a/src/UniGetUI/Interface/Widgets/TextboxCard.cs +++ b/src/UniGetUI/Interface/Widgets/TextboxCard.cs @@ -17,8 +17,7 @@ public sealed class TextboxCard : SettingsCard private string setting_name = ""; public string SettingName { - set - { + set { setting_name = value; _textbox.Text = Settings.GetValue(setting_name); _textbox.TextChanged += (_, _) => SaveValue(); diff --git a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs index 38f98ac1f..17b2ce3dc 100644 --- a/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs +++ b/src/UniGetUI/PackageEngine/Operations/OperationControl.xaml.cs @@ -1,11 +1,11 @@ -using System.Collections.ObjectModel; -using System.Diagnostics; using ExternalLibraries.Clipboard; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Documents; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; +using System.Collections.ObjectModel; +using System.Diagnostics; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; using UniGetUI.Core.Tools; @@ -544,7 +544,7 @@ protected async Task MainThread() oldHistory = oldHistory.Take(1000).ToArray(); } - List newHistory = [..ProcessOutput, ..oldHistory]; + List newHistory = [.. ProcessOutput, .. oldHistory]; Settings.SetValue("OperationHistory", string.Join('\n', newHistory).Replace(" | ", " ║ ")); } diff --git a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs index 3889d652c..7e29f5271 100644 --- a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; @@ -224,7 +224,7 @@ public UpdatePackageOperation( IPackage package, bool IgnoreParallelInstalls = false) : base(package, OperationType.Update, IgnoreParallelInstalls) { } - + protected override string[] GenerateProcessLogHeader() { diff --git a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs index 769a63809..692614125 100644 --- a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; using CommunityToolkit.WinUI.Notifications; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; using UniGetUI.Core.Data; using UniGetUI.Core.Logging; using UniGetUI.Core.SettingsEngine; diff --git a/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs b/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs index f70c091ca..4d7269bc5 100644 --- a/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs +++ b/src/WindowsPackageManager.Interop/Exceptions/WinGetConfigurationException.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs index 9bdc1b71f..de3672cb5 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClassModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs index fab200549..93425c1f2 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/ClsidContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. namespace WindowsPackageManager.Interop; diff --git a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs index 759e6c0f5..a31ca9199 100644 --- a/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs +++ b/src/WindowsPackageManager.Interop/WindowsPackageManager/WindowsPackageManagerFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.Management.Deployment; From c49345bfa03a86bdbf3352b40c226f9834eb0cb0 Mon Sep 17 00:00:00 2001 From: SkandaBT <9980056379Skanda@gmail.com> Date: Thu, 22 Aug 2024 19:25:37 +0530 Subject: [PATCH 5/9] Update .deepsource.toml --- .deepsource.toml | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.deepsource.toml b/.deepsource.toml index 07dedbe86..2a4202f4c 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -2,27 +2,64 @@ version = 1 [[analyzers]] name = "python" +enabled = true [analyzers.meta] runtime_version = "3.x.x" + [analyzers.pylint] + enabled = true + config = """ + [MESSAGES CONTROL] + disable = C0111 # Disables missing docstring warnings + """ + [[analyzers]] -name = "csharp" +name = "javascript" +enabled = true -[[transformers]] -name = "dotnet-format" + [analyzers.meta] + plugins = [ + "react", + "vue", + "angular" + ] + environment = [ + "nodejs", + "mocha", + "mongo", + "browser", + "jasmine", + "cypress", + "vitest", + "jquery", + "jest" + ] [[transformers]] name = "autopep8" +enabled = false # Disables autopep8 transformer [[transformers]] name = "isort" +enabled = false # Disables isort transformer [[transformers]] name = "black" +enabled = false # Disables black transformer [[transformers]] name = "yapf" +enabled = false # Disables yapf transformer + +[[transformers]] +name = "ruff" +enabled = false # Disables ruff transformer + +[[transformers]] +name = "standardjs" +enabled = false # Disables standardjs transformer [[transformers]] -name = "ruff" \ No newline at end of file +name = "prettier" +enabled = false # Disables prettier transformer From 0c936facd8ce4a43bff34087ec27291b77438b29 Mon Sep 17 00:00:00 2001 From: "mend-bolt-for-github[bot]" <42819689+mend-bolt-for-github[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:45:20 +0530 Subject: [PATCH 6/9] Add .whitesource configuration file (#41) Co-authored-by: mend-bolt-for-github[bot] <42819689+mend-bolt-for-github[bot]@users.noreply.github.com> --- .whitesource | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .whitesource diff --git a/.whitesource b/.whitesource new file mode 100644 index 000000000..9c7ae90b4 --- /dev/null +++ b/.whitesource @@ -0,0 +1,14 @@ +{ + "scanSettings": { + "baseBranches": [] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff", + "useMendCheckNames": true + }, + "issueSettings": { + "minSeverityLevel": "LOW", + "issueType": "DEPENDENCY" + } +} \ No newline at end of file From 33438fe1b74f9f53d78451bc563f75b265912793 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:26:08 +0530 Subject: [PATCH 7/9] Update icons and screenshots from the excel file (#42) Co-authored-by: Excel Bot From aea5b3aa12f400a2eb5c3ee41d1d4dce97a68016 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:48:15 +0530 Subject: [PATCH 8/9] refactor: replace multiple `==` checks with `in` (#43) To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained `in` it instead of checking for equality against each of the values. This is faster, less verbose, and more readable. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- WebBasedData/test_urls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WebBasedData/test_urls.py b/WebBasedData/test_urls.py index 50862ae29..aa5e6d57a 100644 --- a/WebBasedData/test_urls.py +++ b/WebBasedData/test_urls.py @@ -21,7 +21,7 @@ print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) with open("invalid_urls.txt", "a") as f: f.write(data["icons_and_screenshots"][package]["icon"] + "\n") - elif response.status_code != 200 and response.status_code != 403: + elif response.status_code not in (200, 403): print(response.status_code, "failed for:", data["icons_and_screenshots"][package]["icon"]) except requests.exceptions.ConnectionError: @@ -29,7 +29,7 @@ try: if data["icons_and_screenshots"][package]["icon"] != "": response = requests.get(data["icons_and_screenshots"][package]["icon"]) - if response.status_code == 403 or response.status_code == 404: + if response.status_code in (403, 404): print("Package failed:", package, data["icons_and_screenshots"][package]["icon"]) elif response.status_code != 200: response = requests.get(data["icons_and_screenshots"][package]["icon"]) From 38b0bf81e8e9ec6b5b4f3000cdf727ce8c012777 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 07:21:29 +0530 Subject: [PATCH 9/9] Update icons and screenshots from the excel file (#44) Co-authored-by: Excel Bot --- WebBasedData/screenshot-database-v2.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WebBasedData/screenshot-database-v2.json b/WebBasedData/screenshot-database-v2.json index 0a1936891..0354b9255 100644 --- a/WebBasedData/screenshot-database-v2.json +++ b/WebBasedData/screenshot-database-v2.json @@ -1,8 +1,8 @@ { "package_count": { "total": 11707, - "done": 5107, - "packages_with_icon": 5107, + "done": 5108, + "packages_with_icon": 5108, "packages_with_screenshot": 584, "total_screenshots": 1819 }, @@ -29221,7 +29221,7 @@ "images": [] }, "optionsplus": { - "icon": "", + "icon": "http://www.logitech.com/assets/66208/optionsplusicon.png", "images": [] }, "optipng": {