FileTypeExtensions.cs
1 using System; 2 using static Ryujinx.UI.Common.Configuration.ConfigurationState.UISection; 3 4 namespace Ryujinx.UI.Common 5 { 6 public static class FileTypesExtensions 7 { 8 /// <summary> 9 /// Gets the current <see cref="ShownFileTypeSettings"/> value for the correlating FileType name. 10 /// </summary> 11 /// <param name="type">The name of the <see cref="ShownFileTypeSettings"/> parameter to get the value of.</param> 12 /// <param name="config">The config instance to get the value from.</param> 13 /// <returns>The current value of the setting. Value is <see langword="true"/> if the file type is the be shown on the games list, <see langword="false"/> otherwise.</returns> 14 public static bool GetConfigValue(this FileTypes type, ShownFileTypeSettings config) => type switch 15 { 16 FileTypes.NSP => config.NSP.Value, 17 FileTypes.PFS0 => config.PFS0.Value, 18 FileTypes.XCI => config.XCI.Value, 19 FileTypes.NCA => config.NCA.Value, 20 FileTypes.NRO => config.NRO.Value, 21 FileTypes.NSO => config.NSO.Value, 22 _ => throw new ArgumentOutOfRangeException(nameof(type), type, null), 23 }; 24 } 25 }