From d87066c634dd4835ea12291f5c852c3a1666ddb3 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sat, 2 Jan 2021 17:59:45 +1000 Subject: [PATCH] Convert Blob_ECM.IndexEntry to a readonly struct --- .../DiscFormats/Blobs/Blob_ECM.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs index f7b014ec01..a7d538db2f 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_ECM.cs @@ -42,12 +42,23 @@ namespace BizHawk.Emulation.DiscSystem stream = null; } - private class IndexEntry + private readonly struct IndexEntry { - public int Type; - public uint Number; - public long ECMOffset; - public long LogicalOffset; + public readonly long ECMOffset; + + public readonly long LogicalOffset; + + public readonly uint Number; + + public readonly int Type; + + public IndexEntry(int type, uint number, long ecmOffset, long logicalOffset) + { + Type = type; + Number = number; + ECMOffset = ecmOffset; + LogicalOffset = logicalOffset; + } } /// @@ -100,15 +111,7 @@ namespace BizHawk.Emulation.DiscSystem uint todo = (uint)N + 1; - IndexEntry ie = new IndexEntry - { - Number = todo, - ECMOffset = stream.Position, - LogicalOffset = logOffset, - Type = T - }; - - Index.Add(ie); + Index.Add(new IndexEntry(type: T, number: todo, ecmOffset: stream.Position, logicalOffset: logOffset)); if (T == 0) {