Refactor equality check in `MDS_Format.MountBlobs`
This commit is contained in:
parent
6184afddc9
commit
e5e56a478f
|
@ -657,6 +657,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <exception cref="MDSParseException">path reference no longer points to file</exception>
|
/// <exception cref="MDSParseException">path reference no longer points to file</exception>
|
||||||
private static Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
|
private static Dictionary<int, IBlob> MountBlobs(AFile mdsf, Disc disc)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(disc.DisposableResources.Count is 0, "no other method should be adding to DisposableResources");
|
||||||
var BlobIndex = new Dictionary<int, IBlob>();
|
var BlobIndex = new Dictionary<int, IBlob>();
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
@ -667,18 +668,11 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
if (!File.Exists(file))
|
if (!File.Exists(file))
|
||||||
throw new MDSParseException($"Malformed MDS format: nonexistent image file: {file}");
|
throw new MDSParseException($"Malformed MDS format: nonexistent image file: {file}");
|
||||||
|
|
||||||
//mount the file
|
//mount the file
|
||||||
var mdfBlob = new Blob_RawFile { PhysicalPath = file };
|
if (!disc.DisposableResources.Cast<Blob_RawFile>()
|
||||||
|
.Select(static re => re.PhysicalPath).Contains(file))
|
||||||
var dupe = false;
|
|
||||||
foreach (var re in disc.DisposableResources)
|
|
||||||
{
|
|
||||||
if (re.ToString() == mdfBlob.ToString())
|
|
||||||
dupe = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dupe)
|
|
||||||
{
|
{
|
||||||
|
Blob_RawFile mdfBlob = new() { PhysicalPath = file };
|
||||||
// wrap in zeropadadapter
|
// wrap in zeropadadapter
|
||||||
disc.DisposableResources.Add(mdfBlob);
|
disc.DisposableResources.Add(mdfBlob);
|
||||||
BlobIndex[count++] = mdfBlob;
|
BlobIndex[count++] = mdfBlob;
|
||||||
|
|
Loading…
Reference in New Issue