mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-10 17:14:25 +00:00
UI: collapse LoadFromStream into static ctor
pass the index get delegate to the struct instead of the entire header
This commit is contained in:
parent
292e27f0da
commit
c5574b41a1
@ -11,7 +11,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.Compat
|
namespace Ryujinx.Ava.Utilities.Compat
|
||||||
{
|
{
|
||||||
public struct ColumnIndices(SepReaderHeader header)
|
public struct ColumnIndices(Func<string, int> getIndex)
|
||||||
{
|
{
|
||||||
public const string TitleIdCol = "\"title_id\"";
|
public const string TitleIdCol = "\"title_id\"";
|
||||||
public const string GameNameCol = "\"game_name\"";
|
public const string GameNameCol = "\"game_name\"";
|
||||||
@ -19,11 +19,11 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
public const string StatusCol = "\"status\"";
|
public const string StatusCol = "\"status\"";
|
||||||
public const string LastUpdatedCol = "\"last_updated\"";
|
public const string LastUpdatedCol = "\"last_updated\"";
|
||||||
|
|
||||||
public readonly int TitleId = header.IndexOf(TitleIdCol);
|
public readonly int TitleId = getIndex(TitleIdCol);
|
||||||
public readonly int GameName = header.IndexOf(GameNameCol);
|
public readonly int GameName = getIndex(GameNameCol);
|
||||||
public readonly int Labels = header.IndexOf(LabelsCol);
|
public readonly int Labels = getIndex(LabelsCol);
|
||||||
public readonly int Status = header.IndexOf(StatusCol);
|
public readonly int Status = getIndex(StatusCol);
|
||||||
public readonly int LastUpdated = header.IndexOf(LastUpdatedCol);
|
public readonly int LastUpdated = getIndex(LastUpdatedCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompatibilityCsv
|
public class CompatibilityCsv
|
||||||
@ -34,13 +34,8 @@ namespace Ryujinx.Ava.Utilities.Compat
|
|||||||
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
||||||
csvStream.Position = 0;
|
csvStream.Position = 0;
|
||||||
|
|
||||||
LoadFromStream(csvStream);
|
using SepReader reader = Sep.Reader().From(csvStream);
|
||||||
}
|
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
||||||
|
|
||||||
public static void LoadFromStream(Stream stream)
|
|
||||||
{
|
|
||||||
using SepReader reader = Sep.Reader().From(stream);
|
|
||||||
ColumnIndices columnIndices = new(reader.Header);
|
|
||||||
|
|
||||||
Entries = reader
|
Entries = reader
|
||||||
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user