diff --git a/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs b/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs index 21b1f503c..7c8e6909c 100644 --- a/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs +++ b/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs @@ -28,7 +28,9 @@ namespace Ryujinx.Ava.Utilities.Compat public class CompatibilityCsv { - static CompatibilityCsv() + static CompatibilityCsv() => Load(); + + public static void Load() { using Stream csvStream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("RyujinxGameCompatibilityList")!; @@ -37,15 +39,31 @@ namespace Ryujinx.Ava.Utilities.Compat using SepReader reader = Sep.Reader().From(csvStream); ColumnIndices columnIndices = new(reader.Header.IndexOf); - Entries = reader + _entries = reader .Enumerate(row => new CompatibilityEntry(ref columnIndices, row)) .OrderBy(it => it.GameName) .ToArray(); - Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.", "LoadCompatCsv"); + Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.", "LoadCompatibility"); } - public static CompatibilityEntry[] Entries { get; private set; } + public static void Unload() + { + _entries = null; + } + + private static CompatibilityEntry[] _entries; + + public static CompatibilityEntry[] Entries + { + get + { + if (_entries == null) + Load(); + + return _entries; + } + } } public class CompatibilityEntry diff --git a/src/Ryujinx/Utilities/Compat/CompatibilityList.axaml.cs b/src/Ryujinx/Utilities/Compat/CompatibilityList.axaml.cs index 841db23a8..7fc48b187 100644 --- a/src/Ryujinx/Utilities/Compat/CompatibilityList.axaml.cs +++ b/src/Ryujinx/Utilities/Compat/CompatibilityList.axaml.cs @@ -1,11 +1,8 @@ using Avalonia.Controls; using Avalonia.Styling; using FluentAvalonia.UI.Controls; -using nietras.SeparatedValues; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; -using System.IO; -using System.Reflection; using System.Threading.Tasks; namespace Ryujinx.Ava.Utilities.Compat @@ -35,6 +32,8 @@ namespace Ryujinx.Ava.Utilities.Compat contentDialog.Styles.Add(closeButtonParent); await ContentDialogHelper.ShowAsync(contentDialog); + + CompatibilityCsv.Unload(); } public CompatibilityList()