diff --git a/Ryujinx.Common/Extensions/EnumExtensions.cs b/Ryujinx.Common/Extensions/EnumExtensions.cs deleted file mode 100644 index 560af8829..000000000 --- a/Ryujinx.Common/Extensions/EnumExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Ryujinx.Common -{ - public static class EnumExtensions - { - public static T[] GetValues() - { - return (T[])Enum.GetValues(typeof(T)); - } - } -} diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index e41eaf535..040a555b6 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -94,7 +94,7 @@ namespace Ryujinx.Common.Logging static Logger() { - m_EnabledClasses = new bool[Enum.GetNames(typeof(LogClass)).Length]; + m_EnabledClasses = new bool[Enum.GetNames().Length]; for (int index = 0; index < m_EnabledClasses.Length; index++) { diff --git a/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs b/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs index d281a75a8..f8d839fa0 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitCompiler.cs @@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME _ilGen.Emit(OpCodes.Ret); } - return (MacroExecute)_meth.CreateDelegate(typeof(MacroExecute)); + return _meth.CreateDelegate(); } /// diff --git a/Ryujinx.Graphics.OpenGL/FormatTable.cs b/Ryujinx.Graphics.OpenGL/FormatTable.cs index 41fd9f370..c054ba57a 100644 --- a/Ryujinx.Graphics.OpenGL/FormatTable.cs +++ b/Ryujinx.Graphics.OpenGL/FormatTable.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.OpenGL static FormatTable() { - int tableSize = Enum.GetNames(typeof(Format)).Length; + int tableSize = Enum.GetNames().Length; Table = new FormatInfo[tableSize]; TableImage = new SizedInternalFormat[tableSize]; diff --git a/Ryujinx.Graphics.OpenGL/Queries/Counters.cs b/Ryujinx.Graphics.OpenGL/Queries/Counters.cs index 0c0a915d8..582800c8d 100644 --- a/Ryujinx.Graphics.OpenGL/Queries/Counters.cs +++ b/Ryujinx.Graphics.OpenGL/Queries/Counters.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries public Counters() { - int count = Enum.GetNames(typeof(CounterType)).Length; + int count = Enum.GetNames().Length; _counterQueues = new CounterQueue[count]; } diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs index 9203f1568..8ac31a4c5 100644 --- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs +++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs @@ -102,7 +102,7 @@ namespace Ryujinx.HLE.FileSystem.Content _contentDictionary = new SortedDictionary<(ulong, NcaContentType), string>(); _locationEntries = new Dictionary>(); - foreach (StorageId storageId in Enum.GetValues(typeof(StorageId))) + foreach (StorageId storageId in Enum.GetValues()) { string contentDirectory = null; string contentPathString = null; diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs index 178dc0298..91ab4d96b 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs @@ -433,7 +433,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall generator.Emit(OpCodes.Ret); - return (Action)method.CreateDelegate(typeof(Action)); + return method.CreateDelegate>(); } private static void CheckIfTypeIsSupported(Type type, string svcName) diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index 2fdb94e40..21572b9f2 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -1021,7 +1021,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid HidVibrationDeviceType vibrationDeviceType = HidVibrationDeviceType.None; - if (Enum.IsDefined(typeof(NpadStyleIndex), deviceType)) + if (Enum.IsDefined(deviceType)) { vibrationDeviceType = HidVibrationDeviceType.LinearResonantActuator; } diff --git a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index 8aa0bffff..cceaf563e 100644 --- a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -60,7 +60,7 @@ namespace Ryujinx.HLE.HOS.SystemState SystemLanguage.TraditionalChinese => TitleLanguage.Taiwanese, SystemLanguage.Chinese or SystemLanguage.SimplifiedChinese => TitleLanguage.Chinese, - _ => Enum.Parse(Enum.GetName(typeof(SystemLanguage), language)), + _ => Enum.Parse(Enum.GetName(language)), }; } diff --git a/Ryujinx.Input/Motion/CemuHook/Client.cs b/Ryujinx.Input/Motion/CemuHook/Client.cs index 214e23f0f..ecaf26f03 100644 --- a/Ryujinx.Input/Motion/CemuHook/Client.cs +++ b/Ryujinx.Input/Motion/CemuHook/Client.cs @@ -27,8 +27,8 @@ namespace Ryujinx.Input.Motion.CemuHook private readonly Dictionary> _motionData; private readonly Dictionary _clients; - private readonly bool[] _clientErrorStatus = new bool[Enum.GetValues(typeof(PlayerIndex)).Length]; - private readonly long[] _clientRetryTimer = new long[Enum.GetValues(typeof(PlayerIndex)).Length]; + private readonly bool[] _clientErrorStatus = new bool[Enum.GetValues().Length]; + private readonly long[] _clientRetryTimer = new long[Enum.GetValues().Length]; private NpadManager _npadManager; public Client(NpadManager npadManager) diff --git a/Ryujinx/Configuration/LoggerModule.cs b/Ryujinx/Configuration/LoggerModule.cs index 44631ea08..2599eeffa 100644 --- a/Ryujinx/Configuration/LoggerModule.cs +++ b/Ryujinx/Configuration/LoggerModule.cs @@ -58,7 +58,7 @@ namespace Ryujinx.Configuration { bool noFilter = e.NewValue.Length == 0; - foreach (var logClass in EnumExtensions.GetValues()) + foreach (var logClass in Enum.GetValues()) { Logger.SetEnable(logClass, noFilter); } diff --git a/Ryujinx/Input/GTK3/GTK3MappingHelper.cs b/Ryujinx/Input/GTK3/GTK3MappingHelper.cs index 49ea0d15c..1035e4153 100644 --- a/Ryujinx/Input/GTK3/GTK3MappingHelper.cs +++ b/Ryujinx/Input/GTK3/GTK3MappingHelper.cs @@ -150,7 +150,7 @@ namespace Ryujinx.Input.GTK3 static GTK3MappingHelper() { - var inputKeys = Enum.GetValues(typeof(Key)); + var inputKeys = Enum.GetValues(); // GtkKey is not contiguous and quite large, so use a dictionary instead of an array. _gtkKeyMapping = new Dictionary(); diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index 6f34304f4..cc3c12396 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -1209,7 +1209,7 @@ namespace Ryujinx.Ui { AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value; - ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1; + ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames().Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1; } private void Row_Clicked(object sender, ButtonReleaseEventArgs args) diff --git a/Ryujinx/Ui/Windows/SettingsWindow.cs b/Ryujinx/Ui/Windows/SettingsWindow.cs index 0a188fb75..8434d652b 100644 --- a/Ryujinx/Ui/Windows/SettingsWindow.cs +++ b/Ryujinx/Ui/Windows/SettingsWindow.cs @@ -181,7 +181,7 @@ namespace Ryujinx.Ui.Windows _fsAccessLogToggle.Click(); } - foreach (GraphicsDebugLevel level in Enum.GetValues(typeof(GraphicsDebugLevel))) + foreach (GraphicsDebugLevel level in Enum.GetValues()) { _graphicsDebugLevel.Append(level.ToString(), level.ToString()); }