From 4634ee56bc1c045df59874a9c5f034e72d729e66 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 22 Oct 2022 01:04:27 -0700 Subject: [PATCH] Don't expose Span with get property Closes #282 --- .../Personal/Info/PersonalInfo8SWSH.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkNX.Structures/Personal/Info/PersonalInfo8SWSH.cs b/pkNX.Structures/Personal/Info/PersonalInfo8SWSH.cs index 74cd561d..f5b56f20 100644 --- a/pkNX.Structures/Personal/Info/PersonalInfo8SWSH.cs +++ b/pkNX.Structures/Personal/Info/PersonalInfo8SWSH.cs @@ -110,12 +110,16 @@ public byte[] Write() public ushort Quantized_floats_3 { get => ReadUInt16LittleEndian(Data.AsSpan(0x66)); set => WriteUInt16LittleEndian(Data.AsSpan(0x66), value); } public ushort Quantized_floats_4 { get => ReadUInt16LittleEndian(Data.AsSpan(0x68)); set => WriteUInt16LittleEndian(Data.AsSpan(0x68), value); } - public Span Bytes_0 => Data.AsSpan(0x6A, 10); - public Span Bytes_1 => Data.AsSpan(0x74, 10); - public Span Bytes_2 => Data.AsSpan(0x7E, 5); - public Span Bytes_3 => Data.AsSpan(0x83, 5); - public Span Bytes_4 => Data.AsSpan(0x88, 5); - public Span Bytes_5 => Data.AsSpan(0x8D, 5); + public Span GetUnknownByteSet(int index) => index switch + { + 0 => Data.AsSpan(0x6A, 10), + 1 => Data.AsSpan(0x74, 10), + 2 => Data.AsSpan(0x7E, 5), + 3 => Data.AsSpan(0x83, 5), + 4 => Data.AsSpan(0x88, 5), + 5 => Data.AsSpan(0x8D, 5), + _ => throw new ArgumentOutOfRangeException(nameof(index)), + }; public ushort Shorts_0 { get => ReadUInt16LittleEndian(Data.AsSpan(0x92)); set => WriteUInt16LittleEndian(Data.AsSpan(0x92), value); } public ushort Shorts_1 { get => ReadUInt16LittleEndian(Data.AsSpan(0x94)); set => WriteUInt16LittleEndian(Data.AsSpan(0x94), value); }