mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-01-23 13:35:04 +03:00
UI: Compat: Unload compatibility entries when the window closes.
This commit is contained in:
parent
7fcd9b792e
commit
6482e566ab
@ -28,7 +28,9 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
|
|
||||||
public class CompatibilityCsv
|
public class CompatibilityCsv
|
||||||
{
|
{
|
||||||
static CompatibilityCsv()
|
static CompatibilityCsv() => Load();
|
||||||
|
|
||||||
|
public static void Load()
|
||||||
{
|
{
|
||||||
using Stream csvStream = Assembly.GetExecutingAssembly()
|
using Stream csvStream = Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
||||||
@ -37,15 +39,31 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
using SepReader reader = Sep.Reader().From(csvStream);
|
using SepReader reader = Sep.Reader().From(csvStream);
|
||||||
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
||||||
|
|
||||||
Entries = reader
|
_entries = reader
|
||||||
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
||||||
.OrderBy(it => it.GameName)
|
.OrderBy(it => it.GameName)
|
||||||
.ToArray();
|
.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
|
public class CompatibilityEntry
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using nietras.SeparatedValues;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.Compat
|
namespace Ryujinx.Ava.Utilities.Compat
|
||||||
@ -35,6 +32,8 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
contentDialog.Styles.Add(closeButtonParent);
|
contentDialog.Styles.Add(closeButtonParent);
|
||||||
|
|
||||||
await ContentDialogHelper.ShowAsync(contentDialog);
|
await ContentDialogHelper.ShowAsync(contentDialog);
|
||||||
|
|
||||||
|
CompatibilityCsv.Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompatibilityList()
|
public CompatibilityList()
|
||||||
|
Loading…
Reference in New Issue
Block a user