From c5574b41a127556cd800d413955de6a75213ca85 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Thu, 9 Jan 2025 19:44:24 -0600 Subject: [PATCH] UI: collapse LoadFromStream into static ctor pass the index get delegate to the struct instead of the entire header --- .../Utilities/Compat/CompatibilityCsv.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs b/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs index 8b8f456ef..b3812faa2 100644 --- a/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs +++ b/src/Ryujinx/Utilities/Compat/CompatibilityCsv.cs @@ -11,7 +11,7 @@ using System.Text; namespace Ryujinx.Ava.Utilities.Compat { - public struct ColumnIndices(SepReaderHeader header) + public struct ColumnIndices(Func getIndex) { public const string TitleIdCol = "\"title_id\""; public const string GameNameCol = "\"game_name\""; @@ -19,11 +19,11 @@ namespace Ryujinx.Ava.Utilities.Compat public const string StatusCol = "\"status\""; public const string LastUpdatedCol = "\"last_updated\""; - public readonly int TitleId = header.IndexOf(TitleIdCol); - public readonly int GameName = header.IndexOf(GameNameCol); - public readonly int Labels = header.IndexOf(LabelsCol); - public readonly int Status = header.IndexOf(StatusCol); - public readonly int LastUpdated = header.IndexOf(LastUpdatedCol); + public readonly int TitleId = getIndex(TitleIdCol); + public readonly int GameName = getIndex(GameNameCol); + public readonly int Labels = getIndex(LabelsCol); + public readonly int Status = getIndex(StatusCol); + public readonly int LastUpdated = getIndex(LastUpdatedCol); } public class CompatibilityCsv @@ -34,13 +34,8 @@ namespace Ryujinx.Ava.Utilities.Compat .GetManifestResourceStream("RyujinxGameCompatibilityList")!; csvStream.Position = 0; - LoadFromStream(csvStream); - } - - public static void LoadFromStream(Stream stream) - { - using SepReader reader = Sep.Reader().From(stream); - ColumnIndices columnIndices = new(reader.Header); + using SepReader reader = Sep.Reader().From(csvStream); + ColumnIndices columnIndices = new(reader.Header.IndexOf); Entries = reader .Enumerate(row => new CompatibilityEntry(ref columnIndices, row))