From fc20d9b925b83532a19467293a7cdcbaa4ef3d6b Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 28 Jun 2023 18:41:38 +0200 Subject: [Ryujinx.Common] Address dotnet-format issues (#5358) * dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0059 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2211 warnings * Silence CA1806 and CA1834 issues * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Replace MmeShadowScratch with Array256 * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Run dotnet format after rebase * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Second dotnet format pass * Fix build issues * Fix StructArrayHelpers.cs * Apply suggestions from code review Co-authored-by: Ac_K * Fix return statements * Fix naming rule violations * Update src/Ryujinx.Common/Utilities/StreamUtils.cs Co-authored-by: Ac_K * Add trailing commas * Address review feedback * Address review feedback * Rename remaining type parameters to TKey and TValue * Fix manual formatting for logging levels * Fix spacing before comments --------- Co-authored-by: Ac_K --- src/Ryujinx.Common/Configuration/AntiAliasing.cs | 4 ++-- src/Ryujinx.Common/Configuration/AppDataManager.cs | 8 ++++---- .../Configuration/AspectRatioExtensions.cs | 16 +++++++++++----- .../Configuration/DownloadableContentContainer.cs | 2 +- .../DownloadableContentJsonSerializerContext.cs | 2 +- .../Configuration/DownloadableContentNca.cs | 6 +++--- .../Configuration/Hid/Controller/GamepadInputId.cs | 4 ++-- .../Hid/Controller/GenericControllerInputConfig.cs | 6 +++--- .../Hid/Controller/JoyconConfigControllerStick.cs | 6 +++--- .../Motion/JsonMotionConfigControllerConverter.cs | 10 +++++----- .../Motion/MotionConfigJsonSerializerContext.cs | 2 +- .../Configuration/Hid/Controller/StickInputId.cs | 4 ++-- .../Configuration/Hid/ControllerType.cs | 18 +++++++++--------- .../Hid/GenericInputConfigurationCommon.cs | 6 +++--- .../Configuration/Hid/InputConfig.cs | 4 ++-- .../Hid/InputConfigJsonSerializerContext.cs | 2 +- .../Configuration/Hid/JsonInputConfigConverter.cs | 10 +++++----- src/Ryujinx.Common/Configuration/Hid/Key.cs | 4 ++-- .../Hid/Keyboard/GenericKeyboardInputConfig.cs | 6 +++--- .../Hid/Keyboard/JoyconConfigKeyboardStick.cs | 12 ++++++------ .../Configuration/Hid/KeyboardHotkeys.cs | 2 +- .../Configuration/Hid/LeftJoyconCommonConfig.cs | 20 ++++++++++---------- .../Configuration/Hid/PlayerIndex.cs | 22 +++++++++++----------- .../Configuration/Hid/RightJoyconCommonConfig.cs | 22 +++++++++++----------- src/Ryujinx.Common/Configuration/HideCursorMode.cs | 4 ++-- src/Ryujinx.Common/Configuration/ScalingFilter.cs | 4 ++-- .../Configuration/TitleUpdateMetadata.cs | 6 +++--- .../TitleUpdateMetadataJsonSerializerContext.cs | 2 +- 28 files changed, 110 insertions(+), 104 deletions(-) (limited to 'src/Ryujinx.Common/Configuration') diff --git a/src/Ryujinx.Common/Configuration/AntiAliasing.cs b/src/Ryujinx.Common/Configuration/AntiAliasing.cs index 159108ae..9ab0458c 100644 --- a/src/Ryujinx.Common/Configuration/AntiAliasing.cs +++ b/src/Ryujinx.Common/Configuration/AntiAliasing.cs @@ -11,6 +11,6 @@ namespace Ryujinx.Common.Configuration SmaaLow, SmaaMedium, SmaaHigh, - SmaaUltra + SmaaUltra, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/AppDataManager.cs b/src/Ryujinx.Common/Configuration/AppDataManager.cs index b685e706..1dbc1f0c 100644 --- a/src/Ryujinx.Common/Configuration/AppDataManager.cs +++ b/src/Ryujinx.Common/Configuration/AppDataManager.cs @@ -18,7 +18,7 @@ namespace Ryujinx.Common.Configuration { UserProfile, Portable, - Custom + Custom, } public static LaunchMode Mode { get; private set; } @@ -34,7 +34,7 @@ namespace Ryujinx.Common.Configuration private const string DefaultModsDir = "mods"; public static string CustomModsPath { get; set; } - public static string CustomSdModsPath {get; set; } + public static string CustomSdModsPath { get; set; } public static string CustomNandPath { get; set; } // TODO: Actually implement this into VFS public static string CustomSdCardPath { get; set; } // TODO: Actually implement this into VFS @@ -151,7 +151,7 @@ namespace Ryujinx.Common.Configuration } } - public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName; + public static string GetModsPath() => CustomModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultModsDir)).FullName; public static string GetSdModsPath() => CustomSdModsPath ?? Directory.CreateDirectory(Path.Combine(BaseDirPath, DefaultSdcardDir, "atmosphere")).FullName; } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs index 5e97ed19..c9bf2465 100644 --- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs +++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Common.Configuration Fixed16x10, Fixed21x9, Fixed32x9, - Stretched + Stretched, } public static class AspectRatioExtensions @@ -25,12 +25,14 @@ namespace Ryujinx.Common.Configuration { return aspectRatio switch { +#pragma warning disable IDE0055 // Disable formatting AspectRatio.Fixed4x3 => 4.0f, AspectRatio.Fixed16x9 => 16.0f, AspectRatio.Fixed16x10 => 16.0f, AspectRatio.Fixed21x9 => 21.0f, AspectRatio.Fixed32x9 => 32.0f, - _ => 16.0f + _ => 16.0f, +#pragma warning restore IDE0055 }; } @@ -38,12 +40,14 @@ namespace Ryujinx.Common.Configuration { return aspectRatio switch { +#pragma warning disable IDE0055 // Disable formatting AspectRatio.Fixed4x3 => 3.0f, AspectRatio.Fixed16x9 => 9.0f, AspectRatio.Fixed16x10 => 10.0f, AspectRatio.Fixed21x9 => 9.0f, AspectRatio.Fixed32x9 => 9.0f, - _ => 9.0f + _ => 9.0f, +#pragma warning restore IDE0055 }; } @@ -51,13 +55,15 @@ namespace Ryujinx.Common.Configuration { return aspectRatio switch { +#pragma warning disable IDE0055 // Disable formatting AspectRatio.Fixed4x3 => "4:3", AspectRatio.Fixed16x9 => "16:9", AspectRatio.Fixed16x10 => "16:10", AspectRatio.Fixed21x9 => "21:9", AspectRatio.Fixed32x9 => "32:9", - _ => "Stretched" + _ => "Stretched", +#pragma warning restore IDE0055 }; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs b/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs index b6ae2f3f..f9e68a3c 100644 --- a/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs +++ b/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs @@ -10,4 +10,4 @@ namespace Ryujinx.Common.Configuration [JsonPropertyName("dlc_nca_list")] public List DownloadableContentNcaList { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs b/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs index 132c45a4..0dbc0a30 100644 --- a/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs +++ b/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs @@ -8,4 +8,4 @@ namespace Ryujinx.Common.Configuration public partial class DownloadableContentJsonSerializerContext : JsonSerializerContext { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs b/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs index 80b67300..dded719c 100644 --- a/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs +++ b/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs @@ -7,8 +7,8 @@ namespace Ryujinx.Common.Configuration [JsonPropertyName("path")] public string FullPath { get; set; } [JsonPropertyName("title_id")] - public ulong TitleId { get; set; } + public ulong TitleId { get; set; } [JsonPropertyName("is_enabled")] - public bool Enabled { get; set; } + public bool Enabled { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs b/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs index ad1fa667..78bc46f2 100644 --- a/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs +++ b/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs @@ -53,6 +53,6 @@ namespace Ryujinx.Common.Configuration.Hid.Controller SingleLeftTrigger1, SingleRightTrigger1, - Count + Count, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs b/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs index d7f0e788..abc245bc 100644 --- a/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs +++ b/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; namespace Ryujinx.Common.Configuration.Hid.Controller { - public class GenericControllerInputConfig : GenericInputConfigurationCommon